package.nix (1564B)
1 { 2 lib, 3 stdenv, 4 perlPackages, 5 shortenPerlShebang, 6 fetchFromGitHub, 7 }: 8 9 perlPackages.buildPerlPackage { 10 pname = "osm2mp"; 11 version = "0-unstable-2018-08-31"; 12 13 src = fetchFromGitHub { 14 owner = "liosha"; 15 repo = "osm2mp"; 16 rev = "748f93792ead174ad0e94a183a173ef3fcacf200"; 17 hash = "sha256-YxtEOuoLeglpdpmStrcEkXwRGHRE+N1hKDB2Rr8rokw="; 18 }; 19 20 outputs = [ "out" ]; 21 22 nativeBuildInputs = lib.optional stdenv.isDarwin shortenPerlShebang; 23 24 propagatedBuildInputs = with perlPackages; [ 25 ConfigStd 26 EncodeLocale 27 FileSlurp 28 GeoOpenstreetmapParser 29 JSON 30 ListMoreUtils 31 LWPProtocolHttps 32 MatchSimple 33 MathPolygon 34 MathPolygonTree 35 TemplateToolkit 36 TextUnidecode 37 TreeR 38 YAML 39 ]; 40 41 postPatch = '' 42 substituteInPlace osm2mp.pl \ 43 --replace-fail "\$Bin/cfg" "$out/share/osm2mp/cfg" 44 ''; 45 46 preConfigure = "touch Makefile.PL"; 47 48 installPhase = 49 '' 50 install -Dm755 osm2mp.pl $out/bin/osm2mp 51 install -dm755 $out/share/osm2mp/cfg 52 cp -r cfg/* $out/share/osm2mp/cfg 53 install -dm755 $out/lib/perl5/site_perl 54 cp -r lib/* $out/lib/perl5/site_perl 55 '' 56 + lib.optionalString stdenv.isLinux '' 57 patchShebangs $out/bin/osm2mp 58 '' 59 + lib.optionalString stdenv.isDarwin '' 60 shortenPerlShebang $out/bin/osm2mp 61 ''; 62 63 meta = { 64 description = "Convert Openstreetmap data to MP format"; 65 homepage = "https://github.com/liosha/osm2mp"; 66 license = lib.licenses.gpl2; 67 maintainers = [ lib.maintainers.sikmir ]; 68 mainProgram = "osm2mp"; 69 }; 70 }