* Overriding PostGIS install directories
@ 2018-01-19 5:10 Ben Sturmfels
2018-01-19 13:27 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Ben Sturmfels @ 2018-01-19 5:10 UTC (permalink / raw)
To: Guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 941 bytes --]
Hi Folks,
I'm attempting to add PostGIS to Guix - a GIS extension for PostgreSQL.
The build phase runs ok, but the install phase fails trying to write to
the postgresql package:
/gnu/store/42d5rjrdkln6nwvzwdc8dyd4w6iy3n5j-coreutils-8.27/bin/mkdir:
cannot create directory
‘/gnu/store/0haa85i5rhpxmmninqpkyn3rqax83887-postgresql-10.1/share/contrib’:
Permission denied
That directory comes from `pg_config --sharedir`, run during configure.
I'm trying to force configure to use /share instead by patching
configure.ac as attached. The patch seems like it's being applied, as I
can see the change in
/tmp/guix-build-postgis-2.4.2.drv-7/postgis-2.4.2/configure.ac, but it
seems that the corresponding "configure" file is unchanged, so I'm
obviously missing something.
Any thoughts on this or a better approach?
Regards,
Ben
Ben Sturmfels
Sturm Software Engineering
www.sturm.com.au
(03) 9024 2467
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: gdal-and-postgis-wip.patch --]
[-- Type: text/x-patch, Size: 5696 bytes --]
diff --git a/gnu/local.mk b/gnu/local.mk
index fb4babfdb..da6d65952 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -991,6 +991,7 @@ dist_patch_DATA = \
%D%/packages/patches/policycoreutils-make-sepolicy-use-python3.patch \
%D%/packages/patches/portaudio-audacity-compat.patch \
%D%/packages/patches/portmidi-modular-build.patch \
+ %D%/packages/patches/postgis-config.patch \
%D%/packages/patches/procmail-ambiguous-getline-debian.patch \
%D%/packages/patches/procmail-CVE-2014-3618.patch \
%D%/packages/patches/procmail-CVE-2017-16844.patch \
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 5a24ed614..681108977 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -26,15 +26,89 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix utils)
+ #:use-module (gnu packages)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages databases)
#:use-module (gnu packages glib)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk)
#:use-module (gnu packages image)
+ #:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages web)
#:use-module (gnu packages webkit)
#:use-module (gnu packages xml))
+(define-public gdal
+ (package
+ (name "gdal")
+ (version "2.2.3")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://download.osgeo.org/gdal/2.2.3/gdal-"
+ version
+ ".tar.xz"))
+ (sha256
+ (base32
+ "02wdifcblmqi9ffp5c0ahvwcs5bsx1qpjpsvlbsm6dkb8wyxca53"))))
+ (build-system gnu-build-system)
+ ;; (inputs
+ ;; `(("json-c" ,json-c)
+ ;; ("geos" ,geos)))
+ (arguments
+ `(#:tests? #f))
+ ;; #:configure-flags
+ ;; (list
+ ;; (string-append "--with-libjson-c=" (assoc-ref %build-inputs "json-c")))))
+ (synopsis "Geospatial Data Abstraction Library")
+ (description " GDAL is a translator library for raster geospatial data formats. As a library, it presents a single abstract data model to the calling application for all supported formats. The related OGR library (which lives within the GDAL source tree) provides a similar capability for simple features vector data.
+
+GDAL supports 40+ popular data formats, including commonly used ones (GeoTIFF, JPEG, PNG and more) as well as the ones used in GIS and remote sensing software packages (ERDAS Imagine, ESRI Arc/Info, ENVI, PCI Geomatics). Also supported many remote sensing and scientific data distribution formats such as HDF, EOS FAST, NOAA L1B, NetCDF, FITS.
+
+OGR library supports popular vector formats like ESRI Shapefile, TIGER data, S57, MapInfo File, DGN, GML and more.")
+ (home-page "http://gdal.org/")
+ ;; FIXME - many licenses
+ (license license:gpl2+)))
+
+(define-public postgis
+ (package
+ (name "postgis")
+ (version "2.4.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://download.osgeo.org/postgis/source/postgis-"
+ version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "1n91lgbz0f40gicls722c8xnap1zb84j2mr240xdah6lkv4mnqi3"))
+ (patches (search-patches "postgis-config.patch"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("perl" ,perl)
+ ("proj.4" ,proj.4)
+ ("geos" ,geos)
+ ("gdal" ,gdal)
+ ("libxml2" ,libxml2)
+ ("postgresql" ,postgresql)
+ ;; Disabling json-c for now. If used, build fails to find
+ ;; json_object_private.h, which the json-c Makefile.am is configured
+ ;; not to output. Rekado suggested adding sources of json-c to the
+ ;; package.
+ ;;
+ ;; ("json-c" ,json-c)
+ ))
+ (native-inputs
+ `(("gdal" ,gdal)))
+
+ (arguments
+ '(#:tests? #f))
+ (synopsis "")
+ (description "")
+ (home-page "")
+ ;; FIXME
+ (license license:gpl2+)))
+
(define-public geos
(package
(name "geos")
@@ -72,6 +146,7 @@ topology functions.")
license:zlib ; tests/xmltester/tinyxml/*
license:public-domain)))) ; include/geos/timeval.h
+
;;; FIXME GNOME Maps only runs within GNOME. On i3, it fails with this error:
;;; (org.gnome.Maps:8568): GLib-GIO-ERROR **: Settings schema
;;; 'org.gnome.desktop.interface' is not installed
diff --git a/gnu/packages/patches/postgis-config.patch b/gnu/packages/patches/postgis-config.patch
new file mode 100644
index 000000000..a6ec1833a
--- /dev/null
+++ b/gnu/packages/patches/postgis-config.patch
@@ -0,0 +1,23 @@
+diff --git a/configure.ac b/configure.ac
+index b9432df..fe9d824 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -453,7 +453,8 @@ if test "x$LIBLWGEOM_ONLY" = "xno"; then
+
+ PGSQL_PKGLIBDIR=`"$PG_CONFIG" --pkglibdir`
+ PGSQL_LIBDIR=`"$PG_CONFIG" --libdir`
+- PGSQL_SHAREDIR=`"$PG_CONFIG" --sharedir`
++ # Seems this one doesn't take effect?
++ PGSQL_SHAREDIR=/share/
+
+ AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])
+ dnl Ensure that we are using PostgreSQL >= 9.3
+@@ -504,7 +505,7 @@ if test "x$LIBLWGEOM_ONLY" = "xno"; then
+ AC_SUBST([PGSQL_BINDIR])
+
+ dnl Extract the share directory
+- PGSQL_SHAREDIR=`"$PG_CONFIG" --sharedir`
++ PGSQL_SHAREDIR=/share/
+
+ AC_SUBST([PGSQL_SHAREDIR])
+
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Overriding PostGIS install directories
2018-01-19 5:10 Overriding PostGIS install directories Ben Sturmfels
@ 2018-01-19 13:27 ` Ludovic Courtès
2018-01-20 0:32 ` Ben Sturmfels
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-01-19 13:27 UTC (permalink / raw)
To: Ben Sturmfels; +Cc: Guix-devel
Hi Ben,
Ben Sturmfels <ben@sturm.com.au> skribis:
> I'm trying to force configure to use /share instead by patching
> configure.ac as attached. The patch seems like it's being applied, as I
> can see the change in
> /tmp/guix-build-postgis-2.4.2.drv-7/postgis-2.4.2/configure.ac, but it
> seems that the corresponding "configure" file is unchanged, so I'm
> obviously missing something.
You would need to run “autoreconf” in a pre-configure phase to
regenerate ‘configure’. And thus you’d need to add Autoconf (and maybe
Automake and Libtool) as native inputs, too.
However, I’d recommend simply patching ‘configure’ itself in a snippet,
using ‘substitute*’. That way, you won’t have to add these dependencies
and extra phase.
HTH!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Overriding PostGIS install directories
2018-01-19 13:27 ` Ludovic Courtès
@ 2018-01-20 0:32 ` Ben Sturmfels
2018-01-24 14:28 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Ben Sturmfels @ 2018-01-20 0:32 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
Hi Ludo,
On Fri, 19 Jan 2018, Ludovic Courtès wrote:
> However, I’d recommend simply patching ‘configure’ itself in a snippet,
> using ‘substitute*’. That way, you won’t have to add these dependencies
> and extra phase.
Thanks, substitute* is much neater and changing configure directly is
working.
I've just discovered though that the build includes makefile templates
from the input postgres package, eg
...-postgresql-10.1/lib/pgxs/src/makefiles/pgxs.mk and parents. These
makefiles are created from a separate run of `pg_config --sharedir` when
building postgresql.
I wonder whether it would be simpler to mock the "pg_config" program to
return the paths I want, rather than patch out all the calls to it. Is
that possible to do for a package and its inputs? What do you think?
Regards,
Ben
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Overriding PostGIS install directories
2018-01-20 0:32 ` Ben Sturmfels
@ 2018-01-24 14:28 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-01-24 14:28 UTC (permalink / raw)
To: Ben Sturmfels; +Cc: Guix-devel
Hi,
Ben Sturmfels <ben@sturm.com.au> skribis:
> On Fri, 19 Jan 2018, Ludovic Courtès wrote:
>
>> However, I’d recommend simply patching ‘configure’ itself in a snippet,
>> using ‘substitute*’. That way, you won’t have to add these dependencies
>> and extra phase.
>
> Thanks, substitute* is much neater and changing configure directly is
> working.
>
> I've just discovered though that the build includes makefile templates
> from the input postgres package, eg
> ...-postgresql-10.1/lib/pgxs/src/makefiles/pgxs.mk and parents. These
> makefiles are created from a separate run of `pg_config --sharedir` when
> building postgresql.
>
> I wonder whether it would be simpler to mock the "pg_config" program to
> return the paths I want, rather than patch out all the calls to it. Is
> that possible to do for a package and its inputs? What do you think?
I guess it all depends on the number of ‘pg_config’ invocations that
need to be patch, and whether each one needs different treatment. We
should minimize complexity.
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-24 14:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-19 5:10 Overriding PostGIS install directories Ben Sturmfels
2018-01-19 13:27 ` Ludovic Courtès
2018-01-20 0:32 ` Ben Sturmfels
2018-01-24 14:28 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).