2.nix (3274B)
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 libiconv, 18 libjpeg, 19 libpng, 20 librsvg, 21 libtiff, 22 libxml2, 23 libzip, 24 perlPackages, 25 pkg-config, 26 proj, 27 shapelib, 28 unzip, 29 wrapGAppsHook, 30 }: 31 32 stdenv.mkDerivation (finalAttrs: { 33 pname = "mapsoft2"; 34 version = "2.8-alt1"; 35 36 src = fetchFromGitHub { 37 owner = "slazav"; 38 repo = "mapsoft2"; 39 rev = finalAttrs.version; 40 hash = "sha256-bMF/20MXMnxTIROfHFLW3711GWqQTv72jbRpWtow4eA="; 41 fetchSubmodules = true; 42 }; 43 44 patches = [ ./0002-fix-build.patch ]; 45 46 postPatch = 47 let 48 srcFiles = [ 49 "docs/man/ms2render.htm" 50 "docs/man/ms2view.htm" 51 "docs/man/ms2view.txt" 52 "docs/man/ms2vmap.htm" 53 "docs/man/ms2vmapdb.htm" 54 "modules/mapview/action_manager.cpp" 55 "modules/mapview/mapview.cpp" 56 "modules/vmap2/vmap2gobj.cpp" 57 "modules/vmap2/vmap2types.cpp" 58 "vmap_data/scripts/vmaps.sh" 59 "vmap_data/scripts/vmaps_get_fig" 60 "vmap_data/scripts/vmaps_in" 61 "vmap_data/scripts/vmaps_mbtiles" 62 "vmap_data/scripts/vmaps_out" 63 "vmap_data/scripts/vmaps_preview" 64 "vmap_data/scripts/vmaps_sqlitedb" 65 "vmap_data/scripts/vmaps_wp_update" 66 ]; 67 in 68 '' 69 ${lib.concatStringsSep "\n" (map (file: ''substituteInPlace ${file} --subst-var out'') srcFiles)} 70 71 substituteInPlace modules/getopt/Makefile --replace-fail "SCRIPT_TESTS := getopt" "" 72 substituteInPlace modules/opt/Makefile --replace-fail "SIMPLE_TESTS := opt" "" 73 substituteInPlace modules/tmpdir/Makefile --replace-fail "SCRIPT_TESTS := tmpdir" "" 74 substituteInPlace modules/get_deps --replace-fail "/usr/bin/perl" "${perlPackages.perl}/bin/perl" 75 patchShebangs . 76 ''; 77 78 desktopItems = [ 79 (makeDesktopItem { 80 name = "ms2view"; 81 exec = "ms2view"; 82 comment = "Viewer for geodata and raster maps"; 83 desktopName = "ms2view"; 84 genericName = "Mapsoft2 viewer"; 85 categories = [ 86 "Geography" 87 "Geoscience" 88 "Science" 89 ]; 90 }) 91 ]; 92 93 nativeBuildInputs = [ 94 copyDesktopItems 95 fig2dev 96 imagemagick 97 perlPackages.perl 98 pkg-config 99 unzip 100 wrapGAppsHook 101 ] ++ lib.optional stdenv.isDarwin desktopToDarwinBundle; 102 103 buildInputs = [ 104 db 105 giflib 106 gsettings-desktop-schemas 107 gtkmm3 108 jansson 109 curl 110 libjpeg 111 libpng 112 librsvg 113 libtiff 114 libxml2 115 libzip 116 proj 117 shapelib 118 ] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv; 119 120 env = { 121 SKIP_IMG_DIFFS = 1; 122 NIX_CFLAGS_COMPILE = "-std=c++17"; 123 NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv"; 124 }; 125 126 makeFlags = [ "prefix=$(out)" ]; 127 128 dontWrapGApps = true; 129 130 postFixup = '' 131 for f in $out/bin/ms2*; do 132 wrapGApp $f 133 done 134 ''; 135 136 meta = { 137 description = "A collection of tools and libraries for working with maps and geo-data"; 138 homepage = "http://slazav.github.io/mapsoft2"; 139 license = lib.licenses.gpl3; 140 maintainers = [ lib.maintainers.sikmir ]; 141 platforms = lib.platforms.unix; 142 skip.ci = true; 143 }; 144 })