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