2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2020-07-08 00:09:57 +01:00
|
|
|
, fetchurl
|
2021-01-29 17:22:25 +00:00
|
|
|
, substituteAll
|
2020-07-08 00:09:57 +01:00
|
|
|
, jdk
|
|
|
|
, jre
|
|
|
|
, ant
|
|
|
|
, makeWrapper
|
|
|
|
, doCheck ? true
|
|
|
|
, withExamples ? false
|
|
|
|
}:
|
2019-08-27 12:30:06 +01:00
|
|
|
let
|
2020-07-08 00:09:57 +01:00
|
|
|
deps = import ./deps.nix { inherit fetchurl; };
|
|
|
|
testInputs = import ./testinputs.nix { inherit fetchurl; };
|
|
|
|
in
|
2021-01-29 17:22:25 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-27 12:30:06 +01:00
|
|
|
pname = "mkgmap";
|
2021-10-13 03:47:41 +01:00
|
|
|
version = "4808";
|
2019-08-27 12:30:06 +01:00
|
|
|
|
2021-01-29 17:22:25 +00:00
|
|
|
src = fetchurl {
|
2021-07-31 18:01:50 +01:00
|
|
|
url = "https://www.mkgmap.org.uk/download/mkgmap-r${version}-src.tar.gz";
|
2021-10-13 03:47:41 +01:00
|
|
|
sha256 = "ooiXotpxdy99ViUQ0kFp0NoTowGEZjEoD31x+3XrW28=";
|
2019-08-27 12:30:06 +01:00
|
|
|
};
|
|
|
|
|
2020-07-08 00:09:57 +01:00
|
|
|
patches = [
|
2021-01-29 17:22:25 +00:00
|
|
|
(substituteAll {
|
|
|
|
# Disable automatic download of dependencies
|
|
|
|
src = ./build.xml.patch;
|
|
|
|
inherit version;
|
|
|
|
})
|
2020-07-08 00:09:57 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = with deps; ''
|
2019-08-27 12:30:06 +01:00
|
|
|
mkdir -p lib/compile
|
2020-07-08 00:09:57 +01:00
|
|
|
cp ${fastutil} lib/compile/${fastutil.name}
|
|
|
|
cp ${osmpbf} lib/compile/${osmpbf.name}
|
|
|
|
cp ${protobuf} lib/compile/${protobuf.name}
|
2021-01-15 05:42:41 +00:00
|
|
|
'' + lib.optionalString doCheck ''
|
2020-07-08 00:09:57 +01:00
|
|
|
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}
|
|
|
|
|
|
|
|
mkdir -p test/resources/in/img
|
2021-01-15 05:42:41 +00:00
|
|
|
${lib.concatMapStringsSep "\n" (res: ''
|
2020-07-08 00:09:57 +01:00
|
|
|
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
|
|
|
|
'') testInputs}
|
2019-08-27 12:30:06 +01:00
|
|
|
'';
|
|
|
|
|
2020-07-08 00:09:57 +01:00
|
|
|
nativeBuildInputs = [ jdk ant makeWrapper ];
|
|
|
|
|
2019-08-27 12:30:06 +01:00
|
|
|
buildPhase = "ant";
|
|
|
|
|
2020-07-08 00:09:57 +01:00
|
|
|
inherit doCheck;
|
|
|
|
|
|
|
|
checkPhase = "ant test";
|
|
|
|
|
2019-08-27 12:30:06 +01:00
|
|
|
installPhase = ''
|
2021-01-29 17:22:25 +00:00
|
|
|
install -Dm644 dist/mkgmap.jar -t $out/share/java/mkgmap
|
|
|
|
install -Dm644 dist/doc/mkgmap.1 -t $out/share/man/man1
|
2020-07-08 00:09:57 +01:00
|
|
|
cp -r dist/lib/ $out/share/java/mkgmap/
|
2019-08-27 12:30:06 +01:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/mkgmap \
|
|
|
|
--add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
|
2021-01-15 05:42:41 +00:00
|
|
|
'' + lib.optionalString withExamples ''
|
2020-07-08 00:09:57 +01:00
|
|
|
mkdir -p $out/share/mkgmap
|
|
|
|
cp -r dist/examples $out/share/mkgmap/
|
2019-08-27 12:30:06 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-29 17:22:25 +00:00
|
|
|
passthru.updateScript = [ ./update.sh "mkgmap" meta.downloadPage ];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-08-27 12:30:06 +01:00
|
|
|
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
|
|
|
|
homepage = "http://www.mkgmap.org.uk";
|
2021-07-31 18:01:50 +01:00
|
|
|
downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html";
|
2020-07-08 00:09:57 +01:00
|
|
|
license = licenses.gpl2Only;
|
2019-08-27 12:30:06 +01:00
|
|
|
maintainers = with maintainers; [ sikmir ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|