で、紹介したPySendFaxですが、私は実際raspiではなくミニPCのOpenWrt上で動かしています。PySendFaxはghostscriptが必要なのですが、OpenWrtにはパッケージが用意されていないので、自分でビルドしていれてます。
ghostscriptのパッケージMakefileの準備
私の$HOMEは/home/igariです。
mkdir -p openwrt_custom/multimedia/ghostscript
として、openwrt_custom/multimedia/ghostscript/Makefileを以下の内容で作ります。
#
# Copyright (C) 2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ghostscript
PKG_VERSION:=10.08.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10080/
PKG_HASH:=caf199e3f233f1290b27d0972d636f66c303355f2353309b7bfddf1edda06b3d
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/ghostscript
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=ghostscript
DEPENDS:= +fontconfig +libtiff +libjpeg +libpng +zlib
endef
define Package/ghostscript/description
Ghostscript, an interpreter for the PostScript language and for PDF.
endef
CONFIGURE_ARGS += \
--with-drivers=FILES \
--with-system-libtiff \
--without-tesseract
define Build/Configure
(cd $(PKG_BUILD_DIR) && $(RM) -r jpeg libpng zlib)
$(call Build/Configure/Default)
endef
define Package/ghostscript/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
endef
$(eval $(call BuildPackage,ghostscript))
※ Build/Configure と Package/ghostscript/install 内の行頭インデントはタブ文字にしてください
ビルド環境の準備
私のOpenWrtはN100なミニPCで動いているので、ターゲットはx86/64になります。ホストはFedora44です。
Build system setup にしたがって、ホストにビルドで必要なパッケージをインストールします。
OpenWrt-SDKを準備
OpenWrt-SDK をダウンロードします。
tar -Izstd -xvf openwrt-sdk-25.12.6-x86-64_gcc-14.3.0_musl.Linux-x86_64.tar.zst
で、展開し、できたフォルダに移動します。
パッケージMakefile群の準備
cp feeds.conf.default feeds.conf
して、feeds.confの末尾に
src-link custom /home/igari/openwrt_custom
を加えます。
scripts/feeds update -a
で、すべてのパッケージMakefileをダウンロードします。
scripts/feeds install ghostscript
で、ghostscriptのビルドに必要なパッケージへのシンボリックリンクがpackageフォルダに作られます。
make menuconfig
make menuconfig
して、Multimediaにあるghostscriptが有効になっていることを確認します。Saveして終了します。
ビルド
make package/ghostscript/compile
で、ビルドを開始します。
終了したら、bin/packages/x86_64/customフォルダにパッケージが出来ています。
ターゲットにできたapkをコピーしてインストール
scpなどで、ghostscript-10.08.0-r1.apkをターゲットにもっていき、
apk add --allow-untrusted ghostscript-10.08.0-r1.apk
でインストールします。
追記 Raspi4BのOpenWrtでもクロスコンパイルできました。
同じMakefileを使って、openwrt-sdk-25.12.5-bcm27xx-bcm2711_gcc-14.3.0_musl.Linux-x86_64でクロスコンパイルできました。
インストールできてgsコマンドのテストもうまくいきました。
おまけ ローカルリポジトリの作成
ghostscriptはできるapkが1つだけなので、わざわざローカルリポジトリを作成しなくてもいいですが、複数のapkができる場合のために書きます。
make package/index
します。
bin/packages/x86_64/customフォルダーをターゲットの/root/customにコピーしたとします。
/etc/apk/repositories.d/customfeeds.listに
file:///root/custom/packages.adb
を加えます。
sdkのフォルダーにあるpublic-key.pemを/etc/apk/keysにコピーします。
これで、apk addでインストール出来るようになります。