[buildout]
# Note: Locally provided gcc with gcj is used, as there is high unstability
# in how gcj is functional on many operating systems.
# Because of this the only way to have portable pdftk profile it is required
# to provide working gcj and then have it used for pdftk compilation.
extends =
  ../fastjar/buildout.cfg
  ../gcc/buildout.cfg

parts = pdftk

[pdftk-1.44-Makefile.Base.patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
md5sum = 04a3607213e4e638c1fd993321804499
filename = pdftk-1.44-Makefile.Base.patch

[pdftk-hooks-download]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
filename = pdftk-hooks.py
md5sum = d2a067b98953ad30ba1230f87dfb8b92
download-only = true

[pdftk]
recipe = hexagonit.recipe.cmmi
url = http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-1.44-src.zip
md5sum = 9eb50fffcd621a627d387750c60982b4
configure-command = true
patches =
  ${pdftk-1.44-Makefile.Base.patch:location}/${pdftk-1.44-Makefile.Base.patch:filename}
patch-options = -p1
# pdftk does not work correcly with parallel building
make-options =
  -j1
  -f Makefile.Redhat
  DEST=${buildout:parts-directory}/${:_buildout_section_name_}

pre-make-hook = ${pdftk-hooks-download:location}/${pdftk-hooks-download:filename}:pre_make_hook
environment =
  PATH=${gcc-java-minimal:location}/bin:${fastjar:location}/bin:%(PATH)s
  LDFLAGS=-L${gcc-java-minimal:location}/lib -Wl,-rpath=${gcc-java-minimal:location}/lib -L${gcc-java-minimal:location}/lib64 -Wl,-rpath=${gcc-java-minimal:location}/lib64
  LD_LIBRARY_PATH=${gcc-java-minimal:location}/lib:${gcc-java-minimal:location}/lib64