Skip to content

Instantly share code, notes, and snippets.

@sxua
Forked from Echos/pdftk.rb
Last active December 20, 2015 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sxua/6210636 to your computer and use it in GitHub Desktop.
Save sxua/6210636 to your computer and use it in GitHub Desktop.
--- pdftk/Makefile.OSX-10.6.orig 2013-07-24 21:27:36.000000000 +0300
+++ pdftk/Makefile.OSX-10.6 2013-08-12 19:44:24.000000000 +0300
@@ -20,13 +20,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=@HOMEBREW_PREFIX@/bin/
+export VERSUFF= -4.6
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 LIBGCJ= @PREFIX@/share/java/libgcj-@GCC_VERSION@.jar
export AR= ar
export RM= rm
export ARFLAGS= rs
@@ -63,11 +63,10 @@
# only effects libraries following option on the command line
#
#
-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 CPPFLAGS= -DPATH_DELIM=0x2f -DASK_ABOUT_WARNINGS=false -DUNBLOCK_SIGNALS -fdollars-in-identifiers
export CXXFLAGS= -Wall -Wextra -Weffc++ -O2
-export GCJFLAGS= -Wall -fsource=1.3 -O2
+export GCJFLAGS= -Wall -fno-assert -O2
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= @PREFIX@/gcc/lib/libgcj.dylib @PREFIX@/gcc/lib/libstdc++.dylib @PREFIX@/gcc/lib/libgcc_s.1.dylib -liconv -lz
include Makefile.Base
require 'formula'
class Pdftk < Formula
url 'http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip'
homepage 'http://www.pdflabs.com/'
sha1 'a4a27e984c5e1401cfa44b8e92a64113d7396a06'
depends_on 'ecj'
depends_on 'gcc46' => 'enable-java'
def patches
# make it compartible with modern OS X
"https://gist.github.com/sxua/6210636/raw/d1d1c00ae67365799ecc59009a38643d888f7bc2/patch-Makefile.OSX-10.6.diff"
end
def install
doc.mkpath
doc.install "changelog.html" "changelog.txt" "pdftk.1.html" "pdftk.1.txt"
man1.install "pdftk.1"
cd "pdftk" do
inreplace "Makefile.OSX-10.6" do |s|
s.gsub! "@HOMEBREW_PREFIX@", "#{HOMEBREW_PREFIX}"
s.gsub! "@PREFIX@", "#{Formula.factory('gcc46').prefix}"
s.gsub! "@GCC_VERSION", "#{Formula.factory('gcc46').version}"
s.remove_make_var! "VERSUFF"
end
system "make -f Makefile.OSX-10.6"
bin.install "pdftk"
end
end
end
@spl
Copy link

spl commented Jan 15, 2014

If you came here (as I did) looking for a fully working Homebrew formula for pdftk, I hope this tap will help. It's my first formula, so feedback is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment