Skip to content

Instantly share code, notes, and snippets.

@jpmckinney
Created February 15, 2012 23:34
Show Gist options
  • Save jpmckinney/1840053 to your computer and use it in GitHub Desktop.
Save jpmckinney/1840053 to your computer and use it in GitHub Desktop.
An incomplete patch to Pdftk to compile using javac, javah and jar instead of GCJ binaries.
diff --git a/java/Makefile b/java/Makefile
index a4e8ba6..bf627ef 100644
--- a/java/Makefile
+++ b/java/Makefile
@@ -27,8 +27,8 @@ else
endif
#
-export GCJFLAGS+= --encoding=UTF-8 --classpath="$(LIBGCJ):$(JAVALIBPATH):."
-export GCJHFLAGS+= --classpath="$(LIBGCJ):$(JAVALIBPATH):."
+export GCJFLAGS+= -encoding UTF-8 -classpath "$(LIBGCJ):$(JAVALIBPATH):."
+export GCJHFLAGS+= -classpath "$(LIBGCJ):$(JAVALIBPATH):."
sources= $(wildcard com/lowagie/text/*.java)
sources+= $(wildcard com/lowagie/text/markup/*.java)
@@ -62,15 +62,15 @@ endif
.PRECIOUS : %.class
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
%.h : %.class
- $(GCJH) $(GCJHFLAGS) $*
+ $(GCJH) $(GCJHFLAGS) `echo $* | awk '{gsub("/", "."); print}'`
# don't create class list from java filenames because it omits local classes
java_lib.o : $(headers) $(sources)
$(GJAR) -cf java_lib.jar com/lowagie/*/*/*/*.class com/lowagie/*/*/*.class com/lowagie/*/*.class org/bouncycastle/*/*.class org/bouncycastle/*/*/*.class $(afms)
- $(GCJ) $(GCJFLAGS) -c java_lib.jar
+ $(GCJ) $(GCJFLAGS) -c java_lib.jar # @todo this is a problem
ifdef GCJ_LOCAL_LIB
$(GCJ_LOCAL_LIB) : $(libgcj_local_classes)
diff --git a/java/com/lowagie/text/Makefile b/java/com/lowagie/text/Makefile
index 05e2ed4..05d7339 100644
--- a/java/com/lowagie/text/Makefile
+++ b/java/com/lowagie/text/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/com/lowagie/text/markup/Makefile b/java/com/lowagie/text/markup/Makefile
index a54fe98..c37c34c 100644
--- a/java/com/lowagie/text/markup/Makefile
+++ b/java/com/lowagie/text/markup/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/com/lowagie/text/pdf/Makefile b/java/com/lowagie/text/pdf/Makefile
index f3708b9..c18d8da 100644
--- a/java/com/lowagie/text/pdf/Makefile
+++ b/java/com/lowagie/text/pdf/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/com/lowagie/text/pdf/fonts/Makefile b/java/com/lowagie/text/pdf/fonts/Makefile
index da0b49d..07c5b64 100644
--- a/java/com/lowagie/text/pdf/fonts/Makefile
+++ b/java/com/lowagie/text/pdf/fonts/Makefile
@@ -23,7 +23,7 @@ afm_objects= $(patsubst %.afm, %.o, $(afms))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# the --resource argument gives the name by which this resource is
# referenced; I took this prefix from RESOURCE_PATH in BaseFont.java
@@ -34,7 +34,7 @@ afm_objects= $(patsubst %.afm, %.o, $(afms))
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/com/lowagie/text/xml/xmp/Makefile b/java/com/lowagie/text/xml/xmp/Makefile
index 8357caf..fa2cfd4 100644
--- a/java/com/lowagie/text/xml/xmp/Makefile
+++ b/java/com/lowagie/text/xml/xmp/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/gnu_local/java/security/Makefile b/java/gnu_local/java/security/Makefile
index c288450..4d9aeec 100644
--- a/java/gnu_local/java/security/Makefile
+++ b/java/gnu_local/java/security/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/gnu_local/java/security/provider/Makefile b/java/gnu_local/java/security/provider/Makefile
index 11b2daf..edbcc7d 100644
--- a/java/gnu_local/java/security/provider/Makefile
+++ b/java/gnu_local/java/security/provider/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/java_local/security/Makefile b/java/java_local/security/Makefile
index c288450..4d9aeec 100644
--- a/java/java_local/security/Makefile
+++ b/java/java_local/security/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/org/bouncycastle/asn1/Makefile b/java/org/bouncycastle/asn1/Makefile
index 7e15cd7..b804b78 100644
--- a/java/org/bouncycastle/asn1/Makefile
+++ b/java/org/bouncycastle/asn1/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/org/bouncycastle/util/Makefile b/java/org/bouncycastle/util/Makefile
index 7e15cd7..b804b78 100644
--- a/java/org/bouncycastle/util/Makefile
+++ b/java/org/bouncycastle/util/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/org/bouncycastle/util/encoders/Makefile b/java/org/bouncycastle/util/encoders/Makefile
index 7e15cd7..b804b78 100644
--- a/java/org/bouncycastle/util/encoders/Makefile
+++ b/java/org/bouncycastle/util/encoders/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/java/org/bouncycastle/util/io/Makefile b/java/org/bouncycastle/util/io/Makefile
index 7e15cd7..b804b78 100644
--- a/java/org/bouncycastle/util/io/Makefile
+++ b/java/org/bouncycastle/util/io/Makefile
@@ -19,13 +19,13 @@ classes= $(patsubst %.java, %.class, $(sources))
$(GCJ) $(GCJFLAGS) -c $< -o $@
%.class : %.java
- $(GCJ) $(GCJFLAGS) -C $<
+ $(GCJ) $(GCJFLAGS) $<
# gcjh doesn't want the ".class" extension, so use
# the "$*" automatic variable, here
#
%.h : %.class
- $(GCJH) --classpath="." $*;
+ $(GCJH) -classpath="." `echo $* | awk '{gsub("/", "."); print}'`;
$(RM) $<
##
diff --git a/libgcj-4.4.3.jar b/libgcj-4.4.3.jar
new file mode 100644
index 0000000..7bd52c2
Binary files /dev/null and b/libgcj-4.4.3.jar differ
diff --git a/libgcj.11.dylib b/libgcj.11.dylib
new file mode 100755
index 0000000..5aa216c
Binary files /dev/null and b/libgcj.11.dylib differ
diff --git a/pdftk/Makefile.OSX-10.6 b/pdftk/Makefile.OSX-10.6
index 0532c58..7cc87e2 100644
--- a/pdftk/Makefile.OSX-10.6
+++ b/pdftk/Makefile.OSX-10.6
@@ -28,13 +28,13 @@
# tools
# need direct path to libgcj for gcjh (starting in gcj 4.1.2 per Aurélien GÉRÔME)
-TOOLPATH=/sw/lib/gcc4.5/bin/
-export VERSUFF=-fsf-4.5
+TOOLPATH=/usr/bin/
+export VERSUFF=-4.2
export CXX= $(TOOLPATH)g++$(VERSUFF)
-export GCJ= $(TOOLPATH)gcj$(VERSUFF)
-export GCJH= $(TOOLPATH)gcjh$(VERSUFF)
-export GJAR= $(TOOLPATH)gjar$(VERSUFF)
-export LIBGCJ= /sw/lib/gcc4.5/share/java/libgcj-4.5.0.jar
+export GCJ= javac
+export GCJH= javah
+export GJAR= jar
+export LIBGCJ= ../libgcj-4.4.3.jar
export AR= ar
export RM= rm
export ARFLAGS= rs
@@ -74,8 +74,8 @@ export RMFLAGS= -vf
export MACOSX_DEPLOYMENT_TARGET= 10.4
export CPPFLAGS= -DPATH_DELIM=0x2f -DASK_ABOUT_WARNINGS=false -DUNBLOCK_SIGNALS -fdollars-in-identifiers -mmacosx-version-min=10.4
export CXXFLAGS= -Wall -Wextra -Weffc++ -O2
-export GCJFLAGS= -Wall -fsource=1.3 -O2
+export GCJFLAGS= -Xlint -source 1.3
export GCJHFLAGS= -force
-export LDLIBS= /sw/lib/gcc4.5/lib/libgcj.dylib /sw/lib/gcc4.5/lib/libstdc++.dylib /sw/lib/gcc4.5/lib/libgcc_s.1.dylib -liconv -lz
+export LDLIBS= /opt/pdflabs/pdftk/lib/libgcj.11.dylib /usr/lib/libstdc++.6.0.9.dylib /usr/lib/libgcc_s.10.5.dylib -liconv -lz
include Makefile.Base
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment