about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/mkgmap
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-03-24 11:04:41 +0100
committerAlyssa Ross <hi@alyssa.is>2024-03-24 11:04:41 +0100
commit5423cabbbf2b6dec5568f1ecabd288d5d9a642ec (patch)
treef316a6a921bfefd3a63bd4502c2eb50ff1644f67 /nixpkgs/pkgs/applications/misc/mkgmap
parent46a88117a05c3469af5d99433af140c3de8ca088 (diff)
parent8aa81f34981add12aecada6c702ddbbd0375ca36 (diff)
downloadnixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.gz
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.bz2
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.lz
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.xz
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.zst
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/mkgmap')
-rw-r--r--nixpkgs/pkgs/applications/misc/mkgmap/build.xml.patch19
-rw-r--r--nixpkgs/pkgs/applications/misc/mkgmap/default.nix64
-rw-r--r--nixpkgs/pkgs/applications/misc/mkgmap/ignore-impure-test.patch20
-rw-r--r--nixpkgs/pkgs/applications/misc/mkgmap/splitter/build.xml.patch18
-rw-r--r--nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix51
5 files changed, 100 insertions, 72 deletions
diff --git a/nixpkgs/pkgs/applications/misc/mkgmap/build.xml.patch b/nixpkgs/pkgs/applications/misc/mkgmap/build.xml.patch
index 2aced4452062..567c0d5586f8 100644
--- a/nixpkgs/pkgs/applications/misc/mkgmap/build.xml.patch
+++ b/nixpkgs/pkgs/applications/misc/mkgmap/build.xml.patch
@@ -1,14 +1,6 @@
 --- a/build.xml	(revision 4555)
 +++ a/build.xml	(working copy)
-@@ -222,13 +222,13 @@
- 		<property name="svn.version.build" value="none"/>
- 
- 		<propertyfile file="${build.classes}/mkgmap-version.properties">
--			<entry key="svn.version" value="${svn.version.build}" />
--			<entry key="build.timestamp" value="${build.timestamp}" />
-+			<entry key="svn.version" value="@version@" />
-+			<entry key="build.timestamp" value="unknown" />
- 		</propertyfile>
+@@ -228,7 +228,7 @@
  	</target>
  
  	<!-- Compile the product itself (no tests). -->
@@ -35,12 +27,3 @@
  		<mkdir dir="tmp/report"/>
  		<junit printsummary="yes" failureproperty="junit.failure" forkmode="once">
  
-@@ -351,7 +351,7 @@
- 			ignoreerrors="true"/>
- 	</target>
- 
--	<target name="dist" depends="build, check-version, version-file"
-+	<target name="dist" depends="build, version-file"
- 					description="Make the distribution area">
- 
- 		<mkdir dir="${dist}"/>
diff --git a/nixpkgs/pkgs/applications/misc/mkgmap/default.nix b/nixpkgs/pkgs/applications/misc/mkgmap/default.nix
index 5648e34d8461..7f97818c7452 100644
--- a/nixpkgs/pkgs/applications/misc/mkgmap/default.nix
+++ b/nixpkgs/pkgs/applications/misc/mkgmap/default.nix
@@ -1,11 +1,12 @@
-{ lib, stdenv
+{ lib
+, stdenv
 , fetchurl
 , fetchsvn
-, substituteAll
 , jdk
 , jre
 , ant
 , makeWrapper
+, stripJavaArchivesHook
 , doCheck ? true
 , withExamples ? false
 }:
@@ -15,23 +16,29 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "mkgmap";
-  version = "4917";
+  version = "4918";
 
   src = fetchsvn {
     url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
     rev = version;
-    sha256 = "sha256-7VCEbsvcT7iaJ3MZz4CthJEE9FSJCowAO7PJ9UqmzPA=";
+    sha256 = "sha256-oQ/2KY6xA/kwAroHiPqcIJlcPsTTeStUu8WN/95ZUTw=";
   };
 
   patches = [
-    (substituteAll {
-      # Disable automatic download of dependencies
-      src = ./build.xml.patch;
-      inherit version;
-    })
+    # Disable automatic download of dependencies
+    ./build.xml.patch
+    ./ignore-impure-test.patch
   ];
 
   postPatch = with deps; ''
+    # Manually create version properties file for reproducibility
+    mkdir -p build/classes
+    cat > build/classes/mkgmap-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}
@@ -51,38 +58,53 @@ 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 test";
+  checkPhase = ''
+    runHook preCheck
+    ant test
+    runHook postCheck
+  '';
 
   installPhase = ''
+    runHook preInstall
+
     install -Dm644 dist/mkgmap.jar -t $out/share/java/mkgmap
     install -Dm644 dist/doc/mkgmap.1 -t $out/share/man/man1
     cp -r dist/lib/ $out/share/java/mkgmap/
     makeWrapper ${jre}/bin/java $out/bin/mkgmap \
       --add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
-  '' + lib.optionalString withExamples ''
-    mkdir -p $out/share/mkgmap
-    cp -r dist/examples $out/share/mkgmap/
+
+    ${lib.optionalString withExamples ''
+      mkdir -p $out/share/mkgmap
+      cp -r dist/examples $out/share/mkgmap/
+    ''}
+
+    runHook postInstall
   '';
 
   passthru.updateScript = [ ./update.sh "mkgmap" meta.downloadPage ];
 
   meta = with lib; {
     description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
-    homepage = "https://www.mkgmap.org.uk/";
     downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html";
-    sourceProvenance = with sourceTypes; [
-      fromSource
-      binaryBytecode  # deps
-    ];
+    homepage = "https://www.mkgmap.org.uk/";
     license = licenses.gpl2Only;
+    mainProgram = "mkgmap";
     maintainers = with maintainers; [ sikmir ];
     platforms = platforms.all;
-    mainProgram = "mkgmap";
+    sourceProvenance = with sourceTypes; [
+      fromSource
+      binaryBytecode # deps
+    ];
   };
+
 }
diff --git a/nixpkgs/pkgs/applications/misc/mkgmap/ignore-impure-test.patch b/nixpkgs/pkgs/applications/misc/mkgmap/ignore-impure-test.patch
new file mode 100644
index 000000000000..1ed2f7092f08
--- /dev/null
+++ b/nixpkgs/pkgs/applications/misc/mkgmap/ignore-impure-test.patch
@@ -0,0 +1,20 @@
+diff --git a/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java b/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java
+index e1e4ac7..954b918 100644
+--- a/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java
++++ b/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java
+@@ -17,6 +17,7 @@ import java.text.Collator;
+ import uk.me.parabola.mkgmap.srt.SrtTextReader;
+ 
+ import org.junit.Before;
++import org.junit.Ignore;
+ import org.junit.Test;
+ 
+ import static org.junit.Assert.*;
+@@ -111,6 +112,7 @@ public class SrtCollatorTest {
+ 	 * meant to be identical to the java one.
+ 	 */
+ 	@Test
++	@Ignore
+ 	public void testJavaRules() {
+ 		Collator collator = Collator.getInstance();
+ 
diff --git a/nixpkgs/pkgs/applications/misc/mkgmap/splitter/build.xml.patch b/nixpkgs/pkgs/applications/misc/mkgmap/splitter/build.xml.patch
index a028dbef0314..1fb0a14ef4c3 100644
--- a/nixpkgs/pkgs/applications/misc/mkgmap/splitter/build.xml.patch
+++ b/nixpkgs/pkgs/applications/misc/mkgmap/splitter/build.xml.patch
@@ -1,13 +1,6 @@
 --- a/build.xml	(revision 597)
 +++ a/build.xml	(working copy)
-@@ -207,12 +207,12 @@
- 		<property name="svn.version.build" value="unknown"/>
- 
- 		<propertyfile file="${build.classes}/splitter-version.properties">
--			<entry key="svn.version" value="${svn.version.build}" />
--			<entry key="build.timestamp" value="${build.timestamp}" />
-+			<entry key="svn.version" value="@version@" />
-+			<entry key="build.timestamp" value="unknown" />
+@@ -212,7 +212,7 @@
  		</propertyfile>
  	</target>
  
@@ -25,15 +18,6 @@
      <javac srcdir="${test}" destdir="${build.test-classes}" debug="yes" includeantruntime="false">
        <include name="**/*.java"/>
        <classpath refid="test.classpath"/>
-@@ -261,7 +261,7 @@
- 	  <fail if="junit.failure" message="Test failed.  See test-reports/index.html"/>
- 	</target>
- 
--  <target name="dist" depends="build, check-version, version-file" description="Make the distribution area">
-+  <target name="dist" depends="build, version-file" description="Make the distribution area">
- 
-     <mkdir dir="${dist}"/>
-     <mkdir dir="${dist}/doc/api"/>
 @@ -324,7 +324,7 @@
  	</target>
  
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
+    ];
   };
 }