mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 06:03:40 +00:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
86 lines
2.2 KiB
Nix
86 lines
2.2 KiB
Nix
{ lib, stdenv
|
|
, fetchurl
|
|
, fetchsvn
|
|
, jdk
|
|
, jre
|
|
, ant
|
|
, makeWrapper
|
|
, doCheck ? true
|
|
, withExamples ? false
|
|
}:
|
|
let
|
|
version = "4565";
|
|
sha256 = "0cfh0msky5812l28mavy6p3k2zgyxb698xk79mvla9l45zcicnvw";
|
|
|
|
deps = import ./deps.nix { inherit fetchurl; };
|
|
testInputs = import ./testinputs.nix { inherit fetchurl; };
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "mkgmap";
|
|
inherit version;
|
|
|
|
src = fetchsvn {
|
|
inherit sha256;
|
|
url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
|
|
rev = version;
|
|
};
|
|
|
|
patches = [
|
|
# Disable automatic download of dependencies
|
|
./build.xml.patch
|
|
|
|
# Fix testJavaRules test
|
|
./fix-failing-test.patch
|
|
];
|
|
|
|
postPatch = with deps; ''
|
|
substituteInPlace build.xml \
|
|
--subst-var-by version ${version}
|
|
|
|
mkdir -p lib/compile
|
|
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}
|
|
'';
|
|
|
|
nativeBuildInputs = [ jdk ant makeWrapper ];
|
|
|
|
buildPhase = "ant";
|
|
|
|
inherit doCheck;
|
|
|
|
checkPhase = "ant test";
|
|
|
|
installPhase = ''
|
|
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/
|
|
makeWrapper ${jre}/bin/java $out/bin/mkgmap \
|
|
--add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
|
|
'' + stdenv.lib.optionalString withExamples ''
|
|
mkdir -p $out/share/mkgmap
|
|
cp -r dist/examples $out/share/mkgmap/
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
|
|
homepage = "http://www.mkgmap.org.uk";
|
|
license = licenses.gpl2Only;
|
|
maintainers = with maintainers; [ sikmir ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|