Update pdftk and fix its build

This commit is contained in:
Michael Raskin 2014-11-16 02:16:01 +04:00
parent 05d4db4c71
commit 1a69d88174
3 changed files with 20 additions and 235 deletions

View file

@ -1,32 +1,40 @@
{ fetchurl, stdenv, gcj }:
{ fetchurl, stdenv, gcj, unzip }:
stdenv.mkDerivation {
name = "pdftk-1.41";
name = "pdftk-2.02";
src = fetchurl {
url = http://www.pdfhacks.com/pdftk/pdftk-1.41.tar.bz2;
sha256 = "1vdrc3179slix6lz3gdiy53z7sh2yf9026r3xi6wdarwrcpawfrf";
url = "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip";
sha256 = "1hdq6zm2dx2f9h7bjrp6a1hfa1ywgkwydp14i2sszjiszljnm3qi";
};
patches = [ ./gcc-4.3.patch ./gcc-4.4.patch ];
buildInputs = [ gcj unzip ];
buildInputs = [ gcj ];
preBuild = ''
cd pdftk
sed -e 's@/usr/bin/@@g' -i Makefile.*
NIX_ENFORCE_PURITY= \
make \
LIBGCJ="${gcj.gcc}/share/java/libgcj-${gcj.gcc.version}.jar" \
GCJ=gcj GCJH=gcjh GJAR=gjar \
-iC ../java all
'';
makeFlags = [ "-f" "Makefile.Generic" ];
preBuild = "cd pdftk";
# Makefile.Debian has almost fitting defaults
makeFlags = [ "-f" "Makefile.Debian" "VERSUFF=" ];
installPhase = ''
mkdir -p $out/bin $out/share/man/man1
cp pdftk $out/bin
cp ../debian/pdftk.1 $out/share/man/man1
cp ../pdftk.1 $out/share/man/man1
'';
meta = {
description = "Simple tool for doing everyday things with PDF documents";
homepage = http://www.accesspdf.com/pdftk/;
homepage = "https://www.pdflabs.com/tools/pdftk-server/";
license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [viric];
maintainers = with stdenv.lib.maintainers; [viric raskin];
platforms = with stdenv.lib.platforms; linux;
};
}

View file

@ -1,205 +0,0 @@
Taken from gentoo portage.
# posted to bug #251796 by <andrex@mail.ee> from Debian patches
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/bc/asn1/Makefile pdftk-1.41/java_libs/com/lowagie/bc/asn1/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/bc/asn1/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/bc/asn1/Makefile 2008-12-23 00:04:52.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/Makefile pdftk-1.41/java_libs/com/lowagie/text/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/Makefile 2008-12-22 23:58:52.000000000 +0200
@@ -25,13 +25,12 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
-all : $(library) $(headers)
+all : $(library) $(headers) $(classes)
$(library) : $(objects)
$(AR) $(ARFLAGS) $(library) $(objects);
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/markup/Makefile pdftk-1.41/java_libs/com/lowagie/text/markup/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/markup/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/markup/Makefile 2008-12-23 00:04:28.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/codec/Makefile pdftk-1.41/java_libs/com/lowagie/text/pdf/codec/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/codec/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/codec/Makefile 2008-12-23 00:04:11.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/codec/postscript/Makefile pdftk-1.41/java_libs/com/lowagie/text/pdf/codec/postscript/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/codec/postscript/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/codec/postscript/Makefile 2008-12-23 00:03:05.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/codec/wmf/Makefile pdftk-1.41/java_libs/com/lowagie/text/pdf/codec/wmf/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/codec/wmf/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/codec/wmf/Makefile 2008-12-23 00:03:29.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/fonts/Makefile pdftk-1.41/java_libs/com/lowagie/text/pdf/fonts/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/fonts/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/fonts/Makefile 2008-12-23 00:01:33.000000000 +0200
@@ -34,8 +34,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/Makefile pdftk-1.41/java_libs/com/lowagie/text/pdf/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/Makefile 2008-12-23 00:00:25.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/PdfEncryption.java pdftk-1.41/java_libs/com/lowagie/text/pdf/PdfEncryption.java
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/PdfEncryption.java 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/PdfEncryption.java 2008-12-22 23:46:21.000000000 +0200
@@ -50,7 +50,7 @@
package com.lowagie.text.pdf;
-import java_local.security.MessageDigest; // ssteward
+import java.security.MessageDigest;
import com.lowagie.text.ExceptionConverter;
/**
diff -u -r pdftk-1.41.orig/java_libs/com/lowagie/text/xml/xmp/Makefile pdftk-1.41/java_libs/com/lowagie/text/xml/xmp/Makefile
--- pdftk-1.41.orig/java_libs/com/lowagie/text/xml/xmp/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/com/lowagie/text/xml/xmp/Makefile 2008-12-22 23:59:42.000000000 +0200
@@ -25,8 +25,7 @@
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
- $(RM) $<
+ $(GCJH) --classpath="$(java_libs_root):." $*;
##
# targets
diff -u -r pdftk-1.41.orig/java_libs/Makefile pdftk-1.41/java_libs/Makefile
--- pdftk-1.41.orig/java_libs/Makefile 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/java_libs/Makefile 2008-12-22 23:47:10.000000000 +0200
@@ -13,13 +13,7 @@
# append gcj flags
export GCJFLAGS+= --encoding=UTF-8 --classpath="$(java_libs_root)"
-all : libgcj_local itext
-
-libgcj_local :
- $(MAKE) -C "$(java_libs_root)/gnu_local/java/security";
- $(MAKE) -C "$(java_libs_root)/gnu_local/java/security/provider";
- $(MAKE) -C "$(java_libs_root)/gnu/gcj/convert";
- $(MAKE) -C "$(java_libs_root)/java_local/security";
+all : itext
itext :
$(MAKE) -C "$(java_libs_root)/com/lowagie/text";
@@ -35,13 +29,7 @@
$(MAKE) -C "$(java_libs_root)/com/lowagie/bc/asn1";
$(MAKE) -C "$(java_libs_root)/com/lowagie/text/pdf/codec/postscript";
-clean : libgcj_local_clean itext_clean
-
-libgcj_local_clean :
- $(MAKE) -iC "$(java_libs_root)/gnu_local/java/security" clean;
- $(MAKE) -iC "$(java_libs_root)/gnu_local/java/security/provider" clean;
- $(MAKE) -iC "$(java_libs_root)/gnu/gcj/convert" clean;
- $(MAKE) -iC "$(java_libs_root)/java_local/security" clean;
+clean : itext_clean
itext_clean :
$(MAKE) -iC "$(java_libs_root)/com/lowagie/text" clean;
diff -u -r pdftk-1.41.orig/pdftk/Makefile.Base pdftk-1.41/pdftk/Makefile.Base
--- pdftk-1.41.orig/pdftk/Makefile.Base 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/pdftk/Makefile.Base 2008-12-22 23:44:33.000000000 +0200
@@ -31,18 +31,6 @@
afms= $(wildcard $(java_libs_root)/com/lowagie/text/pdf/fonts/*.afm)
afm_objects= $(patsubst %.afm, %.o, $(afms))
-# older versions of libgcj might not have the MD5 algorithm,
-# so I added it here; these *_local java files were grabbed from
-# libgcj CVS on March 7, 2004; diffed September 5, 2006 w/ gcc 4.1.1
-#
-# gnu/gcj/convert/Input_UnicodeBig.java was grabbed March 26, 2004; diffed September 5, 2006 w/ gcc 4.1.1
-#
-libgcj_local_libs = \
-$(java_libs_root)/java_local/security/security.a \
-$(java_libs_root)/gnu_local/java/security/provider/provider.a \
-$(java_libs_root)/gnu_local/java/security/security.a \
-$(java_libs_root)/gnu/gcj/convert/convert.a
-
# this must already be set according to your platform Makefile;
# we're just appending to it, here
#
diff -u -r pdftk-1.41.orig/pdftk/Makefile.Generic pdftk-1.41/pdftk/Makefile.Generic
--- pdftk-1.41.orig/pdftk/Makefile.Generic 2008-12-22 23:43:29.000000000 +0200
+++ pdftk-1.41/pdftk/Makefile.Generic 2008-12-23 00:06:24.000000000 +0200
@@ -28,7 +28,7 @@
# itext compiler flags
# -O3 might cause pdftk to segfault on cat operation (gcc 3.4.4)
-export GCJFLAGS= -O2
+export GCJFLAGS= -O2 -w
#
export ARFLAGS= rs

View file

@ -1,18 +0,0 @@
Taken from gentoo portage.
diff -NrU5 pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/PdfDate.java pdftk-1.41/java_libs/com/lowagie/text/pdf/PdfDate.java
--- pdftk-1.41.orig/java_libs/com/lowagie/text/pdf/PdfDate.java 2009-05-18 20:49:13.000000000 -0600
+++ pdftk-1.41/java_libs/com/lowagie/text/pdf/PdfDate.java 2009-05-18 20:51:36.000000000 -0600
@@ -74,11 +74,11 @@
public class PdfDate extends PdfString {
// ssteward; static builds of pdftk (Windows, gcc 3.3.1) would
// omit this class because of its reference by reflection;
// this treatment ensures that ld will include it
- private static Class c1= gnu.java.locale.Calendar.class;
+ private static Class c1= java.util.Calendar.class;
private static final int dateSpace[] = {Calendar.YEAR, 4, 0, Calendar.MONTH, 2, -1, Calendar.DAY_OF_MONTH, 2, 0,
Calendar.HOUR_OF_DAY, 2, 0, Calendar.MINUTE, 2, 0, Calendar.SECOND, 2, 0};
// constructors