nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 123 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchsvn, 6 jdk, 7 jre, 8 ant, 9 makeWrapper, 10 stripJavaArchivesHook, 11 doCheck ? true, 12 withExamples ? false, 13}: 14let 15 deps = import ./deps.nix { inherit fetchurl; }; 16 testInputs = import ./testinputs.nix { inherit fetchurl; }; 17in 18stdenv.mkDerivation rec { 19 pname = "mkgmap"; 20 version = "4923"; 21 22 src = fetchsvn { 23 url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk"; 24 rev = version; 25 sha256 = "sha256-tB/0VFLn/ch7XWPz1sJ3kqy/1U5Hk1yV9+wq7ohTRWw="; 26 }; 27 28 patches = [ 29 # Disable automatic download of dependencies 30 ./build.xml.patch 31 ./ignore-impure-test.patch 32 ]; 33 34 postPatch = 35 with deps; 36 '' 37 # Manually create version properties file for reproducibility 38 mkdir -p build/classes 39 cat > build/classes/mkgmap-version.properties << EOF 40 svn.version=${version} 41 build.timestamp=unknown 42 EOF 43 44 # Put pre-fetched dependencies into the right place 45 mkdir -p lib/compile 46 cp ${fastutil} lib/compile/${fastutil.name} 47 cp ${osmpbf} lib/compile/${osmpbf.name} 48 cp ${protobuf} lib/compile/${protobuf.name} 49 '' 50 + lib.optionalString doCheck '' 51 mkdir -p lib/test 52 cp ${fastutil} lib/test/${fastutil.name} 53 cp ${osmpbf} lib/test/${osmpbf.name} 54 cp ${protobuf} lib/test/${protobuf.name} 55 cp ${jaxb-api} lib/test/${jaxb-api.name} 56 cp ${junit} lib/test/${junit.name} 57 cp ${hamcrest-core} lib/test/${hamcrest-core.name} 58 59 mkdir -p test/resources/in/img 60 ${lib.concatMapStringsSep "\n" (res: '' 61 cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name} 62 '') testInputs} 63 ''; 64 65 nativeBuildInputs = [ 66 jdk 67 ant 68 makeWrapper 69 stripJavaArchivesHook 70 ]; 71 72 buildPhase = '' 73 runHook preBuild 74 ant 75 runHook postBuild 76 ''; 77 78 inherit doCheck; 79 80 checkPhase = '' 81 runHook preCheck 82 ant test 83 runHook postCheck 84 ''; 85 86 installPhase = '' 87 runHook preInstall 88 89 install -Dm644 dist/mkgmap.jar -t $out/share/java/mkgmap 90 install -Dm644 dist/doc/mkgmap.1 -t $out/share/man/man1 91 cp -r dist/lib/ $out/share/java/mkgmap/ 92 makeWrapper ${jre}/bin/java $out/bin/mkgmap \ 93 --add-flags "-jar $out/share/java/mkgmap/mkgmap.jar" 94 95 ${lib.optionalString withExamples '' 96 mkdir -p $out/share/mkgmap 97 cp -r dist/examples $out/share/mkgmap/ 98 ''} 99 100 runHook postInstall 101 ''; 102 103 passthru.updateScript = [ 104 ./update.sh 105 "mkgmap" 106 meta.downloadPage 107 ]; 108 109 meta = with lib; { 110 description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data"; 111 downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html"; 112 homepage = "https://www.mkgmap.org.uk/"; 113 license = licenses.gpl2Only; 114 mainProgram = "mkgmap"; 115 maintainers = with maintainers; [ sikmir ]; 116 platforms = platforms.all; 117 sourceProvenance = with sourceTypes; [ 118 fromSource 119 binaryBytecode # deps 120 ]; 121 }; 122 123}