2024-04-21 15:54:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-11 12:50:04 +00:00
|
|
|
, fetchurl
|
2022-06-16 17:23:12 +00:00
|
|
|
, fetchsvn
|
2020-10-11 12:50:04 +00:00
|
|
|
, jdk
|
|
|
|
, jre
|
|
|
|
, ant
|
|
|
|
, makeWrapper
|
2024-04-21 15:54:59 +00:00
|
|
|
, stripJavaArchivesHook
|
2020-10-11 12:50:04 +00:00
|
|
|
, doCheck ? true
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
deps = import ../deps.nix { inherit fetchurl; };
|
|
|
|
testInputs = import ./testinputs.nix { inherit fetchurl; };
|
|
|
|
in
|
2021-02-05 17:12:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-10-11 12:50:04 +00:00
|
|
|
pname = "splitter";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "654";
|
2020-10-11 12:50:04 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
src = fetchsvn {
|
|
|
|
url = "https://svn.mkgmap.org.uk/mkgmap/splitter/trunk";
|
|
|
|
rev = version;
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-y/pl8kIQ6fiF541ho72LMgJFWJdkUBqPToQGCGmmcfg=";
|
2020-10-11 12:50:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2024-04-21 15:54:59 +00:00
|
|
|
# Disable automatic download of dependencies
|
|
|
|
./build.xml.patch
|
2020-10-11 12:50:04 +00:00
|
|
|
# Fix func.SolverAndProblemGeneratorTest test
|
|
|
|
./fix-failing-test.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = with deps; ''
|
2024-04-21 15:54:59 +00:00
|
|
|
# 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
|
2020-10-11 12:50:04 +00:00
|
|
|
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 22:18:51 +00:00
|
|
|
'' + lib.optionalString doCheck ''
|
2020-10-11 12:50:04 +00: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 22:18:51 +00:00
|
|
|
${lib.concatMapStringsSep "\n" (res: ''
|
2020-10-11 12:50:04 +00:00
|
|
|
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
|
|
|
|
'') testInputs}
|
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ];
|
2020-10-11 12:50:04 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
ant
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
ant run.tests
|
|
|
|
ant run.func-tests
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2024-04-21 15:54:59 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
install -Dm644 dist/splitter.jar -t $out/share/java/splitter
|
|
|
|
install -Dm644 doc/splitter.1 -t $out/share/man/man1
|
2020-10-11 12:50:04 +00: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"
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-10-11 12:50:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
passthru.updateScript = [ ../update.sh "mkgmap-splitter" meta.downloadPage ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-11 12:50:04 +00:00
|
|
|
description = "Utility for splitting OpenStreetMap maps into tiles";
|
2021-08-05 21:33:18 +00:00
|
|
|
downloadPage = "https://www.mkgmap.org.uk/download/splitter.html";
|
2024-04-21 15:54:59 +00:00
|
|
|
homepage = "https://www.mkgmap.org.uk/";
|
2020-10-11 12:50:04 +00:00
|
|
|
license = licenses.gpl2Only;
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "splitter";
|
2020-10-11 12:50:04 +00:00
|
|
|
maintainers = with maintainers; [ sikmir ];
|
|
|
|
platforms = platforms.all;
|
2024-04-21 15:54:59 +00:00
|
|
|
sourceProvenance = with sourceTypes; [
|
|
|
|
fromSource
|
|
|
|
binaryBytecode # deps
|
|
|
|
];
|
2020-10-11 12:50:04 +00:00
|
|
|
};
|
|
|
|
}
|