commit f0c2c4769b885f83f466b90e79d714916e27e548
parent ce932aeb17fcc58bd22fa0d1b9e04649efb1c2db
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Tue, 31 Dec 2019 01:38:59 +0300
Add mapsoft
Diffstat:
4 files changed, 143 insertions(+), 0 deletions(-)
diff --git a/default.nix b/default.nix
@@ -64,6 +64,9 @@ in rec {
imgp = python3Packages.callPackage ./pkgs/imgp {
inherit (sources) imgp;
};
+ mapsoft = callPackage ./pkgs/mapsoft {
+ inherit (sources) mapsoft;
+ };
mbtileserver = callPackage ./pkgs/mbtileserver {
inherit (sources) mbtileserver;
};
diff --git a/nix/sources.json b/nix/sources.json
@@ -191,6 +191,18 @@
"url": "https://github.com/OpenOrienteering/mapper/archive/9ff0368ca9548da52c6ac7f04c087ef4dcb3a1e3.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
+ "mapsoft": {
+ "branch": "master",
+ "description": "Mapping software for linux",
+ "homepage": "http://slazav.mccme.ru/prog/mapsoft.htm",
+ "owner": "ushakov",
+ "repo": "mapsoft",
+ "rev": "23bd02a05ecf86280acbc2f836803699fa6b13b9",
+ "sha256": "0rq71l9ma82h8rabg1frcxmbpvxqsqnxfixphqmdjybrhxmq2921",
+ "type": "tarball",
+ "url": "https://github.com/ushakov/mapsoft/archive/23bd02a05ecf86280acbc2f836803699fa6b13b9.tar.gz",
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+ },
"mbtileserver": {
"branch": "master",
"description": "Basic Go server for mbtiles",
diff --git a/pkgs/mapsoft/0001-fix-build.patch b/pkgs/mapsoft/0001-fix-build.patch
@@ -0,0 +1,64 @@
+diff --git i/SConstruct w/SConstruct
+index ddcf739d..f98e338c 100644
+--- i/SConstruct
++++ w/SConstruct
+@@ -16,7 +16,7 @@ else:
+ ######################################
+ # Create environment, add some methods
+
+-env = Environment ()
++env = Environment (ENV = {'PATH' : os.environ['PATH']})
+ Export('env')
+
+ # UseLibs -- use pkg-config libraries
+@@ -50,10 +50,13 @@ env.Append (CCFLAGS=['-Werror=return-type'])
+ env.Append (CCFLAGS=['-O2'])
+ env.Append (CCFLAGS='-std=gnu++11')
+
+-env.Append (ENV = {'PKG_CONFIG_PATH': os.getcwd()+'/core/pc'})
+ if os.getenv('PKG_CONFIG_PATH'):
+- env.Append (ENV = {'PKG_CONFIG_PATH':
+- [ os.getcwd()+'/core/pc', os.getenv('PKG_CONFIG_PATH')]})
++ env.Append (ENV = {'PKG_CONFIG_PATH': os.getenv('PKG_CONFIG_PATH')})
++
++if os.getenv('CPPFLAGS'):
++ env.Append (CPPFLAGS=os.getenv('CPPFLAGS'))
++if os.getenv('LINKFLAGS'):
++ env.Append (LINKFLAGS=os.getenv('LINKFLAGS'))
+
+ env.Append (CPPPATH = "#core")
+ env.Append (LIBPATH = "#core")
+@@ -62,13 +65,13 @@ env.Append (LIBS = "mapsoft")
+ ######################################
+ ## Parse command-line arguments:
+
+-env.PREFIX = ARGUMENTS.get('prefix', '')
+-env.bindir=env.PREFIX+'/usr/bin'
+-env.datadir=env.PREFIX+'/usr/share/mapsoft'
+-env.man1dir=env.PREFIX+'/usr/share/man/man1'
+-env.figlibdir=env.PREFIX+'/usr/share/xfig/Libraries'
+-env.libdir=env.PREFIX+ sysconfig.get_config_var('LIBDIR')
+-env.desktopdir=env.PREFIX+'/usr/share/applications'
++env.PREFIX = ARGUMENTS.get('prefix', '/usr')
++env.bindir=env.PREFIX+'/bin'
++env.datadir=env.PREFIX+'/share/mapsoft'
++env.man1dir=env.PREFIX+'/share/man/man1'
++env.figlibdir=env.PREFIX+'/share/xfig/Libraries'
++env.libdir=env.PREFIX+ '/lib'
++env.desktopdir=env.PREFIX+'/share/applications'
+
+ env.Alias('install', [env.bindir, env.man1dir,
+ env.datadir, env.figlibdir, env.libdir, env.desktopdir])
+diff --git i/core/SConscript w/core/SConscript
+index fe5f1802..7238c176 100644
+--- i/core/SConscript
++++ w/core/SConscript
+@@ -13,7 +13,7 @@ import os
+ ##################################################
+ ## build mapsoft library
+
+-env.UseLibs('libxml-2.0 libzip libproj libgif libjpeg libpng libtiff-4 libcurl zlib yaml-0.1 shp jansson')
++env.UseLibs('libxml-2.0 libzip proj libjpeg libpng libtiff-4 libcurl zlib yaml-0.1 shapelib jansson')
+ env.UseLibs('glibmm-2.4 gtkmm-2.4 gthread-2.0')
+ env.UseLibs('cairomm-1.0 pixman-1 freetype2 libusb-1.0')
+
diff --git a/pkgs/mapsoft/default.nix b/pkgs/mapsoft/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, perlPackages, python2Packages, gimp, mapsoft
+, fig2dev, imagemagick, m4, netpbm, pkgconfig, scons
+, boost, curl, giflib, gtkmm2, jansson, libjpeg, libpng
+, libtiff, libusb1, libxml2, libyaml, libzip
+, proj, shapelib, zlib }:
+
+stdenv.mkDerivation rec {
+ pname = "mapsoft";
+ version = stdenv.lib.substring 0 7 src.rev;
+ src = mapsoft;
+
+ patches = [ ./0001-fix-build.patch ];
+
+ nativeBuildInputs = [
+ fig2dev
+ imagemagick
+ m4
+ netpbm
+ perlPackages.perl
+ pkgconfig
+ python2Packages.wrapPython
+ scons
+ ];
+ buildInputs = [
+ boost
+ curl
+ giflib
+ gtkmm2
+ jansson
+ libjpeg
+ libpng
+ libtiff
+ libusb1
+ libxml2
+ libyaml
+ libzip
+ perlPackages.TextIconv
+ proj
+ shapelib
+ zlib
+ ];
+
+ preBuild = ''
+ export CPPFLAGS="-I${boost.dev}/include -I${giflib}/include"
+ export LINKFLAGS="-L${giflib}/lib -lgif"
+ '';
+
+ sconsFlags = [ "minimal=1" "prefix=${placeholder "out"}" ];
+
+ postInstall = ''
+ wrapPythonProgramsIn $out/lib/gimp/${stdenv.lib.versions.major gimp.version}.0/plug-ins/
+ substituteInPlace $out/bin/mapsoft_wp_parse \
+ --replace "/usr/bin/perl" "${perlPackages.perl}/bin/perl"
+ wrapProgram $out/bin/mapsoft_wp_parse --prefix PERL5LIB : "$PERL5LIB"
+ '';
+
+ meta = with stdenv.lib; {
+ description = mapsoft.description;
+ homepage = mapsoft.homepage;
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ sikmir ];
+ platforms = platforms.linux;
+ };
+}