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

86 lines
2.2 KiB
Nix
Raw Normal View History

{ lib, stdenv
2020-07-08 01:09:57 +02:00
, fetchurl
, fetchsvn
, jdk
, jre
, ant
, makeWrapper
, doCheck ? true
, withExamples ? false
}:
2019-08-27 13:30:06 +02:00
let
2020-07-08 01:09:57 +02:00
version = "4565";
sha256 = "0cfh0msky5812l28mavy6p3k2zgyxb698xk79mvla9l45zcicnvw";
2019-08-27 13:30:06 +02:00
2020-07-08 01:09:57 +02:00
deps = import ./deps.nix { inherit fetchurl; };
testInputs = import ./testinputs.nix { inherit fetchurl; };
in
stdenv.mkDerivation {
2019-08-27 13:30:06 +02:00
pname = "mkgmap";
2020-07-08 01:09:57 +02:00
inherit version;
2019-08-27 13:30:06 +02:00
src = fetchsvn {
2020-07-08 01:09:57 +02:00
inherit sha256;
2019-08-27 13:30:06 +02:00
url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
rev = version;
};
2020-07-08 01:09:57 +02:00
patches = [
# Disable automatic download of dependencies
./build.xml.patch
2019-08-27 13:30:06 +02:00
2020-07-08 01:09:57 +02:00
# Fix testJavaRules test
./fix-failing-test.patch
];
postPatch = with deps; ''
substituteInPlace build.xml \
--subst-var-by version ${version}
2019-08-27 13:30:06 +02:00
mkdir -p lib/compile
2020-07-08 01:09:57 +02:00
cp ${fastutil} lib/compile/${fastutil.name}
cp ${osmpbf} lib/compile/${osmpbf.name}
cp ${protobuf} lib/compile/${protobuf.name}
'' + stdenv.lib.optionalString doCheck ''
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
${stdenv.lib.concatMapStringsSep "\n" (res: ''
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
'') testInputs}
2019-08-27 13:30:06 +02:00
'';
2020-07-08 01:09:57 +02:00
nativeBuildInputs = [ jdk ant makeWrapper ];
2019-08-27 13:30:06 +02:00
buildPhase = "ant";
2020-07-08 01:09:57 +02:00
inherit doCheck;
checkPhase = "ant test";
2019-08-27 13:30:06 +02:00
installPhase = ''
2020-07-08 01:09:57 +02:00
install -Dm644 dist/mkgmap.jar $out/share/java/mkgmap/mkgmap.jar
install -Dm644 dist/doc/mkgmap.1 $out/share/man/man1/mkgmap.1
cp -r dist/lib/ $out/share/java/mkgmap/
2019-08-27 13:30:06 +02:00
makeWrapper ${jre}/bin/java $out/bin/mkgmap \
--add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
2020-07-08 01:09:57 +02:00
'' + stdenv.lib.optionalString withExamples ''
mkdir -p $out/share/mkgmap
cp -r dist/examples $out/share/mkgmap/
2019-08-27 13:30:06 +02:00
'';
meta = with lib; {
2019-08-27 13:30:06 +02:00
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
homepage = "http://www.mkgmap.org.uk";
2020-07-08 01:09:57 +02:00
license = licenses.gpl2Only;
2019-08-27 13:30:06 +02:00
maintainers = with maintainers; [ sikmir ];
platforms = platforms.all;
};
}