nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

2.nix (3975B)


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