ghostscript: Update to 9.21 and patch to make it build. (#867)
authorGrimler91 <henka20@hotmail.com>
Tue, 21 Mar 2017 22:33:23 +0000 (23:33 +0100)
committerFredrik Fornwall <fredrik@fornwall.net>
Tue, 21 Mar 2017 22:33:23 +0000 (23:33 +0100)
Package builds but doesn't work on device, running gs gives error:
"GPL Ghostscript 9.21: /home/builder/.termux-build/ghostscript/src/psi/interp.c(303): Fatal error -20 in gs_interp_init!"

disabled-packages/ghostscript/Makefile.in.patch [deleted file]
disabled-packages/ghostscript/build.sh
disabled-packages/ghostscript/configure.patch [new file with mode: 0644]
disabled-packages/ghostscript/gserrors.h.patch [new file with mode: 0644]

diff --git a/disabled-packages/ghostscript/Makefile.in.patch b/disabled-packages/ghostscript/Makefile.in.patch
deleted file mode 100644 (file)
index 653f7c0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -u -r ../ghostscript-9.18/Makefile.in ./Makefile.in
---- ../ghostscript-9.18/Makefile.in    2015-10-05 04:21:11.000000000 -0400
-+++ ./Makefile.in      2015-12-06 16:58:25.937579450 -0500
-@@ -130,7 +130,7 @@
- # Choose generic configuration options.
--TARGET_ARCH_FILE=@ARCH_CONF_HEADER@
-+TARGET_ARCH_FILE=/home/fornwall/dc/packages/ghostscript/arch-arm.h
- # -DDEBUG
- #     includes debugging features (-Z switch) in the code.
-@@ -360,7 +360,7 @@
- # Define the name of the C compiler (target and host (AUX))
- CC=@CC@
--CCAUX=@CC@
-+CCAUX=$(CC_FOR_BUILD)
- # Define the name of the linker for the final link step.
- # Normally this is the same as the C compiler.
-@@ -631,7 +631,7 @@
- CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS)
- CC_=$(CC) $(CCFLAGS)
--CCAUX_=$(CCAUX) $(CFLAGS)
-+CCAUX_=$(CCAUX)
- CC_LEAF=$(CC_)
- # note gcc can't use -fomit-frame-pointer with -pg.
- CC_LEAF_PG=$(CC_)
index 7e2d7cf..080f41f 100644 (file)
@@ -1,17 +1,36 @@
 TERMUX_PKG_HOMEPAGE=http://www.ghostscript.com/
 TERMUX_PKG_DESCRIPTION="Interpreter for the PostScript language and for PDF"
-TERMUX_PKG_VERSION=9.18
-TERMUX_PKG_SRCURL=http://downloads.ghostscript.com/public/ghostscript-${TERMUX_PKG_VERSION}.tar.gz
-TERMUX_PKG_DEPENDS="libtiff"
-TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-system-libtiff --enable-little-endian"
+TERMUX_PKG_VERSION=9.21
+TERMUX_PKG_SRCURL=https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${TERMUX_PKG_VERSION//.}/ghostpdl-${TERMUX_PKG_VERSION}.tar.gz
+TERMUX_PKG_SHA256=82abf56e96e27cf4d1b17c0671f9ab3c5222454131588a49d06c97a332988e8d
+TERMUX_PKG_DEPENDS="libandroid-support, libtiff, libjpeg-turbo, libpng"
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-system-libtiff \
+--enable-little-endian \
+--without-x \
+--with-arch_h=$TERMUX_PKG_BUILDER_DIR/arch-arm.h \
+CCAUX=gcc \
+--build=$TERMUX_BUILD_TUPLE \
+--without-pcl"
 
-# See " it possible to cross compile GhostPCL/GhostXPS" at bottom of
-# http://ghostscript.com/FAQ.html
+#building with PCL gives:
+# /home/builder/.termux-build/ghostscript/src/pcl/pl/pl.mak:108: recipe for target 'obj/plver.h' failed
+# make: *** [obj/plver.h] Segmentation fault (core dumped)
+# make: *** Deleting file 'obj/plver.h'
+#See also: https://bugs.ghostscript.com/show_bug.cgi?id=695979
 
-termux_step_pre_configure () {
-       export CCAUX=gcc
+termux_step_post_extract_package () {
+        rm -rdf $TERMUX_PKG_SRCDIR/jpeg
+       rm -rdf $TERMUX_PKG_SRCDIR/libpng
+       
+       if [ -f $PREFIX/include/libandroid-support/time.h ]; then
+           mv $PREFIX/include/libandroid-support/time.h $PREFIX/include/libandroid-support/time.h_
+       fi
+       # Patch needed to libandroid's time.h? ghostscript/src/base/stat_.h includes stat_.h which includes time.h which creates a loop.
+       # See http://stackoverflow.com/questions/14947691/c-system-file-bits-stat-h-suddenly-breaks-with-error-field-st-atim-has-inc
+}
 
-       local _ARCHFILE=$TERMUX_PKG_BUILDER_DIR/arch-arm.h
-       $TERMUX_TOUCH -d "next hour" $_ARCHFILE
-       perl -p -i -e "s|TARGET_ARCH_FILE=.*|TARGET_ARCH_FILE=$_ARCHFILE|" $TERMUX_PKG_SRCDIR/Makefile.in
+termux_step_post_make_install () {
+        if [ -f $PREFIX/include/libandroid-support/time.h_ ]; then
+            mv $PREFIX/include/libandroid-support/time.h_ $PREFIX/include/libandroid-support/time.h
+        fi
 }
diff --git a/disabled-packages/ghostscript/configure.patch b/disabled-packages/ghostscript/configure.patch
new file mode 100644 (file)
index 0000000..b45b48c
--- /dev/null
@@ -0,0 +1,11 @@
+--- ./configure        2017-03-16 10:12:59.000000000 +0000
++++ ./configure        2017-03-18 15:14:30.363309054 +0000
+@@ -3772,7 +3772,7 @@
+   echo $AUXFLAGS_MAK_LINE06 >> $AUXFLAGS_MAK.in
+   echo $AUXFLAGS_MAK_LINE07 >> $AUXFLAGS_MAK.in
+-  ../$0 CC="$CCAUX" CFLAGS="$CFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host= --build= --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-fapi --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-luratech --without-jbig2dec --without-x --with-drivers=""
++  $0 CC="$CCAUX" CFLAGS="$CFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host= --build= --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-fapi --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-luratech --without-jbig2dec --without-x --with-drivers=""
+   status=$?
+   cp config.log ../configaux.log
+   if test $status -eq 0 ; then
diff --git a/disabled-packages/ghostscript/gserrors.h.patch b/disabled-packages/ghostscript/gserrors.h.patch
new file mode 100644 (file)
index 0000000..78d5ae9
--- /dev/null
@@ -0,0 +1,18 @@
+--- ./base/gserrors.h  2017-03-16 09:20:11.000000000 +0000
++++ ./base/gserrors.h  2017-03-18 21:02:46.586737629 +0000
+@@ -148,14 +148,13 @@
+  *
+  */
+-#ifndef __printflike
++/* Redefine cdefs.h's __printflike function: */
+ #if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+ #define __printflike(fmtarg, firstvararg) \
+     __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+ #else
+ #define __printflike(fmtarg, firstvararg)
+ #endif
+-#endif
+ const char *gs_errstr(int code);