mkgmap, mkgmap-splitter: migrate to by-name, modernize (#485710)

This commit is contained in:
Gergő Gutyina
2026-02-10 20:58:24 +00:00
committed by GitHub
13 changed files with 174 additions and 170 deletions
@@ -1,68 +0,0 @@
{ fetchurl }:
let
fetchTestInput =
{ res, sha256 }:
fetchurl {
inherit sha256;
url = "https://www.mkgmap.org.uk/testinput/${res}";
name = builtins.replaceStrings [ "/" ] [ "__" ] res;
};
in
[
(fetchTestInput {
res = "osm/lon1.osm.gz";
sha256 = "1r8sl67hayjgybxy9crqwp7f1w0ljxvxh0apqcvr888yhsbb8drv";
})
(fetchTestInput {
res = "osm/uk-test-1.osm.gz";
sha256 = "0jdngkjn22jvi8q7hrzpqb9mnjlz82h1dwdmc4qrb64kkhzm4dfk";
})
(fetchTestInput {
res = "osm/uk-test-2.osm.gz";
sha256 = "05mw0qcdgki151ldmxayry0gqlb72jm5wrvxq3dkwq5i7jb21qs4";
})
(fetchTestInput {
res = "osm/is-in-samples.osm";
sha256 = "18vqfbq25ys59bj6dl6dq3q4m2ri3ki2xazim14fm94k1pbyhbh3";
})
(fetchTestInput {
res = "mp/test1.mp";
sha256 = "1dykr0z84c3fqgm9kdp2dzvxc3galjbx0dn9zxjw8cfk7mvnspj2";
})
(fetchTestInput {
res = "img/63240001.img";
sha256 = "1wmqgy940q1svazw85z8di20xyjm3vpaiaj9hizr47b549klw74q";
})
(fetchTestInput {
res = "img/63240002.img";
sha256 = "12ivywkiw6lrglyk0clnx5ff2wqj4z0c3f5yqjsqlsaawbmxqa1f";
})
(fetchTestInput {
res = "img/63240003.img";
sha256 = "19mgxqv6kqk8ahs8s819sj7cc79id67373ckwfsq7vvqyfrbasz1";
})
(fetchTestInput {
res = "hgt/N00W090.hgt.zip";
sha256 = "16hb06bgf47sz2mfbbx3xqmrh1nmm04wj4ngm512sng4rjhksxgn";
})
(fetchTestInput {
res = "hgt/N00W091.hgt.zip";
sha256 = "153j4wj7170qj81nr7sr6dp9zar62gnrkh6ww62bygpfqqyzdr1x";
})
(fetchTestInput {
res = "hgt/S01W090.hgt.zip";
sha256 = "0czgs9rhp7bnzmzm7907vprj3nhm2lj6q1piafk8dm9rcqkfg8sj";
})
(fetchTestInput {
res = "hgt/S01W091.hgt.zip";
sha256 = "0z58q3ai499mflxfjqhqv9i1di3fmp05pkv39886k1na107g3wbn";
})
(fetchTestInput {
res = "hgt/S02W090.hgt.zip";
sha256 = "0q7817gdxk2vq73ci6ffks288zqywc21f5ns73b6p5ds2lrxhf5n";
})
(fetchTestInput {
res = "hgt/S02W091.hgt.zip";
sha256 = "1mwpgd85v9n99gmx2bn8md7d312wvhq86w3c9k92y8ayrs20lmdr";
})
]
@@ -1,5 +1,5 @@
--- a/build.xml (revision 597)
+++ a/build.xml (working copy)
--- a/build.xml 2026-02-10 03:53:33.129313250 +0200
+++ b/build.xml 2026-02-10 03:53:36.908100965 +0200
@@ -212,7 +212,7 @@
</propertyfile>
</target>
@@ -9,7 +9,7 @@
<javac srcdir="${src}" destdir="${build.classes}" debug="yes" includeantruntime="false">
<include name="**/*.java"/>
<classpath refid="classpath"/>
@@ -219,7 +219,7 @@
@@ -222,7 +222,7 @@
</javac>
</target>
@@ -18,7 +18,7 @@
<javac srcdir="${test}" destdir="${build.test-classes}" debug="yes" includeantruntime="false">
<include name="**/*.java"/>
<classpath refid="test.classpath"/>
@@ -324,7 +324,7 @@
@@ -330,7 +330,7 @@
</target>
<!-- Main -->
@@ -27,7 +27,7 @@
<copy todir="${build.classes}">
<fileset dir="${resources}">
<include name="*.properties"/>
@@ -349,7 +349,7 @@
@@ -355,7 +355,7 @@
ignoreerrors="true"/>
</target>
@@ -7,21 +7,23 @@
jre,
ant,
makeWrapper,
mkgmap,
stripJavaArchivesHook,
doCheck ? true,
}:
let
deps = import ../deps.nix { inherit fetchurl; };
inherit (mkgmap) deps;
testInputs = import ./testinputs.nix { inherit fetchurl; };
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "splitter";
version = "654";
src = fetchsvn {
url = "https://svn.mkgmap.org.uk/mkgmap/splitter/trunk";
rev = version;
sha256 = "sha256-y/pl8kIQ6fiF541ho72LMgJFWJdkUBqPToQGCGmmcfg=";
rev = finalAttrs.version;
hash = "sha256-y/pl8kIQ6fiF541ho72LMgJFWJdkUBqPToQGCGmmcfg=";
};
patches = [
@@ -31,33 +33,31 @@ stdenv.mkDerivation rec {
./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
postPatch = ''
# Manually create version properties file for reproducibility
mkdir -p build/classes
cat > build/classes/splitter-version.properties << EOF
svn.version=${finalAttrs.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}
cp ${protobuf} lib/compile/${protobuf.name}
cp ${xpp3} lib/compile/${xpp3.name}
''
+ lib.optionalString doCheck ''
mkdir -p lib/test
cp ${junit} lib/test/${junit.name}
cp ${hamcrest-core} lib/test/${hamcrest-core.name}
# Put pre-fetched dependencies into the right place
mkdir -p lib/compile
cp ${deps.fastutil} lib/compile/${deps.fastutil.name}
cp ${deps.osmpbf} lib/compile/${deps.osmpbf.name}
cp ${deps.protobuf} lib/compile/${deps.protobuf.name}
cp ${deps.xpp3} lib/compile/${deps.xpp3.name}
''
+ lib.optionalString doCheck ''
mkdir -p lib/test
cp ${deps.junit} lib/test/${deps.junit.name}
cp ${deps.hamcrest-core} lib/test/${deps.hamcrest-core.name}
mkdir -p test/resources/in/osm
${lib.concatMapStringsSep "\n" (res: ''
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
'') testInputs}
'';
mkdir -p test/resources/in/osm
${lib.concatMapStringsSep "\n" (res: ''
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
'') testInputs}
'';
nativeBuildInputs = [
jdk
@@ -94,9 +94,9 @@ stdenv.mkDerivation rec {
'';
passthru.updateScript = [
../update.sh
./update.sh
"mkgmap-splitter"
meta.downloadPage
finalAttrs.meta.downloadPage
];
meta = {
@@ -112,4 +112,4 @@ stdenv.mkDerivation rec {
binaryBytecode # deps
];
};
}
})
@@ -1,9 +1,9 @@
{ fetchurl }:
let
fetchTestInput =
{ res, sha256 }:
{ res, hash }:
fetchurl {
inherit sha256;
inherit hash;
url = "https://www.mkgmap.org.uk/testinput/${res}";
name = builtins.replaceStrings [ "/" ] [ "__" ] res;
};
@@ -11,10 +11,10 @@ in
[
(fetchTestInput {
res = "osm/alaska-2016-12-27.osm.pbf";
sha256 = "0hmb5v71a1bxgvrg1cbfj5l27b3vvdazs4pyggpmhcdhbwpw7ppm";
hash = "sha256-9d7DL1+wMVjve/4S/VXbe6wjaJFusfDyfn0FFc4uq0I=";
})
(fetchTestInput {
res = "osm/hamburg-2016-12-26.osm.pbf";
sha256 = "08bny4aavwm3z2114q99fv3fi2w905zxi0fl7bqgjyhgk0fxjssf";
hash = "sha256-TmvZHZgPevnwOtSB2H8BiYvoxnYpYRKC+KPyrRTxdiE=";
})
]
@@ -1,29 +1,29 @@
--- a/build.xml (revision 4555)
+++ a/build.xml (working copy)
@@ -228,7 +228,7 @@
--- a/build.xml
+++ b/build.xml
@@ -228,8 +228,7 @@
</target>
<!-- Compile the product itself (no tests). -->
- <target name="compile" depends="prepare, resolve-compile"
+ <target name="compile" depends="prepare"
description="main compilation">
- description="main compilation">
+ <target name="compile" depends="prepare" description="main compilation">
<javac srcdir="${src}" destdir="${build.classes}" encoding="utf-8" debug="true" includeantruntime="false">
@@ -263,7 +263,7 @@
<include name="**/*.java" />
@@ -264,7 +263,7 @@
</target>
<!-- Compile the test classes -->
- <target name="build-test" depends="build, resolve-test">
+ <target name="build-test" depends="build">
<mkdir dir="${build.test}" />
<javac srcdir="${test}" destdir="${build.test}" encoding="utf-8" debug="true" includeantruntime="false">
<include name="**/*.java" />
@@ -271,7 +271,7 @@
@@ -275,7 +274,7 @@
</javac>
</target>
- <target name="test" depends="build-test, obtain-test-input-files" description="Run the junit tests">
+ <target name="test" depends="build-test" description="Run the junit tests">
<mkdir dir="tmp/report"/>
<junit printsummary="yes" failureproperty="junit.failure" forkmode="once">
@@ -2,30 +2,30 @@
{
fastutil = fetchurl {
url = "http://ivy.mkgmap.org.uk/repo/it.unimi.dsi/fastutil/6.5.15-mkg.1b/jars/fastutil.jar";
sha256 = "0d88m0rpi69wgxhnj5zh924q4zsvxq8m4ybk7m9mr3gz1hx0yx8c";
hash = "sha256-DHUPOgz/jVxTPXN5UhHuW3+CiUjwF2lhfzyZeDOoCDU=";
};
osmpbf = fetchurl {
url = "http://ivy.mkgmap.org.uk/repo/crosby/osmpbf/1.3.3/jars/osmpbf.jar";
sha256 = "0zb4pqkwly5z30ww66qhhasdhdrzwmrw00347yrbgyk2ii4wjad3";
hash = "sha256-oynJSYxi+reyP2QAwHPlPzfYtIIQG8M5GL94yie+ZH0=";
};
protobuf = fetchurl {
url = "mirror://maven/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar";
sha256 = "0x6c4pbsizvk3lm6nxcgi1g2iqgrxcna1ip74lbn01f0fm2wdhg0";
hash = "sha256-4MHGRXXABWAXJefGoCzr+eEoXoiPdWsqHXP/qNclzHQ=";
};
xpp3 = fetchurl {
url = "mirror://maven/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar";
sha256 = "1f9ifnxxj295xb1494jycbfm76476xm5l52p7608gf0v91d3jh83";
hash = "sha256-A0E5WkgbuIeAOVcUWmo3h5hT3WJekkTC6iUJ2bt1Mbk=";
};
jaxb-api = fetchurl {
url = "mirror://maven/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar";
sha256 = "00rxpc0m30d3jc572ni01ryxq8gcbnr955xsabrijg9pknc0fc48";
hash = "sha256-iDAHmJ03PRnzUrqXkrJd7CHcfQ4gWnEKk6OBUQG7PQM=";
};
junit = fetchurl {
url = "mirror://maven/junit/junit/4.11/junit-4.11.jar";
sha256 = "1zh6klzv8w30dx7jg6pkhllk4587av4znflzhxz8x97c7rhf3a4h";
hash = "sha256-kKjhYD7spI5+h586+8lWBxUyKYXzmidPb2BwtD+dBv4=";
};
hamcrest-core = fetchurl {
url = "mirror://maven/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar";
sha256 = "1sfqqi8p5957hs9yik44an3lwpv8ln2a6sh9gbgli4vkx68yzzb6";
hash = "sha256-Zv3vkelzk0jfeglqo4SlaF9Oh1WEzOiThqekclHE2Ok=";
};
}
@@ -11,18 +11,19 @@
doCheck ? true,
withExamples ? false,
}:
let
deps = import ./deps.nix { inherit fetchurl; };
testInputs = import ./testinputs.nix { inherit fetchurl; };
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "mkgmap";
version = "4924";
src = fetchsvn {
url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
rev = version;
sha256 = "sha256-4DGGAWgyIvK5pcopwlO4YDGDc73lOsL0Ljy/kFUY2As=";
rev = finalAttrs.version;
hash = "sha256-4DGGAWgyIvK5pcopwlO4YDGDc73lOsL0Ljy/kFUY2As=";
};
patches = [
@@ -31,36 +32,34 @@ stdenv.mkDerivation rec {
./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
postPatch = ''
# Manually create version properties file for reproducibility
mkdir -p build/classes
cat > build/classes/mkgmap-version.properties << EOF
svn.version=${finalAttrs.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}
cp ${protobuf} lib/compile/${protobuf.name}
''
+ lib.optionalString doCheck ''
mkdir -p lib/test
cp ${fastutil} lib/test/${fastutil.name}
cp ${osmpbf} lib/test/${osmpbf.name}
cp ${protobuf} lib/test/${protobuf.name}
cp ${jaxb-api} lib/test/${jaxb-api.name}
cp ${junit} lib/test/${junit.name}
cp ${hamcrest-core} lib/test/${hamcrest-core.name}
# Put pre-fetched dependencies into the right place
mkdir -p lib/compile
cp ${deps.fastutil} lib/compile/${deps.fastutil.name}
cp ${deps.osmpbf} lib/compile/${deps.osmpbf.name}
cp ${deps.protobuf} lib/compile/${deps.protobuf.name}
''
+ lib.optionalString doCheck ''
mkdir -p lib/test
cp ${deps.fastutil} lib/test/${deps.fastutil.name}
cp ${deps.osmpbf} lib/test/${deps.osmpbf.name}
cp ${deps.protobuf} lib/test/${deps.protobuf.name}
cp ${deps.jaxb-api} lib/test/${deps.jaxb-api.name}
cp ${deps.junit} lib/test/${deps.junit.name}
cp ${deps.hamcrest-core} lib/test/${deps.hamcrest-core.name}
mkdir -p test/resources/in/img
${lib.concatMapStringsSep "\n" (res: ''
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
'') testInputs}
'';
mkdir -p test/resources/in/img
${lib.concatMapStringsSep "\n" (res: ''
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
'') testInputs}
'';
nativeBuildInputs = [
jdk
@@ -100,11 +99,14 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
passthru.updateScript = [
./update.sh
"mkgmap"
meta.downloadPage
];
passthru = {
inherit deps;
updateScript = [
./update.sh
"mkgmap"
finalAttrs.meta.downloadPage
];
};
meta = {
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
@@ -119,5 +121,4 @@ stdenv.mkDerivation rec {
binaryBytecode # deps
];
};
}
})
+68
View File
@@ -0,0 +1,68 @@
{ fetchurl }:
let
fetchTestInput =
{ res, hash }:
fetchurl {
inherit hash;
url = "https://www.mkgmap.org.uk/testinput/${res}";
name = builtins.replaceStrings [ "/" ] [ "__" ] res;
};
in
[
(fetchTestInput {
res = "osm/lon1.osm.gz";
hash = "sha256-Oze0loYeIZQ3w1cB2HeXFPDgzuU4s+T78k96BY+hGuU=";
})
(fetchTestInput {
res = "osm/uk-test-1.osm.gz";
hash = "sha256-0zVSP5yTmJUxYbXxFqBAn0pb08L3Z3gwilsKYeV8tkk=";
})
(fetchTestInput {
res = "osm/uk-test-2.osm.gz";
hash = "sha256-ROMgljyxYD7bwH1nXqoUZ1H8gM9e9dpoKCHO1xgGvBY=";
})
(fetchTestInput {
res = "osm/is-in-samples.osm";
hash = "sha256-Ay7o1w2TpOpIqPGrLuIcMYtK8MDN0GbkSkX7IvByeKM=";
})
(fetchTestInput {
res = "mp/test1.mp";
hash = "sha256-Ql5tdz3TMcRl/8k20Jek6g3W92/itpnqw24wgj7I07c=";
})
(fetchTestInput {
res = "img/63240001.img";
hash = "sha256-mBxOZyJlHZJ/hEmqqO4eVfoORGzoF8S/2jpgQJJ/uPI=";
})
(fetchTestInput {
res = "img/63240002.img";
hash = "sha256-Lijc6+JKaYq1xL64wcAnEnPhXOmWMjA9fZkaHif3O4o=";
})
(fetchTestInput {
res = "img/63240003.img";
hash = "sha256-4Wu1svN474O145ONM45pMR3GjtQpII00VGjiaTbur6Y=";
})
(fetchTestInput {
res = "hgt/N00W090.hgt.zip";
hash = "sha256-9nU9oczkWS1Cqc8SyQmo1QaYK+6jr+Wq+PoQ95YBC5o=";
})
(fetchTestInput {
res = "hgt/N00W091.hgt.zip";
hash = "sha256-PeT2PcbuPr+E4dzAme0TJqufbjNZn2wDkhiccCQncpQ=";
})
(fetchTestInput {
res = "hgt/S01W090.hgt.zip";
hash = "sha256-UqPnJmY51YamU/EGbCQVFdoh890HpFN//XadC3PS7zM=";
})
(fetchTestInput {
res = "hgt/S01W091.hgt.zip";
hash = "sha256-dvHxDgjKhmkQSmPPW8CtbsQWYtoYYuk6dTUlEtXAqHw=";
})
(fetchTestInput {
res = "hgt/S02W090.hgt.zip";
hash = "sha256-tjjYMxW6lWvWONoWFwTjHn+EhJ7OmcjGwVvM3t4J6GA=";
})
(fetchTestInput {
res = "hgt/S02W091.hgt.zip";
hash = "sha256-uVUKhM5eIS/STGxwgzDcXITRTqvILtHrS8mmXVB7l9c=";
})
]
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts
set -euo pipefail
version=$(curl -s $2 | sed -n 's#.*<span data-bind="text: current().version">\(.*\)</span>.*#\1#p')
update-source-version $1 "$version"
-4
View File
@@ -3104,10 +3104,6 @@ with pkgs;
nvfetcher = haskell.lib.compose.justStaticExecutables haskellPackages.nvfetcher;
mkgmap = callPackage ../applications/misc/mkgmap { };
mkgmap-splitter = callPackage ../applications/misc/mkgmap/splitter { };
op-geth = callPackage ../applications/blockchains/optimism/geth.nix { };
optimism = callPackage ../applications/blockchains/optimism { };