Merge pull request #75534 from averelld/pdftk-new
pdftk: reinit at 3.0.8
This commit is contained in:
commit
9d165398dd
3 changed files with 122 additions and 26 deletions
|
@ -1,42 +1,95 @@
|
||||||
{ fetchurl, stdenv, gcj, unzip }:
|
{ stdenv, fetchFromGitLab, gradle_5, jre, perl, writeText, runtimeShell }:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
let
|
||||||
name = "pdftk-2.02";
|
pname = "pdftk";
|
||||||
|
version = "3.0.8";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchFromGitLab {
|
||||||
url = "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip";
|
owner = "pdftk-java";
|
||||||
sha256 = "1hdq6zm2dx2f9h7bjrp6a1hfa1ywgkwydp14i2sszjiszljnm3qi";
|
repo = "pdftk";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "1bj4a9g5mbxd859mmawzs0mpm0jw7ap4n1imcwkwz142r9x1g6rk";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ gcj unzip ];
|
deps = stdenv.mkDerivation {
|
||||||
|
pname = "${pname}-deps";
|
||||||
|
inherit src version;
|
||||||
|
|
||||||
hardeningDisable = [ "fortify" "format" ];
|
nativeBuildInputs = [ gradle_5 perl ];
|
||||||
|
|
||||||
preBuild = ''
|
buildPhase = ''
|
||||||
cd pdftk
|
export GRADLE_USER_HOME=$(mktemp -d)
|
||||||
sed -e 's@/usr/bin/@@g' -i Makefile.*
|
gradle -Dfile.encoding=utf-8 shadowJar;
|
||||||
NIX_ENFORCE_PURITY= \
|
|
||||||
make \
|
|
||||||
LIBGCJ="${gcj.cc}/share/java/libgcj-${gcj.cc.version}.jar" \
|
|
||||||
GCJ=gcj GCJH=gcjh GJAR=gjar \
|
|
||||||
-iC ../java all
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Makefile.Debian has almost fitting defaults
|
# Mavenize dependency paths
|
||||||
makeFlags = [ "-f" "Makefile.Debian" "VERSUFF=" ];
|
# e.g. org.codehaus.groovy/groovy/2.4.0/{hash}/groovy-2.4.0.jar -> org/codehaus/groovy/groovy/2.4.0/groovy-2.4.0.jar
|
||||||
|
installPhase = ''
|
||||||
|
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
||||||
|
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
||||||
|
| sh
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHash = "12b7lw1zpj69pv4bpbrm6pi0ip02ay3dfj3vcy2jyikfbwdb3qcz";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Point to our local deps repo
|
||||||
|
gradleInit = writeText "init.gradle" ''
|
||||||
|
logger.lifecycle 'Replacing Maven repositories with ${deps}...'
|
||||||
|
gradle.projectsLoaded {
|
||||||
|
rootProject.allprojects {
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
clear()
|
||||||
|
maven { url '${deps}' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
clear()
|
||||||
|
maven { url '${deps}' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsEvaluated { settings ->
|
||||||
|
settings.pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven { url '${deps}' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
in stdenv.mkDerivation rec {
|
||||||
|
inherit pname version src;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ gradle_5 ];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
export GRADLE_USER_HOME=$(mktemp -d)
|
||||||
|
gradle --offline --no-daemon --info --init-script ${gradleInit} shadowJar
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin $out/share/man/man1
|
mkdir -p $out/{bin,share/pdftk,share/man/man1}
|
||||||
cp pdftk $out/bin
|
cp build/libs/pdftk.jar $out/share/pdftk
|
||||||
cp ../pdftk.1 $out/share/man/man1
|
|
||||||
|
cat << EOF > $out/bin/pdftk
|
||||||
|
#!${runtimeShell}
|
||||||
|
exec ${jre}/bin/java -jar "$out/share/pdftk/pdftk.jar" "\$@"
|
||||||
|
EOF
|
||||||
|
chmod a+x "$out/bin/pdftk"
|
||||||
|
|
||||||
|
cp ${src}/pdftk.1 $out/share/man/man1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Simple tool for doing everyday things with PDF documents";
|
description = "Command-line tool for working with PDFs";
|
||||||
homepage = https://www.pdflabs.com/tools/pdftk-server/;
|
homepage = "https://gitlab.com/pdftk-java/pdftk";
|
||||||
license = stdenv.lib.licenses.gpl2;
|
license = stdenv.lib.licenses.gpl2;
|
||||||
maintainers = with stdenv.lib.maintainers; [raskin];
|
maintainers = with stdenv.lib.maintainers; [ raskin averelld ];
|
||||||
platforms = with stdenv.lib.platforms; linux;
|
platforms = stdenv.lib.platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
42
pkgs/tools/typesetting/pdftk/legacy.nix
Normal file
42
pkgs/tools/typesetting/pdftk/legacy.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{ fetchurl, stdenv, gcj, unzip }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "pdftk-2.02";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip";
|
||||||
|
sha256 = "1hdq6zm2dx2f9h7bjrp6a1hfa1ywgkwydp14i2sszjiszljnm3qi";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ gcj unzip ];
|
||||||
|
|
||||||
|
hardeningDisable = [ "fortify" "format" ];
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
cd pdftk
|
||||||
|
sed -e 's@/usr/bin/@@g' -i Makefile.*
|
||||||
|
NIX_ENFORCE_PURITY= \
|
||||||
|
make \
|
||||||
|
LIBGCJ="${gcj.cc}/share/java/libgcj-${gcj.cc.version}.jar" \
|
||||||
|
GCJ=gcj GCJH=gcjh GJAR=gjar \
|
||||||
|
-iC ../java all
|
||||||
|
'';
|
||||||
|
|
||||||
|
# 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 ../pdftk.1 $out/share/man/man1
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Simple tool for doing everyday things with PDF documents";
|
||||||
|
homepage = https://www.pdflabs.com/tools/pdftk-server/;
|
||||||
|
license = stdenv.lib.licenses.gpl2;
|
||||||
|
maintainers = with stdenv.lib.maintainers; [raskin];
|
||||||
|
platforms = with stdenv.lib.platforms; linux;
|
||||||
|
};
|
||||||
|
}
|
|
@ -20887,6 +20887,7 @@ in
|
||||||
|
|
||||||
pdfcpu = callPackage ../applications/graphics/pdfcpu { };
|
pdfcpu = callPackage ../applications/graphics/pdfcpu { };
|
||||||
pdftk = callPackage ../tools/typesetting/pdftk { };
|
pdftk = callPackage ../tools/typesetting/pdftk { };
|
||||||
|
pdftk-legacy = lowPrio (callPackage ../tools/typesetting/pdftk/legacy.nix { });
|
||||||
pdfgrep = callPackage ../tools/typesetting/pdfgrep { };
|
pdfgrep = callPackage ../tools/typesetting/pdfgrep { };
|
||||||
|
|
||||||
pdfpc = callPackage ../applications/misc/pdfpc {
|
pdfpc = callPackage ../applications/misc/pdfpc {
|
||||||
|
|
Loading…
Reference in a new issue