package.nix (3996B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 desktopToDarwinBundle, 7 db, 8 fig2dev, 9 giflib, 10 gsettings-desktop-schemas, 11 gtkmm3, 12 imagemagick, 13 jansson, 14 curl, 15 libiconv, 16 libjpeg, 17 libpng, 18 librsvg, 19 libtiff, 20 libxml2, 21 libzip, 22 perlPackages, 23 pkg-config, 24 proj, 25 shapelib, 26 sqlite, 27 unzip, 28 wrapGAppsHook3, 29 }: 30 31 let 32 libs = fetchFromGitHub { 33 owner = "slazav"; 34 repo = "mapsoft2-libs"; 35 rev = "a33c77c793f3f46b61d9129f91e2441316059fdc"; 36 hash = "sha256-ecbxB8gMZen1kZTku8U45amOH4DP3B+uedK6rG2R8xc="; 37 }; 38 in 39 stdenv.mkDerivation (finalAttrs: { 40 pname = "mapsoft2"; 41 version = "2.10-alt1-unstable-2025-09-28"; 42 43 __structuredAttrs = true; 44 45 src = fetchFromGitHub { 46 owner = "slazav"; 47 repo = "mapsoft2"; 48 rev = "e217d77bce2c0a3e64ca96156efdf20533b656ad"; 49 hash = "sha256-/sWScmKxeVEI1+vEyZEXwqgEk99SS5CBOGeyENylSNw="; 50 }; 51 52 prePatch = '' 53 cp -r ${libs}/* modules 54 chmod -R +w modules 55 ''; 56 57 patches = [ 58 # https://github.com/slazav/mapsoft2-libs/commit/c0c13a537d4aa6f8d8af530f29408a0ae8c5512c#r152084247 59 (fetchpatch { 60 url = "https://github.com/slazav/mapsoft2-libs/commit/c0c13a537d4aa6f8d8af530f29408a0ae8c5512c.patch"; 61 hash = "sha256-uTJnLPwPupUy3c8zr/nx87lA97YQKhQ1nQsr3ltOUE8="; 62 revert = true; 63 stripLen = 1; 64 extraPrefix = "modules/"; 65 }) 66 ./0002-fix-build.patch 67 ] 68 ++ lib.optional (!finalAttrs.doCheck) ./0003-notests.patch; 69 70 postPatch = 71 let 72 srcFiles = [ 73 "docs/man/ms2render.htm" 74 "docs/man/ms2view.htm" 75 "docs/man/ms2view.txt" 76 "docs/man/ms2vmap.htm" 77 "docs/man/ms2vmapdb.htm" 78 "modules/mapview/action_manager.cpp" 79 "modules/mapview/mapview.cpp" 80 "modules/vmap2/vmap2gobj.cpp" 81 "modules/vmap2/vmap2types.cpp" 82 "vmap_data/scripts/vmaps.sh" 83 "vmap_data/scripts/vmaps_diff" 84 "vmap_data/scripts/vmaps_get_fig" 85 "vmap_data/scripts/vmaps_img" 86 "vmap_data/scripts/vmaps_in" 87 "vmap_data/scripts/vmaps_index" 88 "vmap_data/scripts/vmaps_out" 89 "vmap_data/scripts/vmaps_pack_img" 90 "vmap_data/scripts/vmaps_pack_mbtiles" 91 "vmap_data/scripts/vmaps_pack_sqlitedb" 92 "vmap_data/scripts/vmaps_png" 93 "vmap_data/scripts/vmaps_preview" 94 "vmap_data/scripts/vmaps_rend_mbtiles" 95 "vmap_data/scripts/vmaps_tiles" 96 "vmap_data/scripts/vmaps_tlist" 97 "vmap_data/scripts/vmaps_wp_update" 98 ]; 99 in 100 '' 101 ${lib.concatStringsSep "\n" (map (file: ''substituteInPlace ${file} --subst-var out'') srcFiles)} 102 103 substituteInPlace modules/opt/Makefile --replace-fail "SIMPLE_TESTS := opt" "" 104 substituteInPlace modules/tmpdir/Makefile --replace-fail "SCRIPT_TESTS := tmpdir" "" 105 substituteInPlace modules/get_deps --replace-fail "/usr/bin/perl" "${perlPackages.perl}/bin/perl" 106 patchShebangs . 107 ''; 108 109 nativeBuildInputs = [ 110 fig2dev 111 imagemagick 112 perlPackages.perl 113 pkg-config 114 unzip 115 wrapGAppsHook3 116 ] 117 ++ lib.optional stdenv.isDarwin desktopToDarwinBundle; 118 119 buildInputs = [ 120 db 121 giflib 122 gsettings-desktop-schemas 123 gtkmm3 124 jansson 125 curl 126 libjpeg 127 libpng 128 librsvg 129 libtiff 130 libxml2 131 libzip 132 proj 133 shapelib 134 sqlite 135 ] 136 ++ lib.optional stdenv.hostPlatform.isDarwin libiconv; 137 138 env = { 139 SKIP_IMG_DIFFS = 1; 140 NIX_CFLAGS_COMPILE = "-std=c++17"; 141 NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv"; 142 }; 143 144 enableParallelBuilding = true; 145 146 makeFlags = [ "prefix=$(out)" ]; 147 148 doCheck = true; 149 150 dontWrapGApps = true; 151 152 postFixup = '' 153 for f in $out/bin/ms2*; do 154 wrapGApp $f 155 done 156 ''; 157 158 meta = { 159 description = "A collection of tools and libraries for working with maps and geo-data"; 160 homepage = "http://slazav.github.io/mapsoft2"; 161 license = lib.licenses.gpl3; 162 maintainers = [ lib.maintainers.sikmir ]; 163 platforms = lib.platforms.unix; 164 skip.ci = true; 165 }; 166 })
