new package: cups-pdf

This commit is contained in:
Tee KOBAYASHI 2022-12-28 20:05:06 +09:00 committed by xtkoba
parent f7abae1634
commit 6a1a21559f
3 changed files with 153 additions and 0 deletions

View File

@ -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" } },

View File

@ -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" } },

View File

@ -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
}