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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

111 lines
2.8 KiB
Nix
Raw Normal View History

{ lib
, stdenv
2020-07-07 23:09:57 +00:00
, fetchurl
2022-05-20 23:36:27 +00:00
, fetchsvn
2020-07-07 23:09:57 +00:00
, jdk
, jre
, ant
, makeWrapper
, stripJavaArchivesHook
2020-07-07 23:09:57 +00:00
, doCheck ? true
, withExamples ? false
}:
2019-08-27 11:30:06 +00:00
let
2020-07-07 23:09:57 +00: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 11:30:06 +00:00
pname = "mkgmap";
2024-06-16 20:38:54 +00:00
version = "4921";
2019-08-27 11:30:06 +00:00
2022-05-20 23:36:27 +00:00
src = fetchsvn {
url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
rev = version;
2024-06-16 20:38:54 +00:00
sha256 = "sha256-s7EKHXh3UNMDzBmWUTZaLR1P21e27cWJNYRlFcpJu50=";
2019-08-27 11:30:06 +00:00
};
2020-07-07 23:09:57 +00:00
patches = [
# Disable automatic download of dependencies
./build.xml.patch
./ignore-impure-test.patch
2020-07-07 23:09:57 +00:00
];
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
# Put pre-fetched dependencies into the right place
2019-08-27 11:30:06 +00:00
mkdir -p lib/compile
2020-07-07 23:09:57 +00: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-07 23:09:57 +00: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-07 23:09:57 +00:00
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
'') testInputs}
2019-08-27 11:30:06 +00:00
'';
nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ];
2020-07-07 23:09:57 +00:00
buildPhase = ''
runHook preBuild
ant
runHook postBuild
'';
2019-08-27 11:30:06 +00:00
2020-07-07 23:09:57 +00:00
inherit doCheck;
checkPhase = ''
runHook preCheck
ant test
runHook postCheck
'';
2020-07-07 23:09:57 +00:00
2019-08-27 11:30:06 +00:00
installPhase = ''
runHook preInstall
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-07 23:09:57 +00:00
cp -r dist/lib/ $out/share/java/mkgmap/
2019-08-27 11:30:06 +00:00
makeWrapper ${jre}/bin/java $out/bin/mkgmap \
--add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
${lib.optionalString withExamples ''
mkdir -p $out/share/mkgmap
cp -r dist/examples $out/share/mkgmap/
''}
runHook postInstall
2019-08-27 11:30:06 +00:00
'';
2021-01-29 17:22:25 +00:00
passthru.updateScript = [ ./update.sh "mkgmap" meta.downloadPage ];
meta = with lib; {
2019-08-27 11:30:06 +00:00
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html";
homepage = "https://www.mkgmap.org.uk/";
2020-07-07 23:09:57 +00:00
license = licenses.gpl2Only;
mainProgram = "mkgmap";
2019-08-27 11:30:06 +00:00
maintainers = with maintainers; [ sikmir ];
platforms = platforms.all;
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # deps
];
2019-08-27 11:30:06 +00:00
};
2019-08-27 11:30:06 +00:00
}