ports/76214: Postgis upgrade from 0.9.0 to 0.9.1
Anderson S.Ferreira
anderson at cnpm.embrapa.br
Thu Jan 13 19:00:51 UTC 2005
>Number: 76214
>Category: ports
>Synopsis: Postgis upgrade from 0.9.0 to 0.9.1
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Thu Jan 13 19:00:50 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Anderson S. Ferreira
>Release: FreeBSD 6.0-CURRENT amd64
>Organization:
Embrapa Monitoramento por Satélite
>Environment:
System: FreeBSD mogno.cnpm.embrapa.br 6.0-CURRENT FreeBSD 6.0-CURRENT #16: Fri Jan 7 08:16:24 BRST 2005 anderson at mogno.cnpm.embrapa.br:/usr/src/sys/amd64/compile/MOGNO amd64
>Description:
Postgis upgrade from 0.9.0 to 0.9.1
Other changes:
- Adds support to PostgreSQL 8
- Includes Postgis HTML documentation
This patch corrects the errors found in PR ports/75861
>How-To-Repeat:
>Fix:
--- patch.postgis begins here ---
diff -ruN postgis.old/Makefile postgis/Makefile
--- postgis.old/Makefile Wed Jan 5 13:36:44 2005
+++ postgis/Makefile Mon Jan 10 08:14:40 2005
@@ -6,7 +6,7 @@
#
PORTNAME= postgis
-PORTVERSION= 0.9.0
+PORTVERSION= 0.9.1
PORTREVISION= 1
CATEGORIES= databases
MASTER_SITES= http://postgis.refractions.net/
@@ -15,30 +15,69 @@
MAINTAINER= anderson at cnpm.embrapa.br
COMMENT= Adds support for geographic objects to PostgreSQL databases
-BUILD_DEPENDS= ${PGSQL_SRC}/src/Makefile.global:${PORTSDIR}/databases/postgresql7:configure
-LIB_DEPENDS= proj.5:${PORTSDIR}/graphics/proj \
- pq:${PORTSDIR}/databases/postgresql7
+LIB_DEPENDS= proj.5:${PORTSDIR}/graphics/proj
USE_GMAKE= yes
USE_PERL5_BUILD= yes
-MAKE_ARGS= PGSQL_SRC=${PGSQL_SRC}
-OPTIONS= GEOS "Include GEOS - the OpenGIS 'Simple Features for SQL'" off
-
-PGSQL_PORTDIR= ${WRKDIR}/../../../databases/postgresql7
+PKGMESSAGE= pkg-message
WRKSRC= ${WRKDIR}/postgis-${PORTVERSION}
-PGSQL_SRC= ${PGSQL_PORTDIR}/work/postgresql-7.4.6
+PGSQL_SRC= ${WRKDIR}/pgsql/postgresql
+
INSTALL_TARGET= install
+INSTALLS_SHLIB= no
+
+OPTIONS= PGSQL8 "Use PostgreSQL 8 instead of PostgreSQL 7.4" off \
+ GEOS "Include GEOS - the OpenGIS 'Simple Features for SQL'" off \
+
+.include <bsd.port.pre.mk>
+
+MAKE_ARGS= PGSQL_SRC="${PGSQL_SRC}" \
+ DATADIR="${PREFIX}/share/postgis" \
+ BINDIR="${PREFIX}/bin" \
+ LIBDIR="${PREFIX}/lib"
+
+.if defined(WITH_PGSQL8)
+PGSQL_PORTDIR= ${PORTSDIR}/databases/postgresql-devel
+.else
+PGSQL_PORTDIR= ${PORTSDIR}/databases/postgresql7
+.endif
+
+LIB_DEPENDS+= pq.3:${PGSQL_PORTDIR}
+
+.if !defined(NOPORTDOCS)
+BUILD_DEPENDS+= xsltproc:${PORTSDIR}/textproc/libxslt \
+ ${LOCALBASE}/share/xsl/docbook/html/chunk.xsl:${PORTSDIR}/textproc/docbook-xsl
+MAKE_ARGS+= WITH-DOC=yes \
+ DOCSDIR="${DOCSDIR}"
+PORTDOCS= *
+.endif
.if defined(WITH_GEOS)
LIB_DEPENDS+= geos.2:${PORTSDIR}/graphics/geos
+MAKE_ARGS+= USE_GEOS=1
+.else
+MAKE_ARGS+= USE_GEOS=0
.endif
-post-extract:
-.if ! defined(WITH_GEOS)
- @ ${CP} ${WRKSRC}/Makefile ${WRKSRC}/Makefile.orig ; \
- ${CAT} ${WRKSRC}/Makefile.orig | \
- ${SED} "s|USE_GEOS=1|USE_GEOS=0|g" > ${WRKSRC}/Makefile
-.endif
+pre-everything::
+ @${SH} ${PKGINSTALL} ${PORTNAME} MESSAGE
+
+pre-configure:
+ @([ -d ${WRKDIR}/pgsql ] || ${MKDIR} ${WRKDIR}/pgsql) && \
+ cd ${PGSQL_PORTDIR} && \
+ ${MAKE} WRKDIR=${WRKDIR}/pgsql configure && \
+ ${MV} ${WRKDIR}/pgsql/postgresql* ${PGSQL_SRC} \
+
+post-install:
+ @ ${INSTALL_SCRIPT} ${FILESDIR}/updatedb.default ${PREFIX}/share/postgis
+ @ ${INSTALL_SCRIPT} ${FILESDIR}/UPDATE ${PREFIX}/share/postgis
+ @ ${SETENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PORTNAME} POST-INSTALL
+ @ ${CAT} ${PKGMESSAGE}
+
+post-deinstall:
+ @ ${SETENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGDEINSTALL} ${PORTNAME} POST-DEINSTALL
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -ruN postgis.old/distinfo postgis/distinfo
--- postgis.old/distinfo Wed Jan 5 13:36:44 2005
+++ postgis/distinfo Tue Jan 4 11:19:14 2005
@@ -1,2 +1,2 @@
-MD5 (postgis-0.9.0.tar.gz) = 66fbdf0f2d30fb5a243be78f370f47d2
-SIZE (postgis-0.9.0.tar.gz) = 1265333
+MD5 (postgis-0.9.1.tar.gz) = 43264e90d013aea9ce8f3f0c3540ac32
+SIZE (postgis-0.9.1.tar.gz) = 491789
diff -ruN postgis.old/files/UPDATE postgis/files/UPDATE
--- postgis.old/files/UPDATE Wed Dec 31 21:00:00 1969
+++ postgis/files/UPDATE Wed Jan 5 15:31:47 2005
@@ -0,0 +1,14 @@
+Updating databases from old versions of Postgis
+
+Due the libpostgis.so.0 path modification, databases created with older
+versions of postgis won't work properly.
+To solve this problem, please, make a dump (on text format) of your database
+and use the PREFIX/share/updatedb script.
+
+ sh PREFIX/share/updatedb dump.sql
+
+A new file with '.updated' extension will be created with libpostgis
+references updated.
+After that you can restore your database using updated file.
+
+ psql -f dump.sql.updated database
diff -ruN postgis.old/files/patch-a postgis/files/patch-a
--- postgis.old/files/patch-a Wed Dec 31 21:00:00 1969
+++ postgis/files/patch-a Tue Jan 4 11:21:36 2005
@@ -0,0 +1,45 @@
+--- doc/Makefile Thu Sep 9 17:51:32 2004
++++ doc/Makefile.new Wed Dec 29 09:49:05 2004
+@@ -5,14 +5,16 @@
+ postgis-out.xml: postgis.xml
+ cat $< | sed "s/@@LAST_RELEASE_VERSION@@/$(LAST_RELEASE_VERSION)/g" > $@
+
++# html/ch01.html html/ch02.html html/ch03.html html/ch04.html html/ch05.html html/index.html
++
+ chunked-html: postgis-out.xml
+- xsltproc \
+- --param shade.verbatim 1 \
++ xsltproc --param shade.verbatim 1 \
+ --param chunk.section.depth 0 \
++ --output html/ \
+ --stringparam html.stylesheet style.css \
+ --stringparam saxon.character.representation decimal \
+- /usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl \
+- $<
++ /usr/local/share/xsl/docbook/html/chunk.xsl \
++ $< && touch chunked-html
+
+ html: postgis-out.xml
+ xsltproc \
+@@ -20,11 +22,20 @@
+ --param shade.verbatim 1 \
+ --param chunk.section.depth 0 \
+ --stringparam html.stylesheet style.css \
+- /usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl \
++ /usr/local/share/xsl/docbook/html/docbook.xsl \
+ $<
+
+ jw: postgis-out.xml
+ jw $(COMMONOPTS) -o html/ postgis-out.xml
+
+ clean:
++ rm -f postgis-out.xml chunked-html html/*.html
++
++install: chunked-html
++ $(INSTALL_DATA) html/ch01.html $(DOCSDIR)/ch01.html
++ $(INSTALL_DATA) html/ch02.html $(DOCSDIR)/ch02.html
++ $(INSTALL_DATA) html/ch03.html $(DOCSDIR)/ch03.html
++ $(INSTALL_DATA) html/ch04.html $(DOCSDIR)/ch04.html
++ $(INSTALL_DATA) html/ch05.html $(DOCSDIR)/ch05.html
++ $(INSTALL_DATA) html/index.html $(DOCSDIR)/index.html
+
diff -ruN postgis.old/files/patch-b postgis/files/patch-b
--- postgis.old/files/patch-b Wed Dec 31 21:00:00 1969
+++ postgis/files/patch-b Tue Jan 4 11:21:44 2005
@@ -0,0 +1,13 @@
+--- loader/Makefile Wed Dec 29 16:31:54 2004
++++ loader/Makefile.new Wed Dec 29 16:32:25 2004
+@@ -50,8 +50,8 @@
+ $(CC) $(CFLAGS) $(OBJS) shp2pgsql.o $(LDFLAGS) -o $@
+
+ install: all
+- $(INSTALL_PROGRAM) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
+- $(INSTALL_PROGRAM) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
++ $(INSTALL_PROGRAM) pgsql2shp$(EXE) $(DESTDIR)$(BINDIR)/pgsql2shp$(EXE)
++ $(INSTALL_PROGRAM) shp2pgsql$(EXE) $(DESTDIR)$(BINDIR)/shp2pgsql$(EXE)
+
+ clean:
+ @rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(EXE) pgsql2shp$(EXE)
diff -ruN postgis.old/files/patch-c postgis/files/patch-c
--- postgis.old/files/patch-c Wed Dec 31 21:00:00 1969
+++ postgis/files/patch-c Tue Jan 4 14:03:55 2005
@@ -0,0 +1,64 @@
+--- Makefile Wed Dec 29 09:44:01 2004
++++ Makefile.new Wed Dec 29 09:56:30 2004
+@@ -28,7 +28,7 @@
+ #
+ # Download from: http://geos.refractions.net
+ #
+-USE_GEOS=1
++#USE_GEOS=1
+ ifeq (${GEOS_DIR},)
+ GEOS_DIR=/usr/local
+ endif
+@@ -105,10 +105,10 @@
+ SCRIPTS_VERSION=0.0.1
+ ifeq (${USE_VERSION}, 71)
+ MODULE_FILENAME = $(LPATH)/$(shlib)
+- MODULE_INSTALLDIR = $(libdir)
++ MODULE_INSTALLDIR = $(LIBDIR)
+ else
+ MODULE_FILENAME = $(LPATH)/$(shlib)
+- MODULE_INSTALLDIR = $(pkglibdir)
++ MODULE_INSTALLDIR = $(LIBDIR)
+ endif
+
+ #---------------------------------------------------------------
+@@ -191,6 +191,10 @@
+ postgis_geos_wrapper.o: postgis_geos_wrapper.cpp
+
+ all: $(GEOS_RULES) all-lib postgis.sql postgis_undef.sql loaderdumper
++ifneq ($(WITH-DOC),)
++ $(MAKE) -C doc chunked-html
++endif
++
+
+ loaderdumper:
+ $(MAKE) -C loader
+@@ -207,11 +211,15 @@
+ perl create_undef.pl $< $(USE_VERSION) > $@
+
+ install: all installdirs install-postgis-lib
+- $(INSTALL_DATA) postgis.sql $(DESTDIR)$(datadir)
+- $(INSTALL_DATA) postgis_undef.sql $(DESTDIR)$(datadir)
+- $(INSTALL_DATA) spatial_ref_sys.sql $(DESTDIR)$(datadir)
+- $(INSTALL_DATA) README.postgis $(DESTDIR)$(datadir)
++ $(INSTALL_DATA) postgis.sql $(DESTDIR)$(DATADIR)/postgis.sql.default
++ $(INSTALL_DATA) postgis_undef.sql $(DESTDIR)$(DATADIR)
++ $(INSTALL_DATA) spatial_ref_sys.sql $(DESTDIR)$(DATADIR)
++ $(INSTALL_DATA) README.postgis $(DESTDIR)$(DATADIR)
+ $(MAKE) DESTDIR=$(DESTDIR) -C loader install
++ifneq ($(WITH-DOC),)
++ $(MAKE) INSTALL_DATA="$(INSTALL_DATA)" DOCSDIR=$(DOCSDIR) -C doc install
++endif
++
+
+ #- This has been copied from postgresql and adapted
+ install-postgis-lib: $(shlib)
+@@ -235,7 +243,7 @@
+ ./geos_version.sh $(GEOS_DIR) > postgis_geos_version.h
+
+ installdirs:
+- $(mkinstalldirs) $(docdir)/contrib $(datadir)/contrib $(libdir)
++ $(mkinstalldirs) $(DATADIR) $(libdir)
+
+ uninstall: uninstall-lib
+ @rm -f $(docdir)/contrib/README.postgis $(datadir)/contrib/postgis.sql
diff -ruN postgis.old/files/updatedb.default postgis/files/updatedb.default
--- postgis.old/files/updatedb.default Wed Dec 31 21:00:00 1969
+++ postgis/files/updatedb.default Wed Jan 5 09:46:11 2005
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+LIBDIR=%%LIBDIR%%
+
+sed "s|'.*/libpostgis.so.0'|'${LIBDIR}/libpostgis.so.0'|g" $1 > $1.updated
diff -ruN postgis.old/pkg-deinstall postgis/pkg-deinstall
--- postgis.old/pkg-deinstall Wed Dec 31 21:00:00 1969
+++ postgis/pkg-deinstall Wed Jan 5 12:55:39 2005
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+
+case "$2" in
+ "POST-DEINSTALL")
+ PREF=${PREFIX:-$PKG_PREFIX}
+ SHAREDIR=${PREF}/share/postgis
+ rm -f ${SHAREDIR}/postgis.sql ${SHAREDIR}/updatedb
+ rmdir ${SHAREDIR}
+ ;;
+esac
diff -ruN postgis.old/pkg-install postgis/pkg-install
--- postgis.old/pkg-install Wed Dec 31 21:00:00 1969
+++ postgis/pkg-install Wed Jan 5 15:21:51 2005
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+msg(){
+ echo "
+ ================== ** Postgis Upgrade Notice ** ===================
+
+ The Postgis 0.9.1 port has changed the location of some files,
+ including libpostgis.so.0 library. If you are a user from a old
+ version of Postgis (0.9.0 or older), make a backup from your
+ databases before continue !
+
+ If you need to backup your data, press CTRL-C now !
+
+ ======================= GEOS Support Notice =======================
+ In order to use the GEOS support, you may need to specially compile
+ your version of PostgreSQL to link the C++ runtime library.
+ To do this, invoke the PostgreSQL Makefile script this way:
+
+ on csh shell:
+
+ setenv LDFLAGS -lstdc++
+ make
+
+ on sh or bash shell:
+
+ export LDFLAGS=-lstdc++
+ make
+
+ The initial LDFLAGS variable is passed through to the Makefile and
+ adds the C++ library to the linking stage.
+
+ ===================================================================
+"
+sleep 10
+
+}
+
+case "$2" in
+ "PRE-INSTALL")
+ msg
+ ;;
+ "POST-INSTALL")
+ PREF=${PREFIX:-$PKG_PREFIX}
+ SHAREDIR=${PREF}/share/postgis
+ LIBDIR=${PREF}/lib
+ sed -e "s|\$libdir|${LIBDIR}|g" ${SHAREDIR}/postgis.sql.default > ${SHAREDIR}/postgis.sql
+ sed -e "s|%%LIBDIR%%|${LIBDIR}|g" ${SHAREDIR}/updatedb.default > ${SHAREDIR}/updatedb
+ ;;
+ "MESSAGE")
+ msg
+ ;;
+esac
diff -ruN postgis.old/pkg-message postgis/pkg-message
--- postgis.old/pkg-message Wed Dec 31 21:00:00 1969
+++ postgis/pkg-message Wed Jan 5 15:25:39 2005
@@ -0,0 +1,16 @@
+=============================================================
+
+Postgis Installation notes
+
+* The Postgis SQL files had its locations changed.
+ Now they can be found at PREFIX/share/postgis
+
+* HTML Documentation was added to this port and can be found
+ at PREFIX/share/doc/postgis
+
+* libpostgis.so and libpostgis.so.1 were moved from
+ PREFIX/lib/postgresql to PREFIX/lib.
+ Users from older versions (0.9.0 or older), *must* read
+ PREFIX/share/postgis/UPDATE for instructions.
+
+=============================================================
diff -ruN postgis.old/pkg-plist postgis/pkg-plist
--- postgis.old/pkg-plist Wed Jan 5 13:36:44 2005
+++ postgis/pkg-plist Wed Jan 5 11:55:10 2005
@@ -1,10 +1,13 @@
bin/pgsql2shp
bin/shp2pgsql
-lib/postgresql/libpostgis.so
-lib/postgresql/libpostgis.so.0
-share/postgresql/README.postgis
-share/postgresql/postgis.sql
-share/postgresql/postgis_undef.sql
-share/postgresql/spatial_ref_sys.sql
- at unexec rmdir %D/lib/postgresql 2>/dev/null || true
- at unexec rmdir %D/share/postgresql 2>/dev/null || true
+lib/libpostgis.so
+lib/libpostgis.so.0
+%%DATADIR%%/README.postgis
+%%DATADIR%%/UPDATE
+%%DATADIR%%/postgis.sql.default
+%%DATADIR%%/updatedb.default
+%%DATADIR%%/postgis_undef.sql
+%%DATADIR%%/spatial_ref_sys.sql
+%%PORTDOCS%%@unexec rmdir %D/%%DOCSDIR%% 2>/dev/null || true
+ at unexec rmdir %D/%%DATADIR%% 2>/dev/null || true
+ at unexec rmdir %D/lib 2>/dev/null || true
--- patch.postgis ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list