From ae4de1d70bacf5157985ef6a85e0a5bdf0d2a8eb Mon Sep 17 00:00:00 2001 From: Grimler91 Date: Tue, 21 Mar 2017 23:33:23 +0100 Subject: [PATCH] ghostscript: Update to 9.21 and patch to make it build. (#867) 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!" --- .../ghostscript/Makefile.in.patch | 30 -------------- disabled-packages/ghostscript/build.sh | 41 ++++++++++++++----- disabled-packages/ghostscript/configure.patch | 11 +++++ .../ghostscript/gserrors.h.patch | 18 ++++++++ 4 files changed, 59 insertions(+), 41 deletions(-) delete mode 100644 disabled-packages/ghostscript/Makefile.in.patch create mode 100644 disabled-packages/ghostscript/configure.patch create mode 100644 disabled-packages/ghostscript/gserrors.h.patch diff --git a/disabled-packages/ghostscript/Makefile.in.patch b/disabled-packages/ghostscript/Makefile.in.patch deleted file mode 100644 index 653f7c07e..000000000 --- a/disabled-packages/ghostscript/Makefile.in.patch +++ /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_) diff --git a/disabled-packages/ghostscript/build.sh b/disabled-packages/ghostscript/build.sh index 7e2d7cfc7..080f41f29 100644 --- a/disabled-packages/ghostscript/build.sh +++ b/disabled-packages/ghostscript/build.sh @@ -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 index 000000000..b45b48c82 --- /dev/null +++ b/disabled-packages/ghostscript/configure.patch @@ -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 index 000000000..78d5ae938 --- /dev/null +++ b/disabled-packages/ghostscript/gserrors.h.patch @@ -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); +