Commit 8237d89c authored by Peter Eisentraut's avatar Peter Eisentraut

Support fake root install, separate build dir, dependency tracking, our

choice of compiler and flags, uninstall, and peculiar Python installation
layouts for PyGreSql.  Also install into site-packages now, as officially
recommended.  And pgdb.py is also installed now, used to be forgotten.
parent 975da0a7
#
# Autoconf macros for configuring the build of Python extension modules
#
# $Header: /cvsroot/pgsql/config/python.m4,v 1.2 2001/05/12 17:49:32 petere Exp $
# $Header: /cvsroot/pgsql/config/python.m4,v 1.3 2001/07/10 16:33:01 petere Exp $
#
# PGAC_PATH_PYTHON
......@@ -21,48 +21,44 @@ fi
# Determine the name of various directory of a given Python installation.
AC_DEFUN([_PGAC_CHECK_PYTHON_DIRS],
[AC_REQUIRE([PGAC_PATH_PYTHON])
AC_MSG_CHECKING([Python installation directories])
python_version=`${PYTHON} -c "import sys; print sys.version[[:3]]"`
python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
python_configdir="${python_execprefix}/lib/python${python_version}/config"
python_moduledir="${python_prefix}/lib/python${python_version}"
python_includedir="${python_prefix}/include/python${python_version}"
python_dynlibdir="${python_execprefix}/lib/python${python_version}/lib-dynload"
python_moduledir="${python_prefix}/lib/python${python_version}/site-packages"
python_moduleexecdir="${python_execprefix}/lib/python${python_version}/site-packages"
python_includespec="-I${python_prefix}/include/python${python_version}"
if test "$python_prefix" != "$python_execprefix"; then
python_includespec="-I${python_execprefix}/include/python${python_version} $python_includespec"
fi
AC_SUBST(python_version)[]dnl
AC_SUBST(python_prefix)[]dnl
AC_SUBST(python_execprefix)[]dnl
AC_SUBST(python_configdir)[]dnl
AC_SUBST(python_moduledir)[]dnl
AC_SUBST(python_includedir)[]dnl
AC_SUBST(python_dynlibdir)[]dnl
AC_SUBST(python_moduleexecdir)[]dnl
AC_SUBST(python_includespec)[]dnl
# This should be enough of a message.
if test "$python_prefix" != "$python_execprefix"; then
AC_MSG_RESULT([$python_prefix/lib/python${python_version} and $python_execprefix/lib/python${python_version}])
else
AC_MSG_RESULT([$python_prefix/lib/python${python_version}])
fi
])# _PGAC_CHECK_PYTHON_DIRS
# PGAC_CHECK_PYTHON_MODULE_SETUP
# ------------------------------
# Finds things required to build a Python extension module, in
# particular the makefile.
# Finds things required to build a Python extension module.
# This used to do more, that's why it's separate.
#
# It would be nice if we could check whether the current setup allows
# the build of the shared module. Future project.
AC_DEFUN([PGAC_CHECK_PYTHON_MODULE_SETUP],
[AC_REQUIRE([_PGAC_CHECK_PYTHON_DIRS])
AC_MSG_CHECKING([for makefile to build Python module])
python_makefile_pre_in="${python_configdir}/Makefile.pre.in"
if test -f "${python_makefile_pre_in}" ; then
AC_MSG_RESULT([${python_makefile_pre_in}])
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(
[The file
${python_makefile_pre_in}
required to build Python modules does not exist. Make sure that you have
a full Python installation and that this is the right location.])
fi
AC_SUBST(python_makefile_pre_in)[]dnl
[
AC_REQUIRE([_PGAC_CHECK_PYTHON_DIRS])
])# PGAC_CHECK_PYTHON_MODULE_SETUP
......
This diff is collapsed.
# -*-makefile-*-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.129 2001/06/02 18:25:16 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.130 2001/07/10 16:33:01 petere Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
......@@ -123,11 +123,10 @@ enable_rpath = @enable_rpath@
enable_nls = @enable_nls@
python_version = @python_version@
python_includedir = @python_includedir@
python_makefile_pre_in = @python_makefile_pre_in@
python_includespec = @python_includespec@
python_moduledir = @python_moduledir@
python_moduleexecdir = @python_moduleexecdir@
python_libspec = @python_libspec@
python_dynlibdir = @python_dynlibdir@
krb_srvtab = @krb_srvtab@
......
#-------------------------------------------------------------------
#
# GNUmakefile for src/interfaces/python, a.k.a. "PyGreSQL"
#
# Written by Peter Eisentraut <peter_e@gmx.net>
#
# $Header: /cvsroot/pgsql/src/interfaces/python/Attic/GNUmakefile,v 1.9 2001/05/25 15:32:33 momjian Exp $
#
#-------------------------------------------------------------------
# $Header: /cvsroot/pgsql/src/interfaces/python/Attic/GNUmakefile,v 1.10 2001/07/10 16:33:02 petere Exp $
subdir = src/interfaces/python
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
all: Makefile pgmodule.c libpq-all
$(MAKE) -f Makefile
NAME = _pgmodule
SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 0
OBJS = pgmodule.o
SHLIB_LINK = $(libpq)
ifeq ($(PORTNAME), win)
override CPPFLAGS += -DUSE_DL_IMPORT
SHLIB_LINK += $(python_libspec)
endif
include $(top_srcdir)/src/Makefile.shlib
# (Python also has a config.h file. Be sure to use ours.)
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) $(python_includespec)
all: all-lib
all-lib: libpq-all
.PHONY: libpq-all
libpq-all:
$(MAKE) -C $(libpq_builddir) all
Makefile: Setup.in Makefile.pre.in
$(MAKE) -f Makefile.pre.in boot srcdir=$(srcdir) VPATH=$(srcdir)
Makefile.pre.in: $(python_makefile_pre_in)
cp $< $@
Setup.in: Setup.in.raw
sed -e 's,@libpq_srcdir@,$(libpq_srcdir),g' \
-e 's,@libpq_builddir@,$(libpq_builddir),g' \
-e 's%@EXTRA_LIBS@%$(filter -L%, $(LDFLAGS)) $(LIBS)%g' \
-e 's%@INCLUDES@%$(filter -I%, $(CPPFLAGS))%g' \
$< > $@
install: all
@echo "Installing Python module"
@if ( $(INSTALL_DATA) pg.py $(python_moduledir) && \
$(MAKE) -f Makefile install ); then : ; else \
echo "*****" ;\
echo "* Skipping the installation of the Python interface module for lack"; \
echo "* of permissions. To install it, change to the directory"; \
echo "* "`pwd`", become the appropriate"; \
echo "* user, and do \`$(MAKE) install'."; \
echo "*****"; \
install-warning-msg := { \
echo "*** Skipping the installation of the Python interface module for lack"; \
echo "*** of permissions. To install it, change to the directory"; \
echo "*** `pwd`,"; \
echo "*** become the appropriate user, and do '$(MAKE) install'."; }
install: all installdirs
@if test -w $(DESTDIR)$(python_moduleexecdir) && test -w $(DESTDIR)$(python_moduledir); then \
echo "$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX)"; \
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX); \
\
echo "$(INSTALL_DATA) $(srcdir)/pg.py $(DESTDIR)$(python_moduledir)/pg.py"; \
$(INSTALL_DATA) $(srcdir)/pg.py $(DESTDIR)$(python_moduledir)/pg.py; \
\
echo "$(INSTALL_DATA) $(srcdir)/pgdb.py $(DESTDIR)$(python_moduledir)/pgdb.py"; \
$(INSTALL_DATA) $(srcdir)/pgdb.py $(DESTDIR)$(python_moduledir)/pgdb.py; \
else \
$(install-warning-msg); \
fi
uninstall:
@echo "*****"; \
echo "* Unfortunately, the Python interface module cannot be uninstalled"; \
echo "* automatically. To do it yourself, look in or near the directory"; \
echo "* \`$(python_moduledir)' for files \`pg.py' and \`_pgmodule$(DLSUFFIX)'."; \
echo "*****"
installdirs:
$(mkinstalldirs) $(DESTDIR)$(python_moduleexecdir) $(DESTDIR)$(python_moduledir)
# Python sometimes has a different idea what exactly "clean" is.
uninstall:
rm -f $(DESTDIR)$(python_moduleexecdir)/_pgmodule$(DLSUFFIX) \
$(DESTDIR)$(python_moduledir)/pg.py \
$(DESTDIR)$(python_moduledir)/pgdb.py
clean distclean maintainer-clean:
-[ -f Makefile ] && $(MAKE) -f Makefile clobber
rm -f Makefile.pre.in Makefile Setup Setup.in
clean distclean maintainer-clean: clean-lib
rm -f $(OBJS)
# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.7 2001/05/25 15:48:33 momjian Exp $
# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.8 2001/07/10 16:33:02 petere Exp $
subdir = src/pl/plpython
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -I$(srcdir) -I$(python_includedir) $(CPPFLAGS)
override CPPFLAGS := -I$(srcdir) $(python_includespec) $(CPPFLAGS)
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment