nixpkgs/pkgs/development/libraries/gdal/default.nix

97 lines
3.0 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, fetchpatch, unzip, libjpeg, libtiff, zlib
2015-08-24 13:16:13 +01:00
, postgresql, mysql, libgeotiff, pythonPackages, proj, geos, openssl
2018-08-11 01:56:22 +01:00
, libpng, sqlite, libspatialite, poppler, hdf4, qhull, giflib, expat
2018-10-06 16:08:47 +01:00
, libiconv, libxml2
2018-08-11 01:56:22 +01:00
, netcdfSupport ? true, netcdf, hdf5, curl
2017-05-02 21:21:03 +01:00
}:
2017-04-22 14:40:50 +01:00
with stdenv.lib;
2017-05-02 21:21:03 +01:00
2017-07-29 22:33:58 +01:00
stdenv.mkDerivation rec {
name = "gdal-${version}";
version = "2.4.0";
src = fetchurl {
url = "https://download.osgeo.org/gdal/${version}/${name}.tar.xz";
sha256 = "09qgy36z0jc9w05373m4n0vm4j54almdzql6z9p9zr9pdp61syf3";
};
2017-05-03 22:50:51 +01:00
buildInputs = [ unzip libjpeg libtiff libpng proj openssl sqlite
2018-10-06 16:08:47 +01:00
libspatialite poppler hdf4 qhull giflib expat libxml2 ]
++ (with pythonPackages; [ python numpy wrapPython ])
2017-05-02 21:21:03 +01:00
++ stdenv.lib.optional stdenv.isDarwin libiconv
++ stdenv.lib.optionals netcdfSupport [ netcdf hdf5 curl ];
configureFlags = [
2018-08-11 01:56:22 +01:00
"--with-expat=${expat.dev}"
"--with-jpeg=${libjpeg.dev}"
"--with-libtiff=${libtiff.dev}" # optional (without largetiff support)
"--with-png=${libpng.dev}" # optional
2017-05-03 22:50:51 +01:00
"--with-poppler=${poppler.dev}" # optional
"--with-libz=${zlib.dev}" # optional
Revert "postgresql: Add dev output" Firstly this creates a cycle in 9.6 .out <-> .dev after fixing the PGXS path. Secondly this breaks extension handling and the pg_config as it resolves a lot of paths relatively resulting in the following bogus output: BINDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/bin DOCDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/share/doc HTMLDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/share/doc INCLUDEDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/include PKGINCLUDEDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/include INCLUDEDIR-SERVER = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/include/server LIBDIR = /nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib PKGLIBDIR = /nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib LOCALEDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/share/locale MANDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/share/man SHAREDIR = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/share SYSCONFDIR = /etc/postgresql PGXS = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/lib/pgxs/src/makefiles/pgxs.mk CONFIGURE = '--prefix=/nix/store/irqqq4g173g9xrk1mh12kxv0s1d8dbyh-postgresql-9.5.9' '--with-openssl' '--with-libxml' '--sysconfdir=/etc' '--libdir=/nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib' '--with-ossp-uuid' 'CC=gcc' CC = gcc CPPFLAGS = -D_GNU_SOURCE -I/nix/store/z6r0j2b4bcdfw3pck2x6ay0vvx0qzb92-libxml2-2.9.5-dev/include/libxml2 CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 CFLAGS_SL = -fPIC LDFLAGS = -L../../../src/common -L/nix/store/ighspl5sa3qi1zy7nkih0c9p73xjfqa6-libxml2-2.9.5/lib -Wl,--as-needed -Wl,-rpath,'/nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib',--enable-new-dtags LDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgcommon -lpgport -lxml2 -lssl -lcrypto -lz -lreadline -lrt -lcrypt -ldl -lm VERSION = PostgreSQL 9.5.9 This can probably only be properly fixed by rewriting pg_config in large parts as it does not in any way respect splitting the postgres tree and assumes it can simply resolve paths relative to its location. This does not even handle symlinks: $ result-dev/bin/pg_config BINDIR = /home/robin/dev/nixpkgs-upstream/result-dev/bin DOCDIR = /home/robin/dev/nixpkgs-upstream/result-dev/share/doc HTMLDIR = /home/robin/dev/nixpkgs-upstream/result-dev/share/doc INCLUDEDIR = /home/robin/dev/nixpkgs-upstream/result-dev/include PKGINCLUDEDIR = /home/robin/dev/nixpkgs-upstream/result-dev/include INCLUDEDIR-SERVER = /home/robin/dev/nixpkgs-upstream/result-dev/include/server LIBDIR = /nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib PKGLIBDIR = /nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib LOCALEDIR = /home/robin/dev/nixpkgs-upstream/result-dev/share/locale MANDIR = /home/robin/dev/nixpkgs-upstream/result-dev/share/man SHAREDIR = /home/robin/dev/nixpkgs-upstream/result-dev/share SYSCONFDIR = /etc/postgresql PGXS = /nix/store/csiq6zkn2c994kkdjln461jvgbka4yb1-postgresql-9.5.9-dev/lib/pgxs/src/makefiles/pgxs.mk CONFIGURE = '--prefix=/nix/store/irqqq4g173g9xrk1mh12kxv0s1d8dbyh-postgresql-9.5.9' '--with-openssl' '--with-libxml' '--sysconfdir=/etc' '--libdir=/nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib' '--with-ossp-uuid' 'CC=gcc' CC = gcc CPPFLAGS = -D_GNU_SOURCE -I/nix/store/z6r0j2b4bcdfw3pck2x6ay0vvx0qzb92-libxml2-2.9.5-dev/include/libxml2 CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 CFLAGS_SL = -fPIC LDFLAGS = -L../../../src/common -L/nix/store/ighspl5sa3qi1zy7nkih0c9p73xjfqa6-libxml2-2.9.5/lib -Wl,--as-needed -Wl,-rpath,'/nix/store/85s9m7hpfzsl93wcb5gr6ii2km9mpx3z-postgresql-9.5.9-lib/lib',--enable-new-dtags LDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgcommon -lpgport -lxml2 -lssl -lcrypto -lz -lreadline -lrt -lcrypt -ldl -lm VERSION = PostgreSQL 9.5.9 cc @edolstra Revert "bacula: fix after postgresql output splitting" This reverts commit 13c9cbacdded00558084fda7037ca80849208e99. Revert "postgresql: fix pgxs dir in pg_config" This reverts commit 21998d597bd257c1a769e2be4b7a52b5b7e482a6. Revert "rubyGems.pg: fix postgresql path" This reverts commit e253ae7d3a4ab992d2432c87514e3333a3cf744d. Revert "kea: fix path to pg_config" This reverts commit 086c636eb7f894a55f752b6164dac4a87d8bcee9. Revert "php: fix build wrt. new postgres.dev build output" This reverts commit 2f23a83920107678ca1792a11d19e1cb37df3ace. Revert "gdal: fix path to pg_config" This reverts commit 032c50d45b3fd1ebb4af592b83e776ed7004b4c0. Revert "postgresql: Add dev output" This reverts commit b0280f598e4b3f6ebf33ad2115734e4735df443a.
2017-09-27 20:48:39 +01:00
"--with-pg=${postgresql}/bin/pg_config"
2017-07-09 16:43:03 +01:00
"--with-mysql=${mysql.connector-c or mysql}/bin/mysql_config"
"--with-geotiff=${libgeotiff}"
2017-04-22 14:40:50 +01:00
"--with-sqlite3=${sqlite.dev}"
"--with-spatialite=${libspatialite}"
"--with-python" # optional
2018-08-09 04:48:09 +01:00
"--with-proj=${proj}" # optional
"--with-geos=${geos}/bin/geos-config"# optional
2017-05-23 23:27:03 +01:00
"--with-hdf4=${hdf4.dev}" # optional
2018-10-06 16:08:47 +01:00
"--with-xml2=${libxml2.dev}/bin/xml2-config" # optional
(if netcdfSupport then "--with-netcdf=${netcdf}" else "")
];
2017-07-29 22:33:58 +01:00
hardeningDisable = [ "format" ];
CXXFLAGS = "-fpermissive";
postPatch = ''
sed -i '/ifdef bool/i\
#ifdef swap\
#undef swap\
#endif' ogr/ogrsf_frmts/mysql/ogr_mysql.h
2019-01-19 14:42:58 +00:00
# poppler 0.73.0 support
patch -lp2 <${
fetchpatch {
url = "https://github.com/OSGeo/gdal/commit/29f4dfbcac2de718043f862166cd639ab578b552.diff";
sha256 = "1h2rsjjrgwqfgqzppmzv5jgjs1dbbg8pvfmay0j9y0618qp3r734";
2019-01-19 14:42:58 +00:00
}
} || true
patch -p2 <${
fetchpatch {
url = "https://github.com/OSGeo/gdal/commit/19967e682738977e11e1d0336e0178882c39cad2.diff";
sha256 = "12yqd77226i6xvzgqmxiac5ghdinixh8k2crg1r2gnhc0xlc3arj";
2019-01-19 14:42:58 +00:00
}
}
2017-07-29 22:33:58 +01:00
'';
# - Unset CC and CXX as they confuse libtool.
# - teach gdal that libdf is the legacy name for libhdf
preConfigure = ''
unset CC CXX
substituteInPlace configure \
--replace "-lmfhdf -ldf" "-lmfhdf -lhdf"
'';
2015-04-18 22:31:09 +01:00
preBuild = ''
2016-10-15 23:03:42 +01:00
substituteInPlace swig/python/GNUmakefile \
--replace "ifeq (\$(STD_UNIX_LAYOUT),\"TRUE\")" "ifeq (1,1)"
2015-04-18 22:31:09 +01:00
'';
2015-08-24 13:16:13 +01:00
postInstall = ''
wrapPythonPrograms
'';
2017-07-30 09:18:47 +01:00
enableParallelBuilding = true;
meta = {
description = "Translator library for raster geospatial data formats";
homepage = http://www.gdal.org/;
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.marcweber ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
2017-07-29 22:33:58 +01:00
}