From 00db3248fd62f0f7901d85a2c2a38138fa5a1698 Mon Sep 17 00:00:00 2001 From: jlam Date: Sun, 5 Jan 2003 19:26:16 +0000 Subject: Decouple py-postgresql from the postgresql build infrastructure and make this package build standalone. py-postgresql uses it's own version numbering and really doesn't have much to do with the rest of the postgresql packages. --- databases/py-postgresql/Makefile | 81 +++++++++++++++++++++---- databases/py-postgresql/distinfo | 9 +++ databases/py-postgresql/files/GNUmakefile.libpq | 20 ++++++ databases/py-postgresql/files/Makefile.custom | 9 +++ databases/py-postgresql/patches/patch-aa | 50 +++++++++++++++ databases/py-postgresql/patches/patch-ab | 12 ++++ databases/py-postgresql/patches/patch-ac | 43 +++++++++++++ databases/py-postgresql/patches/patch-ad | 9 +++ databases/py-postgresql/patches/patch-ae | 40 ++++++++++++ 9 files changed, 262 insertions(+), 11 deletions(-) create mode 100644 databases/py-postgresql/distinfo create mode 100644 databases/py-postgresql/files/GNUmakefile.libpq create mode 100644 databases/py-postgresql/files/Makefile.custom create mode 100644 databases/py-postgresql/patches/patch-aa create mode 100644 databases/py-postgresql/patches/patch-ab create mode 100644 databases/py-postgresql/patches/patch-ac create mode 100644 databases/py-postgresql/patches/patch-ad create mode 100644 databases/py-postgresql/patches/patch-ae diff --git a/databases/py-postgresql/Makefile b/databases/py-postgresql/Makefile index b68550ffafd..ef14a68f3ca 100644 --- a/databases/py-postgresql/Makefile +++ b/databases/py-postgresql/Makefile @@ -1,28 +1,86 @@ -# $NetBSD: Makefile,v 1.23 2002/10/25 11:17:24 drochner Exp $ +# $NetBSD: Makefile,v 1.24 2003/01/05 19:26:16 jlam Exp $ -PKGNAME= ${PYPKGPREFIX}-postgresql-3.3 -COMMENT= Python interface to PostgreSQL -MAINTAINER= darcy@netbsd.org +DISTNAME= postgresql-${DIST_VERS} +DIST_VERS= 7.2.3 +BASE_VERS= ${DIST_VERS} +PKGNAME= ${PYPKGPREFIX}-postgresql-3.3 +CATEGORIES= databases +MASTER_SITES= http://www.postgresql.org/ftpsite/source/v${DIST_VERS}/ \ + ftp://ftp.postgresql.org/pub/source/v${DIST_VERS}/ \ + ftp://ftp.de.postgresql.org/pub/source/v${DIST_VERS}/ \ + ftp://ch.postgresql.org/mirror/postgresql/source/v${DIST_VERS}/ \ + ftp://gd.tuwien.ac.at/db/www.postgresql.org/pub/source/v${DIST_VERS}/ \ + ftp://looking-glass.usask.ca/pub/postgresql/source/v${DIST_VERS}/ \ + ftp://ftp.sunsite.auc.dk/mirrors/postgresql/source/v${DIST_VERS}/ \ + ftp://ftp.jaist.ac.jp/pub/dbms/postgres95/source/v${DIST_VERS}/ -USE_BUILDLINK2= # defined +CONFLICTS+= postgresql-[0-6]* postgresql-7.0* -.include "../../databases/postgresql/Makefile.common" +MAINTAINER= darcy@netbsd.org +HOMEPAGE= http://www.postgresql.org/ +COMMENT= Python interface to PostgreSQL -MAKEFLAGS+= PYTHON_VERSION="${PYVERSSUFFIX}" +USE_BUILDLINK2= YES +GNU_CONFIGURE= YES +AUTOCONF_REQD= 2.13 -PLIST_SUBST+= PYTHON_LIBDIR=${PYLIB} -PLIST_SUBST+= PYPKGPREFIX=${PYPKGPREFIX} +.include "../../mk/bsd.prefs.mk" + +# PG_MB_ENCODING may be set to any of: +# +# SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE, MULE_INTERNAL, +# LATIN1, LATIN2, LATIN3, LATIN4, LATIN5, KOI8, WIN, ALT +# +# This variable controls the language encoding on the backend process. +.if defined(PG_MB_ENCODING) +CONFIGURE_ARGS+= --enable-multibyte=${PG_MB_ENCODING} +.else +CONFIGURE_ARGS+= --enable-multibyte # accept default +.endif + +CONFIGURE_ARGS+= --without-CXX CONFIGURE_ARGS+= --with-openssl=${SSLBASE} +CONFIGURE_ARGS+= --disable-readline +CONFIGURE_ARGS+= --enable-locale +CONFIGURE_ARGS+= --enable-syslog +CONFIGURE_ARGS+= --with-template="${LOWER_OPSYS}" + +CONFIGURE_ARGS+= --disable-odbc +CONFIGURE_ARGS+= --without-java +CONFIGURE_ARGS+= --without-perl +CONFIGURE_ARGS+= --without-tcl +CONFIGURE_ARGS+= --without-tk CONFIGURE_ARGS+= --with-python CONFIGURE_ARGS+= --with-python-compile CONFIGURE_ENV+= PYTHON="${PYTHONBIN}" -MAKE_ENV+= INSTALLED_LIBPQ=1 + +USE_GMAKE= YES MAKEFILE= GNUmakefile +MAKE_ENV+= INSTALLED_LIBPQ=1 +MAKEFLAGS+= PYTHON_VERSION="${PYVERSSUFFIX}" + +PLIST_SUBST+= PYTHON_LIBDIR=${PYLIB} +PLIST_SUBST+= PYPKGPREFIX=${PYPKGPREFIX} BUILD_DIRS= ${WRKSRC}/src/interfaces/python DOCDIR= ${PREFIX}/share/doc/${PYPKGPREFIX}-postgresql +post-extract: + if [ -d ${WRKSRC}/src ]; then \ + ${RM} -f ${WRKSRC}/src/Makefile.custom; \ + ${CP} -f ${FILESDIR}/Makefile.custom \ + ${WRKSRC}/src/Makefile.custom; \ + fi + if [ -d ${WRKSRC}/src/interfaces/libpq ]; then \ + ${RM} -f ${WRKSRC}/src/interfaces/libpq/GNUmakefile; \ + ${CP} -f ${FILESDIR}/GNUmakefile.libpq \ + ${WRKSRC}/src/interfaces/libpq/GNUmakefile; \ + fi + +pre-configure: + cd ${WRKSRC} && ${AUTOCONF} + post-install: ${INSTALL_DATA_DIR} ${DOCDIR}/tutorial ${INSTALL_DATA} ${WRKSRC}/README ${DOCDIR} @@ -30,8 +88,9 @@ post-install: ${INSTALL_DATA} $${file} ${DOCDIR}/tutorial; \ done -.include "../../databases/postgresql-lib/buildlink2.mk" +.include "../postgresql-lib/buildlink2.mk" .include "../../time/py-mxDateTime/buildlink2.mk" .include "../../lang/python/extension.mk" +.include "../../mk/autoconf.mk" .include "../../mk/bsd.pkg.mk" diff --git a/databases/py-postgresql/distinfo b/databases/py-postgresql/distinfo new file mode 100644 index 00000000000..920400ae601 --- /dev/null +++ b/databases/py-postgresql/distinfo @@ -0,0 +1,9 @@ +$NetBSD: distinfo,v 1.4 2003/01/05 19:26:17 jlam Exp $ + +SHA1 (postgresql-7.2.3.tar.gz) = f98acadb3b06ea0f09f82857ca880ec198e3c791 +Size (postgresql-7.2.3.tar.gz) = 9244039 bytes +SHA1 (patch-aa) = 631ff6e24af142ebbb14bb19e61108af9db698d7 +SHA1 (patch-ab) = 73a26d8ce79b28b5245e0c5739f73b967e30cdd5 +SHA1 (patch-ac) = 210c0dda3c32481280fe5f2a9525d33f1d989c6d +SHA1 (patch-ad) = d7889e05ab7963f2b93b46c953cbf1a44e9c0fe5 +SHA1 (patch-ae) = d738fc27a64812fac6b497f2615566bdccd28eb6 diff --git a/databases/py-postgresql/files/GNUmakefile.libpq b/databases/py-postgresql/files/GNUmakefile.libpq new file mode 100644 index 00000000000..98bc603b323 --- /dev/null +++ b/databases/py-postgresql/files/GNUmakefile.libpq @@ -0,0 +1,20 @@ +# $NetBSD: GNUmakefile.libpq,v 1.1 2003/01/05 19:26:18 jlam Exp $ +# +# This GNUmakefile overrides the `all' target of $(libpq_srcdir)/Makefile +# to be empty if INSTALLED_LIBPQ is defined. This handles the submake +# targets sprinkled throughout the PostgreSQL Makefiles that execute +# +# @$(MAKE) -C $(libpq_builddir) all +# +# to ensure that the libpq libraries are built first. If INSTALLED_LIBPQ +# is defined, then have the `all' target simple return success. + +ifdef INSTALLED_LIBPQ +all: + @test -f libpq.a || touch libpq.a +endif + +%: force + @$(MAKE) -f Makefile $@ + +force: ; diff --git a/databases/py-postgresql/files/Makefile.custom b/databases/py-postgresql/files/Makefile.custom new file mode 100644 index 00000000000..f5158e12c08 --- /dev/null +++ b/databases/py-postgresql/files/Makefile.custom @@ -0,0 +1,9 @@ +# $NetBSD: Makefile.custom,v 1.1 2003/01/05 19:26:19 jlam Exp $ +# +# This file is included by Makefile.global, which is included by every +# sub-Makefile in the build tree. Makefiles for shared libraries include +# Makefile.global then Makefile.shlib. + +ifdef INSTALLED_LIBPQ +libpq = -lpq +endif diff --git a/databases/py-postgresql/patches/patch-aa b/databases/py-postgresql/patches/patch-aa new file mode 100644 index 00000000000..53c7fa0ab0f --- /dev/null +++ b/databases/py-postgresql/patches/patch-aa @@ -0,0 +1,50 @@ +$NetBSD: patch-aa,v 1.1 2003/01/05 19:26:20 jlam Exp $ + +--- configure.in.orig Mon Sep 30 23:34:28 2002 ++++ configure.in +@@ -150,6 +150,15 @@ PGAC_ARG_REQ(with, libs, [ --with- + + + # ++# Readline support ++# ++AC_MSG_CHECKING([whether to build with readline support]) ++PGAC_ARG_BOOL(enable, readline, yes, ++ [ --disable-readline disable readline support]) ++AC_MSG_RESULT([$enable_readline]) ++ ++ ++# + # Locale (--enable-locale) + # + AC_MSG_CHECKING([whether to build with locale support]) +@@ -398,6 +407,18 @@ PGAC_ARG_BOOL(with, python, no, [ --wit + AC_MSG_RESULT([$with_python]) + AC_SUBST(with_python) + ++# If python is enabled (above), then optionally byte-compile the modules. ++AC_MSG_CHECKING([whether to byte-compile Python modules]) ++if test "$with_python" = yes; then ++ PGAC_ARG_BOOL(with, python_compile, no, ++ [ --with-python-compile byte-compile modules if Python is enabled]) ++else ++ with_python_compile=no ++fi ++AC_MSG_RESULT([$with_python_compile]) ++AC_SUBST([with_python_compile]) ++ ++ + # + # Optionally build the Java/JDBC tools + # +@@ -682,8 +703,10 @@ fi + ## Libraries + ## + ++if test "$enable_readline" = yes; then + PGAC_CHECK_READLINE + AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)]) ++fi + + if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha" + then diff --git a/databases/py-postgresql/patches/patch-ab b/databases/py-postgresql/patches/patch-ab new file mode 100644 index 00000000000..2f0bcbffcca --- /dev/null +++ b/databases/py-postgresql/patches/patch-ab @@ -0,0 +1,12 @@ +$NetBSD: patch-ab,v 1.1 2003/01/05 19:26:20 jlam Exp $ + +--- src/Makefile.global.in.orig Thu Dec 20 16:23:05 2001 ++++ src/Makefile.global.in +@@ -123,6 +123,7 @@ with_CXX = @with_CXX@ + with_java = @with_java@ + with_perl = @with_perl@ + with_python = @with_python@ ++with_python_compile = @with_python_compile@ + with_tcl = @with_tcl@ + with_tk = @with_tk@ + enable_odbc = @enable_odbc@ diff --git a/databases/py-postgresql/patches/patch-ac b/databases/py-postgresql/patches/patch-ac new file mode 100644 index 00000000000..9e01a5740c0 --- /dev/null +++ b/databases/py-postgresql/patches/patch-ac @@ -0,0 +1,43 @@ +$NetBSD: patch-ac,v 1.1 2003/01/05 19:26:20 jlam Exp $ + +--- src/interfaces/python/GNUmakefile.orig Thu Dec 13 13:39:04 2001 ++++ src/interfaces/python/GNUmakefile +@@ -19,7 +19,14 @@ include $(top_srcdir)/src/Makefile.shlib + + override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) $(python_includespec) + +-all: all-lib ++PY_SCRIPTS = pg.py pgdb.py ++ifeq ($(with_python_compile), yes) ++PY_COMPILED_SCRIPTS = $(PY_SCRIPTS:%.py=%.pyc) $(PY_SCRIPTS:%.py=%.pyo) ++else ++PY_COMPILED_SCRIPTS = ++endif ++ ++all: all-lib $(PY_COMPILED_SCRIPTS) + + all-lib: libpq-all + +@@ -27,6 +34,12 @@ all-lib: libpq-all + libpq-all: + $(MAKE) -C $(libpq_builddir) all + ++%.pyc: %.py ++ $(PYTHON) -c "import py_compile; py_compile.compile(\"$<\")" ++ ++%.pyo: %.py ++ $(PYTHON) -O -c "import py_compile; py_compile.compile(\"$<\")" ++ + install-warning-msg := { \ + echo "*** Skipping the installation of the Python interface module for lack"; \ + echo "*** of permissions. To install it, change to the directory"; \ +@@ -35,6 +48,9 @@ echo "*** become the appropriate user, a + + install: all installdirs + @if test -w $(DESTDIR)$(python_moduleexecdir) && test -w $(DESTDIR)$(python_moduledir); then \ ++ for i in $(PY_SCRIPTS) $(PY_COMPILED_SCRIPTS); do \ ++ $(INSTALL_DATA) $$i $(python_moduledir) ; \ ++ done ; \ + echo "$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX)"; \ + $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX); \ + \ diff --git a/databases/py-postgresql/patches/patch-ad b/databases/py-postgresql/patches/patch-ad new file mode 100644 index 00000000000..d575d55e17a --- /dev/null +++ b/databases/py-postgresql/patches/patch-ad @@ -0,0 +1,9 @@ +$NetBSD: patch-ad,v 1.1 2003/01/05 19:26:21 jlam Exp $ + +--- src/interfaces/python/Setup.in.raw.orig Sun Mar 25 14:44:04 2001 ++++ src/interfaces/python/Setup.in.raw +@@ -1,3 +1,3 @@ + *shared* + +-_pg pgmodule.c -I@libpq_srcdir@ @INCLUDES@ -L@libpq_builddir@ -lpq @EXTRA_LIBS@ ++_pg pgmodule.c -I@libpq_srcdir@ @INCLUDES@ @libpq@ @EXTRA_LIBS@ diff --git a/databases/py-postgresql/patches/patch-ae b/databases/py-postgresql/patches/patch-ae new file mode 100644 index 00000000000..eaad0c9d289 --- /dev/null +++ b/databases/py-postgresql/patches/patch-ae @@ -0,0 +1,40 @@ +$NetBSD: patch-ae,v 1.1 2003/01/05 19:26:21 jlam Exp $ + +--- src/interfaces/python/pgmodule.c.orig Mon Dec 3 07:39:44 2001 ++++ src/interfaces/python/pgmodule.c +@@ -343,7 +343,7 @@ pgsource_dealloc(pgsourceobject * self) + PQclear(self->last_result); + + Py_XDECREF(self->pgcnx); +- PyMem_DEL(self); ++ PyObject_DEL(self); + } + + /* closes object */ +@@ -990,7 +990,7 @@ pglarge_dealloc(pglargeobject * self) + lo_close(self->pgcnx->cnx, self->lo_fd); + + Py_XDECREF(self->pgcnx); +- PyMem_DEL(self); ++ PyObject_DEL(self); + } + + /* opens large object */ +@@ -1546,7 +1546,7 @@ pg_dealloc(pgobject * self) + if (self->cnx) + PQfinish(self->cnx); + +- PyMem_DEL(self); ++ PyObject_DEL(self); + } + + /* close without deleting */ +@@ -1579,7 +1579,7 @@ pgquery_dealloc(pgqueryobject * self) + if (self->last_result) + PQclear(self->last_result); + +- PyMem_DEL(self); ++ PyObject_DEL(self); + } + + /* resets connection */ -- cgit v1.2.3