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