From 6a1a21559f744b0436d6b872a8b513a612a08a9c Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Wed, 28 Dec 2022 20:05:06 +0900 Subject: [PATCH] new package: cups-pdf --- ...df-3.0.1-ghostscript-gpl-9.54-compat.patch | 30 ++++++ .../cups-pdf/0001-fix-hardcoded-paths.patch | 100 ++++++++++++++++++ packages/cups-pdf/build.sh | 23 ++++ 3 files changed, 153 insertions(+) create mode 100644 packages/cups-pdf/0000-cups-pdf-3.0.1-ghostscript-gpl-9.54-compat.patch create mode 100644 packages/cups-pdf/0001-fix-hardcoded-paths.patch create mode 100644 packages/cups-pdf/build.sh diff --git a/packages/cups-pdf/0000-cups-pdf-3.0.1-ghostscript-gpl-9.54-compat.patch b/packages/cups-pdf/0000-cups-pdf-3.0.1-ghostscript-gpl-9.54-compat.patch new file mode 100644 index 0000000000..66b65099a4 --- /dev/null +++ b/packages/cups-pdf/0000-cups-pdf-3.0.1-ghostscript-gpl-9.54-compat.patch @@ -0,0 +1,30 @@ +Borrowed from https://github.com/gentoo/gentoo/blob/315ec115b0312f4e43cacfdcc93fce4ba1505532/net-print/cups-pdf/files/cups-pdf-3.0.1-ghostscript-gpl-9.54-compat.patch + +https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=180419375973b9ce4664286a67106d712260ef7f + +--- a/extra/cups-pdf.conf ++++ b/extra/cups-pdf.conf +@@ -250,9 +250,9 @@ + ### Key: GSCall (config) + ## command line for calling GhostScript (!!! DO NOT USE NEWLINES !!!) + ## MacOSX: for using pstopdf set this to %s %s -o %s %s +-### Default: %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s ++### Default: %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c -f %s + +-#GSCall %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s ++#GSCall %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c -f %s + + ### Key: PDFVer (config, ppd, lptopions) + ## PDF version to be created - can be "1.5", "1.4", "1.3" or "1.2" +--- a/src/cups-pdf.h ++++ b/src/cups-pdf.h +@@ -58,7 +58,7 @@ struct { + { "AnonDirName", SEC_CONF|SEC_PPD, { "/var/spool/cups-pdf/ANONYMOUS" } }, + { "AnonUser", SEC_CONF|SEC_PPD, { "nobody" } }, + { "GhostScript", SEC_CONF|SEC_PPD, { "/usr/bin/gs" } }, +- { "GSCall", SEC_CONF|SEC_PPD, { "%s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s" } }, ++ { "GSCall", SEC_CONF|SEC_PPD, { "%s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c -f %s" } }, + { "Grp", SEC_CONF|SEC_PPD, { "lp" } }, + { "GSTmp", SEC_CONF|SEC_PPD, { "TMPDIR=/var/tmp" } }, + { "Log", SEC_CONF|SEC_PPD, { "/var/log/cups" } }, + diff --git a/packages/cups-pdf/0001-fix-hardcoded-paths.patch b/packages/cups-pdf/0001-fix-hardcoded-paths.patch new file mode 100644 index 0000000000..874d982c69 --- /dev/null +++ b/packages/cups-pdf/0001-fix-hardcoded-paths.patch @@ -0,0 +1,100 @@ +--- a/extra/cups-pdf.conf ++++ b/extra/cups-pdf.conf +@@ -46,23 +46,23 @@ + ## ${USER} will be expanded to the user name + ## in case it is an NFS export make sure it is exported without + ## root_squash! +-### Default: /var/spool/cups-pdf/${USER} ++### Default: @TERMUX_PREFIX@/var/spool/cups-pdf/${USER} + +-#Out /var/spool/cups-pdf/${USER} ++#Out @TERMUX_PREFIX@/var/spool/cups-pdf/${USER} + + ### Key: AnonDirName (config) + ## ABSOLUTE path for anonymously created PDF files + ## if anonymous access is disabled this setting has no effect +-### Default: /var/spool/cups-pdf/ANONYMOUS ++### Default: @TERMUX_PREFIX@/var/spool/cups-pdf/ANONYMOUS + +-#AnonDirName /var/spool/cups-pdf/ANONYMOUS ++#AnonDirName @TERMUX_PREFIX@/var/spool/cups-pdf/ANONYMOUS + + ### Key: Spool (config) + ## CUPS-PDF spool directory - make sure there is no user 'SPOOL' on your + ## system or change the path +-### Default: /var/spool/cups-pdf/SPOOL ++### Default: @TERMUX_PREFIX@/var/spool/cups-pdf/SPOOL + +-#Spool /var/spool/cups-pdf/SPOOL ++#Spool @TERMUX_PREFIX@/var/spool/cups-pdf/SPOOL + + + ########################################################################### +@@ -210,9 +210,9 @@ + ### Key: Log (config) + ## CUPS-PDF log directory + ## set this to an empty value to disable all logging +-### Default: /var/log/cups ++### Default: @TERMUX_PREFIX@/var/log/cups + +-#Log /var/log/cups ++#Log @TERMUX_PREFIX@/var/log/cups + + ### Key: LogType (config, ppd) + ## log-mode +@@ -236,16 +236,16 @@ + ## location of GhostScript binary (gs) + ## MacOSX: for using pstopdf (recommended) set this to /usr/bin/pstopdf + ## or its proper location on your system +-### Default: /usr/bin/gs ++### Default: @TERMUX_PREFIX@/bin/gs + +-#GhostScript /usr/bin/gs ++#GhostScript @TERMUX_PREFIX@/bin/gs + + ### Key: GSTmp (config) + ## location of temporary files during GhostScript operation + ## this must be user-writable like /var/tmp or /tmp ! +-### Default: /var/tmp ++### Default: @TERMUX_PREFIX@/tmp + +-#GSTmp /var/tmp ++#GSTmp @TERMUX_PREFIX@/tmp + + ### Key: GSCall (config) + ## command line for calling GhostScript (!!! DO NOT USE NEWLINES !!!) +--- a/src/cups-pdf.h ++++ b/src/cups-pdf.h +@@ -18,7 +18,7 @@ + / they are reasonable for most systems. */ + + /* location of the configuration file */ +-#define CP_CONFIG_PATH "/etc/cups" ++#define CP_CONFIG_PATH "@TERMUX_PREFIX@/etc/cups" + + + /* --- DO NOT EDIT BELOW THIS LINE --- */ +@@ -55,17 +55,17 @@ + mode_t modval; + } value; + } configData[] = { +- { "AnonDirName", SEC_CONF|SEC_PPD, { "/var/spool/cups-pdf/ANONYMOUS" } }, ++ { "AnonDirName", SEC_CONF|SEC_PPD, { "@TERMUX_PREFIX@/var/spool/cups-pdf/ANONYMOUS" } }, + { "AnonUser", SEC_CONF|SEC_PPD, { "nobody" } }, +- { "GhostScript", SEC_CONF|SEC_PPD, { "/usr/bin/gs" } }, ++ { "GhostScript", SEC_CONF|SEC_PPD, { "@TERMUX_PREFIX@/bin/gs" } }, + { "GSCall", SEC_CONF|SEC_PPD, { "%s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c -f %s" } }, + { "Grp", SEC_CONF|SEC_PPD, { "lp" } }, +- { "GSTmp", SEC_CONF|SEC_PPD, { "TMPDIR=/var/tmp" } }, +- { "Log", SEC_CONF|SEC_PPD, { "/var/log/cups" } }, ++ { "GSTmp", SEC_CONF|SEC_PPD, { "TMPDIR=@TERMUX_PREFIX@/tmp" } }, ++ { "Log", SEC_CONF|SEC_PPD, { "@TERMUX_PREFIX@/var/log/cups" } }, + { "PDFVer", SEC_CONF|SEC_PPD|SEC_LPOPT, { "1.4" } }, + { "PostProcessing", SEC_CONF|SEC_PPD|SEC_LPOPT, { "" } }, +- { "Out", SEC_CONF|SEC_PPD, { "/var/spool/cups-pdf/${USER}" } }, +- { "Spool", SEC_CONF|SEC_PPD, { "/var/spool/cups-pdf/SPOOL" } }, ++ { "Out", SEC_CONF|SEC_PPD, { "@TERMUX_PREFIX@/var/spool/cups-pdf/${USER}" } }, ++ { "Spool", SEC_CONF|SEC_PPD, { "@TERMUX_PREFIX@/var/spool/cups-pdf/SPOOL" } }, + { "UserPrefix", SEC_CONF|SEC_PPD, { "" } }, + { "RemovePrefix", SEC_CONF|SEC_PPD, { "" } }, + { "OutExtension", SEC_CONF|SEC_PPD|SEC_LPOPT, { "pdf" } }, diff --git a/packages/cups-pdf/build.sh b/packages/cups-pdf/build.sh new file mode 100644 index 0000000000..b68371cd3a --- /dev/null +++ b/packages/cups-pdf/build.sh @@ -0,0 +1,23 @@ +TERMUX_PKG_HOMEPAGE=https://www.cups-pdf.de/ +TERMUX_PKG_DESCRIPTION="CUPS PDF backend" +TERMUX_PKG_LICENSE="GPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=3.0.1 +TERMUX_PKG_SRCURL=https://www.cups-pdf.de/src/cups-pdf_${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=738669edff7f1469fe5e411202d87f93ba25b45f332a623fb607d49c59aa9531 +TERMUX_PKG_DEPENDS="cups, ghostscript" +TERMUX_PKG_CONFFILES="etc/cups/cups-pdf.conf" + +termux_step_make() { + $CC $CFLAGS $CPPFLAGS $TERMUX_PKG_SRCDIR/src/cups-pdf.c \ + -o cups-pdf $LDFLAGS -lcups +} + +termux_step_make_install() { + install -Dm700 -t $TERMUX_PREFIX/lib/cups/backend \ + cups-pdf + install -Dm600 -t $TERMUX_PREFIX/etc/cups \ + $TERMUX_PKG_SRCDIR/extra/cups-pdf.conf + install -Dm600 -t $TERMUX_PREFIX/share/cups/model \ + $TERMUX_PKG_SRCDIR/extra/CUPS-PDF_opt.ppd +}