2.nix (2827B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 substituteAll, 6 copyDesktopItems, 7 desktopToDarwinBundle, 8 makeDesktopItem, 9 db, 10 fig2dev, 11 giflib, 12 gsettings-desktop-schemas, 13 gtkmm3, 14 imagemagick, 15 jansson, 16 curl, 17 libjpeg, 18 libpng, 19 librsvg, 20 libtiff, 21 libxml2, 22 libzip, 23 perlPackages, 24 pkg-config, 25 proj, 26 shapelib, 27 unzip, 28 wrapGAppsHook, 29 }: 30 31 stdenv.mkDerivation (finalAttrs: { 32 pname = "mapsoft2"; 33 version = "2.7-alt1"; 34 35 src = fetchFromGitHub { 36 owner = "slazav"; 37 repo = "mapsoft2"; 38 rev = finalAttrs.version; 39 hash = "sha256-8kCcz7EnCxtvQzxBUooKp3ozqhBSNYLMXuXMTdG74nQ="; 40 fetchSubmodules = true; 41 }; 42 43 postPatch = '' 44 substituteInPlace modules/getopt/Makefile \ 45 --replace-fail "SCRIPT_TESTS := getopt" "" 46 substituteInPlace modules/opt/Makefile \ 47 --replace-fail "SIMPLE_TESTS := opt" "" 48 substituteInPlace modules/tmpdir/Makefile \ 49 --replace-fail "SCRIPT_TESTS := tmpdir" "" 50 substituteInPlace modules/get_deps \ 51 --replace-fail "/usr/bin/perl" "${perlPackages.perl}/bin/perl" 52 substituteInPlace modules/mapview/mapview.cpp \ 53 --replace-fail "/usr/share" "$out/share" 54 patchShebangs . 55 56 substituteInPlace vmap_data/scripts/vmaps_preview --replace-fail "vmaps.sh" "$out/bin/vmaps.sh" 57 substituteInPlace vmap_data/scripts/vmaps_out --replace-fail "vmaps.sh" "$out/bin/vmaps.sh" 58 substituteInPlace vmap_data/scripts/vmaps_get_fig --replace-fail "vmaps.sh" "$out/bin/vmaps.sh" 59 substituteInPlace vmap_data/scripts/vmaps_in --replace-fail "vmaps.sh" "$out/bin/vmaps.sh" 60 substituteInPlace vmap_data/scripts/vmaps.sh --replace-fail "/usr" "$out" 61 ''; 62 63 desktopItems = [ 64 (makeDesktopItem { 65 name = "ms2view"; 66 exec = "ms2view"; 67 comment = "Viewer for geodata and raster maps"; 68 desktopName = "ms2view"; 69 genericName = "Mapsoft2 viewer"; 70 categories = [ 71 "Geography" 72 "Geoscience" 73 "Science" 74 ]; 75 }) 76 ]; 77 78 nativeBuildInputs = [ 79 copyDesktopItems 80 fig2dev 81 imagemagick 82 perlPackages.perl 83 pkg-config 84 unzip 85 wrapGAppsHook 86 ] ++ lib.optional stdenv.isDarwin desktopToDarwinBundle; 87 88 buildInputs = [ 89 db 90 giflib 91 gsettings-desktop-schemas 92 gtkmm3 93 jansson 94 curl 95 libjpeg 96 libpng 97 librsvg 98 libtiff 99 libxml2 100 libzip 101 proj 102 shapelib 103 ]; 104 105 SKIP_IMG_DIFFS = 1; 106 107 makeFlags = [ "prefix=$(out)" ]; 108 109 dontWrapGApps = true; 110 111 postFixup = '' 112 for f in $out/bin/ms2*; do 113 wrapGApp $f 114 done 115 ''; 116 117 meta = { 118 description = "A collection of tools and libraries for working with maps and geo-data"; 119 homepage = "http://slazav.github.io/mapsoft2"; 120 license = lib.licenses.gpl3; 121 maintainers = [ lib.maintainers.sikmir ]; 122 platforms = lib.platforms.unix; 123 skip.ci = true; 124 }; 125 })