2.nix (3849B)
1 { lib 2 , stdenv 3 , fetchFromGitHub 4 , fetchpatch 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.2"; 34 35 src = fetchFromGitHub { 36 owner = "slazav"; 37 repo = "mapsoft2"; 38 rev = "${finalAttrs.version}-alt1"; 39 hash = "sha256-++v9rlBmH/65XwI7uz6Vdk8NAPOq5jwwqiKpzxD76A8="; 40 fetchSubmodules = true; 41 }; 42 43 patches = [ 44 (substituteAll { 45 src = ./0002-fix-build.patch; 46 db = db.dev; 47 inherit giflib; 48 }) 49 # conv_geo: update test for libproj-9.2.0 50 (fetchpatch { 51 url = "https://github.com/slazav/mapsoft2-libs/commit/9300f93e171769bbf8710d9dfa5f2724b7b6142d.patch"; 52 hash = "sha256-2rzjCwJ+BKJB7YFfZFprPjLn/MZO7sSoHcDKNTjhbT8="; 53 }) 54 # filename: fix for macOS build 55 (fetchpatch { 56 url = "https://github.com/slazav/mapsoft2-libs/commit/0cda5141d29dd1a8f0e0a1f38211faac2fc7b297.patch"; 57 hash = "sha256-ESnPAWKv4qtWHuqRt4XABret85BUMuAkcahEQPdkGfI="; 58 }) 59 # tmpdir: include unistd.h for macOS build 60 (fetchpatch { 61 url = "https://github.com/slazav/mapsoft2-libs/commit/7805967a44498c430daa577615878218d14ae4a7.patch"; 62 hash = "sha256-P8JRMhRkaRZZHxojhpfJTJ6vCC6TfXnOdB2KHzZy3eE="; 63 }) 64 # geom: attempt to fix MacOS build 65 (fetchpatch { 66 url = "https://github.com/slazav/mapsoft2-libs/commit/256e16816e13e0f88a7442ef4e4e9a5533d5481b.patch"; 67 hash = "sha256-gJrv3aTNe/lwuZ4mzcdEJzGWPFKEYPqIqKNKEKddNJ4="; 68 }) 69 # iconv: try to fix MacOS build 70 (fetchpatch { 71 url = "https://github.com/slazav/mapsoft2-libs/commit/0f399a86dac9ff1a2d57a107264d749179bb2d05.patch"; 72 hash = "sha256-lzYBBbCgTuWm1g2gGrbyn6PisHk/yBSIXOmknwTHosU="; 73 }) 74 ]; 75 patchFlags = [ "-p1" "-d modules" ]; 76 77 postPatch = '' 78 substituteInPlace modules/get_deps \ 79 --replace "/usr/bin/perl" "${perlPackages.perl}/bin/perl" 80 substituteInPlace modules/mapview/mapview.cpp \ 81 --replace "/usr/share" "$out/share" 82 patchShebangs . 83 84 substituteInPlace vmap_data/scripts/vmaps_preview --replace "vmaps.sh" "$out/bin/vmaps.sh" 85 substituteInPlace vmap_data/scripts/vmaps_out --replace "vmaps.sh" "$out/bin/vmaps.sh" 86 substituteInPlace vmap_data/scripts/vmaps_get_fig --replace "vmaps.sh" "$out/bin/vmaps.sh" 87 substituteInPlace vmap_data/scripts/vmaps_in --replace "vmaps.sh" "$out/bin/vmaps.sh" 88 substituteInPlace vmap_data/scripts/vmaps.sh --replace "/usr" "$out" 89 ''; 90 91 desktopItems = [ 92 (makeDesktopItem { 93 name = "ms2view"; 94 exec = "ms2view"; 95 comment = "Viewer for geodata and raster maps"; 96 desktopName = "ms2view"; 97 genericName = "Mapsoft2 viewer"; 98 categories = [ "Geography" "Geoscience" "Science" ]; 99 }) 100 ]; 101 102 nativeBuildInputs = [ 103 copyDesktopItems 104 fig2dev 105 imagemagick 106 perlPackages.perl 107 pkg-config 108 unzip 109 wrapGAppsHook 110 ] ++ lib.optional stdenv.isDarwin desktopToDarwinBundle; 111 112 buildInputs = [ 113 db 114 gsettings-desktop-schemas 115 gtkmm3 116 jansson 117 curl 118 libjpeg 119 libpng 120 librsvg 121 libtiff 122 libxml2 123 libzip 124 proj 125 shapelib 126 ]; 127 128 preBuild = "export SKIP_IMG_DIFFS=1"; 129 130 makeFlags = [ "prefix=$(out)" ]; 131 132 dontWrapGApps = true; 133 134 postFixup = '' 135 for f in $out/bin/ms2*; do 136 wrapGApp $f 137 done 138 ''; 139 140 meta = with lib; { 141 description = "A collection of tools and libraries for working with maps and geo-data"; 142 homepage = "http://slazav.github.io/mapsoft2"; 143 license = licenses.gpl3; 144 maintainers = [ maintainers.sikmir ]; 145 platforms = platforms.unix; 146 skip.ci = true; 147 }; 148 })