nixpkgs/pkgs/applications/misc/mkgmap/splitter/default.nix

78 lines
2.1 KiB
Nix
Raw Normal View History

{ 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-02-05 06:25:39 +00:00
version = "598";
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";
2021-02-05 06:25:39 +00:00
sha256 = "gpbJpDBXA9tmSmx9oKLa7xWtIOHBTYd1iPPgNTC2C2M=";
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 ];
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;
};
}