[postgis-devel] questions on packaging postgis

Greg Troxel gdt at ir.bbn.com
Thu Sep 14 11:18:14 PDT 2006


I've just created a package for postgis within the pkgsrc system, used
as the standard packaging system on NetBSD and Dragonfly, and usable
on many other platforms (Linux, Solaris, Irix, AIX).
http://www.netbsd.org/Documentation/software/packages.html

I based the package on prior work by Mahesh Chittur of NMSU.
I am using postgis 1.1.3.

I had several problems and a few questions about how postgis should be
configured.

pkgsrc works by having a control file that says where the distfile
(your released tarball) comes from, and how to build it.  In this
case, I simply said that the package uses GNU configure and uses gmake
and perl, and has to have geos, proj and postgresql already installed.
This results in passing --prefix=/usr/pkg to the build.

I found the way that configure dealt with path choice to be very
confusing (use_new_layout).  It seems there is a recommended place to
put things, or rather two sets.  It would be nice to make this an
explicit switch to configure, rather than keying off prefix.

What is the recommended set of paths?  It seems that liblwgeom is a
postgresql thing, and thus should be in PKGLIBDIR.  In pkgsrc, this is
/usr/pkg/lib/postgresql.  But when I set it that way via --libdir, I
found that the installed lwpostgis.sql looked for the library in the
"standard" libdir of /usr/pkg/lib.  So I think this is a bug; the
script should match the library location.  I have now removed the
command to set libdir.

Then, I found:

  psql:/usr/pkg/share/postgresql/contrib/lwpostgis.sql:39: ERROR:  could not load library "/usr/pkg/lib/liblwgeom.so.1.1": Shared object "libgeos.so.2" not found

This is because lwgeom was not linked with -R (NetBSD/pkgsrc does not
search /usr/pkg/lib by default).  I'll figure out how to patch around
this; it's a typical problem.

I get the following from configure:

  checking for geos-config... /usr/pkg/bin/geos-config
  Usage: geos-config [OPTIONS]
  Options:
       [--prefix]
       [--version]
       [--libs]
       [--cflags]
       [--includes]
       [--jtsport]

This is because my version of geos-config does not allow ldflags, only
libs.  I have 2.0.0, which I see now is a more than a bit old.   The
README should be  updated to specify what's necessary, or configure.in
to be a bit more tolerant.





Here are the paths in my installed package.  Should any of them be
different?

  /usr/pkg/bin/pgsql2shp
  /usr/pkg/bin/shp2pgsql
  /usr/pkg/lib/liblwgeom.so
  /usr/pkg/lib/liblwgeom.so.1
  /usr/pkg/lib/liblwgeom.so.1.1
  /usr/pkg/share/doc/html/postgis/apa.html
  /usr/pkg/share/doc/html/postgis/ch01.html
  /usr/pkg/share/doc/html/postgis/ch02.html
  /usr/pkg/share/doc/html/postgis/ch03.html
  /usr/pkg/share/doc/html/postgis/ch04.html
  /usr/pkg/share/doc/html/postgis/ch05.html
  /usr/pkg/share/doc/html/postgis/ch06.html
  /usr/pkg/share/doc/html/postgis/ch07.html
  /usr/pkg/share/doc/html/postgis/index.html
  /usr/pkg/share/doc/html/postgis/style.css
  /usr/pkg/share/doc/postgis/README.postgis
  /usr/pkg/share/doc/postgis/postgis.xml
  /usr/pkg/share/postgresql/contrib/lwpostgis.sql
  /usr/pkg/share/postgresql/contrib/lwpostgis_upgrade.sql
  /usr/pkg/share/postgresql/contrib/spatial_ref_sys.sql

The doc directory choice is set by pkgsrc rules.  Should the sql
scripts be in /usr/pkg/share/postgis?  That seems more natural, but
the real question is perhaps where someone who is used to postgis
would expect them.


    Greg Troxel <gdt at ir.bbn.com>

Here's the packaging file for those who are interested:

# $NetBSD: Makefile,v 1.1.1.1 2006/09/14 17:02:40 gdt Exp $

DISTNAME=		postgis-${VERSION}
VERSION=		1.1.3
PKGNAME=		postgresql81-postgis-${VERSION}
MASTER_SITES=	  	http://postgis.refractions.net/download/
CATEGORIES=		databases geography

MAINTAINER=		gdt at NetBSD.org
HOMEPAGE=		http://postgis.refractions.net/
COMMENT=		Spatial database capabilities for PostgreSQL

# XXX Change to determine postgresql version dynamically.

CONFLICTS=		postgis-[0-9]*

GNU_CONFIGURE=		YES
USE_TOOLS+=		gmake perl
USE_LANGUAGES+=		c c++

CONFIGURE_ARGS+=	--datadir=${PREFIX}/share/postgresql/contrib
CONFIGURE_ARGS+=	--libdir=${PREFIX}/lib/postgresql

DOCDIR=		${PREFIX}/share/doc/postgis
HTMLDIR=	${PREFIX}/share/doc/html/postgis

# Install is manual because distribution fails if docbook prereqs are not
# satisfied, rather than using the prebuilt versions which are actually
# in the distfile.
do-install:
	cd ${WRKSRC} && ${GMAKE} install
	${INSTALL_DATA_DIR} ${DOCDIR}
	${INSTALL_DATA} ${BUILD_DIRS:Q}/README.postgis ${DOCDIR}
	${INSTALL_DATA} ${BUILD_DIRS:Q}/doc/postgis.xml ${DOCDIR}
	${INSTALL_DATA_DIR} ${HTMLDIR}
	cd ${WRKSRC}/doc/html && ${PAX} -rw -pp *.html *.css ${HTMLDIR}

# XXX Perhaps this should be run-depends only.
DEPENDS+=	postgresql81-server>=8.1:../../databases/postgresql81-server

.include "../../geography/geos/buildlink3.mk"
.include "../../misc/proj/buildlink3.mk"
# "server" includes are in the client package
.include "../../databases/postgresql81-client/buildlink3.mk"
# needed for docs, also pdfxmltex, db2pdf, jw
#.include "../../textproc/libxslt/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20060914/8849fcb4/attachment.sig>


More information about the postgis-devel mailing list