about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix51
1 files changed, 35 insertions, 16 deletions
diff --git a/nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix b/nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix
index d9b886cbe2b3..801af789d47d 100644
--- a/nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix
+++ b/nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix
@@ -1,11 +1,12 @@
-{ lib, stdenv
+{ lib
+, stdenv
 , fetchurl
 , fetchsvn
-, substituteAll
 , jdk
 , jre
 , ant
 , makeWrapper
+, stripJavaArchivesHook
 , doCheck ? true
 }:
 let
@@ -23,17 +24,21 @@ stdenv.mkDerivation rec {
   };
 
   patches = [
-    (substituteAll {
-      # Disable automatic download of dependencies
-      src = ./build.xml.patch;
-      inherit version;
-    })
-
+    # Disable automatic download of dependencies
+    ./build.xml.patch
     # Fix func.SolverAndProblemGeneratorTest test
     ./fix-failing-test.patch
   ];
 
   postPatch = with deps; ''
+    # Manually create version properties file for reproducibility
+    mkdir -p build/classes
+    cat > build/classes/splitter-version.properties << EOF
+      svn.version=${version}
+      build.timestamp=unknown
+    EOF
+
+    # Put pre-fetched dependencies into the right place
     mkdir -p lib/compile
     cp ${fastutil} lib/compile/${fastutil.name}
     cp ${osmpbf} lib/compile/${osmpbf.name}
@@ -50,34 +55,48 @@ stdenv.mkDerivation rec {
     '') testInputs}
   '';
 
-  nativeBuildInputs = [ jdk ant makeWrapper ];
+  nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ];
 
-  buildPhase = "ant";
+  buildPhase = ''
+    runHook preBuild
+    ant
+    runHook postBuild
+  '';
 
   inherit doCheck;
 
-  checkPhase = "ant run.tests && ant run.func-tests";
+  checkPhase = ''
+    runHook preCheck
+    ant run.tests
+    ant run.func-tests
+    runHook postCheck
+  '';
 
   installPhase = ''
+    runHook preInstall
+
     install -Dm644 dist/splitter.jar -t $out/share/java/splitter
     install -Dm644 doc/splitter.1 -t $out/share/man/man1
     cp -r dist/lib/ $out/share/java/splitter/
     makeWrapper ${jre}/bin/java $out/bin/splitter \
       --add-flags "-jar $out/share/java/splitter/splitter.jar"
+
+    runHook postInstall
   '';
 
   passthru.updateScript = [ ../update.sh "mkgmap-splitter" meta.downloadPage ];
 
   meta = with lib; {
     description = "Utility for splitting OpenStreetMap maps into tiles";
-    homepage = "https://www.mkgmap.org.uk/";
     downloadPage = "https://www.mkgmap.org.uk/download/splitter.html";
-    sourceProvenance = with sourceTypes; [
-      fromSource
-      binaryBytecode  # deps
-    ];
+    homepage = "https://www.mkgmap.org.uk/";
     license = licenses.gpl2Only;
+    mainProgram = "splitter";
     maintainers = with maintainers; [ sikmir ];
     platforms = platforms.all;
+    sourceProvenance = with sourceTypes; [
+      fromSource
+      binaryBytecode # deps
+    ];
   };
 }