2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2020-07-08 00:13:53 +01:00
|
|
|
, fetchurl
|
2021-01-29 17:22:25 +00:00
|
|
|
, substituteAll
|
2020-07-08 00:13:53 +01:00
|
|
|
, jdk
|
|
|
|
, jre
|
|
|
|
, ant
|
|
|
|
, makeWrapper
|
|
|
|
, doCheck ? true
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
deps = import ../deps.nix { inherit fetchurl; };
|
|
|
|
testInputs = import ./testinputs.nix { inherit fetchurl; };
|
|
|
|
in
|
2021-01-29 17:22:25 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-07-08 00:13:53 +01:00
|
|
|
pname = "splitter";
|
2021-01-29 17:22:25 +00:00
|
|
|
version = "597";
|
2020-07-08 00:13:53 +01:00
|
|
|
|
2021-01-29 17:22:25 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.mkgmap.org.uk/download/splitter-r${version}-src.tar.gz";
|
|
|
|
sha256 = "0d928wvlpzqwdpfksmxyyfkqrhjsij21wx2538bs2i29siwyla61";
|
2020-07-08 00:13:53 +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:13:53 +01:00
|
|
|
|
|
|
|
# Fix func.SolverAndProblemGeneratorTest test
|
|
|
|
./fix-failing-test.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = with deps; ''
|
|
|
|
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}
|
2021-01-15 05:42:41 +00:00
|
|
|
'' + lib.optionalString doCheck ''
|
2020-07-08 00:13:53 +01:00
|
|
|
mkdir -p lib/test
|
|
|
|
cp ${junit} lib/test/${junit.name}
|
|
|
|
cp ${hamcrest-core} lib/test/${hamcrest-core.name}
|
|
|
|
|
|
|
|
mkdir -p test/resources/in/osm
|
2021-01-15 05:42:41 +00:00
|
|
|
${lib.concatMapStringsSep "\n" (res: ''
|
2020-07-08 00:13:53 +01:00
|
|
|
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
|
|
|
|
'') testInputs}
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ jdk ant makeWrapper ];
|
|
|
|
|
|
|
|
buildPhase = "ant";
|
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
|
|
|
|
checkPhase = "ant run.tests && ant run.func-tests";
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-01-29 17:22:25 +00:00
|
|
|
install -Dm644 dist/splitter.jar -t $out/share/java/splitter
|
|
|
|
install -Dm644 doc/splitter.1 -t $out/share/man/man1
|
2020-07-08 00:13:53 +01:00
|
|
|
cp -r dist/lib/ $out/share/java/splitter/
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/splitter \
|
|
|
|
--add-flags "-jar $out/share/java/splitter/splitter.jar"
|
|
|
|
'';
|
|
|
|
|
2021-01-29 17:22:25 +00:00
|
|
|
passthru.updateScript = [ ../update.sh "mkgmap-splitter" meta.downloadPage ];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-07-08 00:13:53 +01:00
|
|
|
description = "Utility for splitting OpenStreetMap maps into tiles";
|
|
|
|
homepage = "http://www.mkgmap.org.uk";
|
2021-01-29 17:22:25 +00:00
|
|
|
downloadPage = "http://www.mkgmap.org.uk/download/splitter.html";
|
2020-07-08 00:13:53 +01:00
|
|
|
license = licenses.gpl2Only;
|
|
|
|
maintainers = with maintainers; [ sikmir ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|