mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 10:30:33 +03:00 
			
		
		
		
	Moved the intricacies of the perl interface build into its own makefile
that now functions as a wrapper around the MakeMaker stuff. It might even behave sensically when we have separate build dirs. Same for plperl, which of course still doesn't work very well. Made sure that plperl respects the choice of --libdir. Added --with-python to automatically build and install the Python interface. Works similarly to the Perl5 stuff. Moved the burden of the distclean targets lower down into the source tree. Eventually, each make file should have its own. Added automatic remaking of makefiles and configure. Currently only for the top-level because of a bug(?) in Autoconf. Use GNU `missing' to work around missing autoconf and aclocal. Start factoring out macros into their own config/*.m4 files to increase readability and organization.
This commit is contained in:
		| @@ -1,65 +0,0 @@ | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # Makefile.inc-- | ||||
| #    Makefile for src/bin (utility programs) | ||||
| # | ||||
| # Copyright (c) 1994, Regents of the University of California | ||||
| # | ||||
| # | ||||
| # IDENTIFICATION | ||||
| #    $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.38 2000/04/26 09:03:10 wieck Exp $ | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
|  | ||||
| SRCDIR= .. | ||||
| include $(SRCDIR)/Makefile.global | ||||
|  | ||||
|  | ||||
| # Note: the klugery for perl5 is to ensure that the perl5 shared lib | ||||
| # gets built with the correct path to the installed location of libpq | ||||
| # during "make install", but is built against the local tree during | ||||
| # ordinary building and testing.  During install, we must also guard | ||||
| # against the likelihood that we don't have permissions to install into | ||||
| # the Perl module library. | ||||
|  | ||||
| .DEFAULT all install clean dep depend distclean: | ||||
| 	$(MAKE) -C libpq $@ | ||||
| 	$(MAKE) -C ecpg $@ | ||||
| ifeq ($(HAVE_Cplusplus), true) | ||||
| 	$(MAKE) -C libpq++ $@ | ||||
| else | ||||
| 	echo $(HAVE_Cplusplus): No C++ | ||||
| endif | ||||
| 	$(MAKE) -C libpgeasy $@ | ||||
| ifeq ($(USE_TCL), true) | ||||
| 	$(MAKE) -C libpgtcl $@ | ||||
| endif | ||||
| ifeq ($(USE_PERL), true) | ||||
| 	if [ "$@" = "install" ]; then \ | ||||
| 		$(MAKE) $(MFLAGS) install-perl5; \ | ||||
| 	else \ | ||||
| 		$(MAKE) $(MFLAGS) perl5/Makefile; \ | ||||
| 		$(MAKE) $(MFLAGS) -C perl5 $@; \ | ||||
| 	fi | ||||
| endif | ||||
| ifeq ($(USE_ODBC), true) | ||||
| 	$(MAKE) -C odbc $@ | ||||
| endif | ||||
|  | ||||
| perl5/Makefile: perl5/Makefile.PL | ||||
| 	cd perl5 && $(PERL) Makefile.PL POLLUTE=1 | ||||
|  | ||||
| install-perl5: perl5/Makefile | ||||
| 	$(MAKE) -C perl5 clean | ||||
| 	cd perl5 && POSTGRES_HOME="$(POSTGRESDIR)" $(PERL) Makefile.PL POLLUTE=1 | ||||
| 	$(MAKE) -C perl5 all | ||||
| 	-@if [ -w `$(MAKE) --quiet -C perl5 echo-installdir` ]; then \ | ||||
| 		$(MAKE) $(MFLAGS) -C perl5 install; \ | ||||
| 		rm -f perl5/Makefile; \ | ||||
| 	else \ | ||||
| 		echo "Skipping install of Perl module for lack of permissions."; \ | ||||
| 		echo "To install it, cd into interfaces/perl5, su to become the"; \ | ||||
| 		echo "appropriate user, and do '$(MAKE) install'."; \ | ||||
| 	fi | ||||
|  | ||||
| .PHONY: install-perl5 | ||||
							
								
								
									
										65
									
								
								src/interfaces/Makefile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/interfaces/Makefile.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # Makefile for src/interfaces | ||||
| # | ||||
| # Copyright (c) 1994, Regents of the University of California | ||||
| # | ||||
| # $Header: /cvsroot/pgsql/src/interfaces/Attic/Makefile.in,v 1.1 2000/06/10 18:01:48 petere Exp $ | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
|  | ||||
| srcdir = @srcdir@ | ||||
| VPATH = @srcdir@ | ||||
|  | ||||
| top_srcdir = @top_srcdir@ | ||||
| top_builddir = ../.. | ||||
|  | ||||
| USE_TCL = @USE_TCL@ | ||||
| USE_ODBC = @USE_ODBC@ | ||||
| WITH_CXX = @HAVECXX@ | ||||
| with_perl = @with_perl@ | ||||
| with_python = @with_python@ | ||||
|  | ||||
| all install clean dep depend: | ||||
| 	$(MAKE) -C libpq $@ | ||||
| 	$(MAKE) -C ecpg $@ | ||||
| ifeq ($(WITH_CXX), true) | ||||
| 	$(MAKE) -C libpq++ $@ | ||||
| endif | ||||
| 	$(MAKE) -C libpgeasy $@ | ||||
| ifeq ($(USE_TCL), true) | ||||
| 	$(MAKE) -C libpgtcl $@ | ||||
| endif | ||||
| ifeq ($(with_perl), yes) | ||||
| 	$(MAKE) -C perl5 $@ | ||||
| endif | ||||
| ifeq ($(with_python), yes) | ||||
| 	$(MAKE) -C python $@ | ||||
| endif | ||||
| ifeq ($(USE_ODBC), true) | ||||
| 	$(MAKE) -C odbc $@ | ||||
| endif | ||||
|  | ||||
| distclean maintainer-clean: clean | ||||
| ifeq ($(with_perl), yes) | ||||
| 	-$(MAKE) -C perl5 $@ | ||||
| endif | ||||
| ifeq ($(with_python), yes) | ||||
| 	-$(MAKE) -C python $@ | ||||
| endif | ||||
| 	rm -f Makefile \ | ||||
| 	  libpq/Makefile \ | ||||
| 	  ecpg/lib/Makefile \ | ||||
| 	  ecpg/preproc/Makefile \ | ||||
| 	  libpq++/Makefile \ | ||||
| 	  libpgeasy/Makefile \ | ||||
| 	  libpgtcl/Makefile \ | ||||
| 	  odbc/GNUmakefile \ | ||||
| 	  odbc/Makefile.global \ | ||||
| 	  odbc/port \ | ||||
| 	  odbc/makefiles \ | ||||
| 	  odbc/template \ | ||||
| 	  odbc/config.h | ||||
|  | ||||
|  | ||||
| .PHONY: all install dep depend clean distclean maintainer-clean | ||||
							
								
								
									
										71
									
								
								src/interfaces/perl5/GNUmakefile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								src/interfaces/perl5/GNUmakefile.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | ||||
| # This file is an interface from the Autoconf world to Perl's | ||||
| # MakeMaker world, so that the latter behaves (kind of) like the | ||||
| # former would prefer. Internally, we call Perl to create another | ||||
| # Makefile according to it's own ideas and then invoke the rules from | ||||
| # that file. | ||||
| # | ||||
| # $Header: /cvsroot/pgsql/src/interfaces/perl5/Attic/GNUmakefile.in,v 1.1 2000/06/10 18:01:56 petere Exp $ | ||||
|  | ||||
| srcdir = @srcdir@ | ||||
| VPATH = @srcdir@ | ||||
|  | ||||
| top_srcdir = @top_srcdir@ | ||||
| top_builddir = ../../.. | ||||
|  | ||||
| PERL = @PERL@ | ||||
|  | ||||
| prefix = @prefix@ | ||||
| exec_prefix = @exec_prefix@ | ||||
| libdir = @libdir@ | ||||
| includedir = @includedir@ | ||||
|  | ||||
|  | ||||
| all: Makefile libpq-all | ||||
| 	$(MAKE) -f $< all | ||||
|  | ||||
| Makefile: Makefile.PL | ||||
| 	$(PERL) $< POLLUTE=1 | ||||
|  | ||||
| libpq-all: | ||||
| 	$(MAKE) -C $(top_builddir)/src/interfaces/libpq all | ||||
|  | ||||
| # The klugery here is to ensure that the perl5 shared library gets | ||||
| # built with the correct path to the installed location of libpq | ||||
| # during `make install', but is built against the local tree during | ||||
| # ordinary building and testing. | ||||
| # | ||||
| # During install, we must also guard against the likelihood that we | ||||
| # don't have permissions to install into the Perl module library. The | ||||
| # purer alternative would naturally be the ability to select the | ||||
| # installation directory somewhere. | ||||
|  | ||||
| install: Makefile libpq-install | ||||
| 	$(MAKE) -f Makefile clean | ||||
| 	POSTGRES_LIB="$(libdir)" \ | ||||
| 	  POSTGRES_INCLUDE="$(includedir)" \ | ||||
| 	  $(PERL) $(srcdir)/Makefile.PL POLLUTE=1 | ||||
| 	$(MAKE) -f Makefile all | ||||
| 	-@if [ -w "`$(MAKE) --quiet -f Makefile echo-installdir`" ]; then \ | ||||
| 		$(MAKE) -f Makefile install; \ | ||||
| 		rm -f Makefile; \ | ||||
| 	else \ | ||||
| 		echo "*****" ;\ | ||||
| 		echo "* Skipping the installation of the Perl module for lack of permissions."; \ | ||||
| 		echo "* To install it, change to the directory "`pwd`","; \ | ||||
| 		echo "* become the appropriate user, and do \`$(MAKE) install'."; \ | ||||
| 		echo "*****"; \ | ||||
| 	fi | ||||
|  | ||||
| libpq-install: | ||||
| 	$(MAKE) -C $(top_builddir)/src/interfaces/libpq install | ||||
|  | ||||
| # Note: Perl's idea of "clean" is a little different, so we use "realclean" | ||||
|  | ||||
| clean: | ||||
| 	-[ -f Makefile ] && $(MAKE) -f Makefile realclean | ||||
|  | ||||
| distclean maintainer-clean: clean | ||||
| 	rm -f GNUmakefile | ||||
|  | ||||
|  | ||||
| .PHONY: all install clean distclean maintainer-clean libpq-all libpq-install | ||||
| @@ -1,6 +1,6 @@ | ||||
| #------------------------------------------------------- | ||||
| # | ||||
| # $Id: Makefile.PL,v 1.15 2000/04/23 04:26:32 tgl Exp $ | ||||
| # $Id: Makefile.PL,v 1.16 2000/06/10 18:01:56 petere Exp $ | ||||
| # | ||||
| # Copyright (c) 1997, 1998  Edmund Mergl | ||||
| # | ||||
| @@ -12,14 +12,14 @@ use strict; | ||||
|  | ||||
| my %opts; | ||||
|  | ||||
| if (! $ENV{POSTGRES_HOME}) { | ||||
| if (! $ENV{POSTGRES_LIB} || ! $ENV{POSTGRES_INCLUDE}) { | ||||
|  | ||||
|     # Check that we actually are inside the Postgres source tree | ||||
|     if (! -d "../libpq") { | ||||
| 	die | ||||
| "To install Pg separately from the Postgres distribution, | ||||
| you must set environment variable POSTGRES_HOME to point to | ||||
| where Postgres is installed (often /usr/local/pgsql).\n"; | ||||
| "To install Pg separately from the Postgres distribution, you must | ||||
| set environment variables POSTGRES_LIB and POSTGRES_INCLUDE to point | ||||
| to where Postgres is installed (often /usr/local/pgsql/{lib,include}).\n"; | ||||
|     } | ||||
|  | ||||
|     # Setup for build/test inside a Postgres source tree | ||||
| @@ -44,9 +44,9 @@ where Postgres is installed (often /usr/local/pgsql).\n"; | ||||
|     %opts = ( | ||||
|         NAME         => 'Pg', | ||||
|         VERSION_FROM => 'Pg.pm', | ||||
|         INC          => "-I$ENV{POSTGRES_HOME}/include", | ||||
|         INC          => "-I$ENV{POSTGRES_INCLUDE}", | ||||
|         OBJECT       => "Pg\$(OBJ_EXT)", | ||||
|         LIBS         => ["-L$ENV{POSTGRES_HOME}/lib -lpq"], | ||||
|         LIBS         => ["-L$ENV{POSTGRES_LIB} -lpq"], | ||||
|     ); | ||||
| } | ||||
|  | ||||
| @@ -57,7 +57,7 @@ WriteMakefile(%opts); | ||||
| sub MY::installbin {  | ||||
|  | ||||
| q[ | ||||
| # Create a target that interfaces/Makefile can use to | ||||
| # Create a target that can be used to | ||||
| # determine the Perl install directory. | ||||
| echo-installdir: | ||||
| 	@echo $(INSTALLSITELIB) | ||||
|   | ||||
							
								
								
									
										74
									
								
								src/interfaces/python/GNUmakefile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								src/interfaces/python/GNUmakefile.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| #------------------------------------------------------------------- | ||||
| # | ||||
| # Makefile for src/interfaces/python, a.k.a. "PyGreSQL" | ||||
| # | ||||
| # Written by Peter Eisentraut  <peter_e@gmx.net> | ||||
| # | ||||
| # $Header: /cvsroot/pgsql/src/interfaces/python/Attic/GNUmakefile.in,v 1.1 2000/06/10 18:02:00 petere Exp $ | ||||
| # | ||||
| #------------------------------------------------------------------- | ||||
|  | ||||
| srcdir = @srcdir@ | ||||
| VPATH = @srcdir@ | ||||
|  | ||||
| top_srcdir = @top_srcdir@ | ||||
| top_builddir = ../../.. | ||||
|  | ||||
|  | ||||
| prefix = @prefix@ | ||||
| exec_prefix = @exec_prefix@ | ||||
| libdir = @libdir@ | ||||
| includedir = @includedir@ | ||||
|  | ||||
| INSTALL = @INSTALL@ | ||||
| INSTALL_DATA = @INSTALL_DATA@ | ||||
|  | ||||
| LIBS = @LIBS@ | ||||
|  | ||||
| PYTHON = @PYTHON@ | ||||
| python_extmakefile = @python_extmakefile@ | ||||
| python_moduledir = @python_moduledir@ | ||||
|  | ||||
|  | ||||
| all: Makefile pgmodule.c libpq-all | ||||
| 	$(MAKE) -f Makefile | ||||
|  | ||||
| libpq-all: | ||||
| 	$(MAKE) -C $(top_builddir)/src/interfaces/libpq all | ||||
|  | ||||
| Makefile: Setup.in Makefile.pre.in | ||||
| 	$(MAKE) -f Makefile.pre.in boot srcdir=$(srcdir) VPATH=$(srcdir) | ||||
|  | ||||
| Makefile.pre.in: $(python_extmakefile) | ||||
| 	cp $< $@ | ||||
|  | ||||
| Setup.in: Setup.in.raw | ||||
| 	sed -e "s%__LIBPQ__%${top_srcdir}/src/interfaces/libpq%g" \ | ||||
| 	    -e "s%__EXTRA_LIBS__%${LIBS}%g" \ | ||||
| 	    -e "s%__INCLUDES__%${top_srcdir}/src/include%g" \ | ||||
| 	    < $< > $@ | ||||
|  | ||||
| install: all | ||||
| 	@echo "Installing Python module" | ||||
| 	@if ! ( $(INSTALL_DATA) pg.py $(python_moduledir) && \ | ||||
| 	    $(MAKE) -f Makefile install ); then \ | ||||
| 		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 "*****"; \ | ||||
| 	fi | ||||
|  | ||||
|  | ||||
| # Python sometimes has a different idea what exactly "clean" is. | ||||
|  | ||||
| clean: | ||||
| 	-[ -f Makefile ] && $(MAKE) -f Makefile clobber | ||||
| 	rm -f Makefile.pre.in Makefile Setup Setup.in | ||||
|  | ||||
| distclean maintainer-clean: clean | ||||
| 	rm -f GNUmakefile | ||||
|  | ||||
|  | ||||
| .PHONY: all libpq-all install clean distclean maintainer-clean | ||||
							
								
								
									
										3
									
								
								src/interfaces/python/Setup.in.raw
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/interfaces/python/Setup.in.raw
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| *shared* | ||||
|  | ||||
| _pg  pgmodule.c -I__LIBPQ__ -I__INCLUDES__ -L__LIBPQ__ -lpq __EXTRA_LIBS__ | ||||
| @@ -680,7 +680,7 @@ static char connect__doc__[] = | ||||
| static PyObject * | ||||
| pgconnect(pgobject * self, PyObject * args, PyObject * dict) | ||||
| { | ||||
| 	static const char *kwlist[] = {"dbname", "host", "port", "opt", | ||||
| 	static char *kwlist[] = {"dbname", "host", "port", "opt", | ||||
| 	"tty", "user", "passwd", NULL}; | ||||
| 	char	   *pghost, | ||||
| 			   *pgopt, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user