Re: [HACKERS] perl interface bug?
От | Brook Milligan |
---|---|
Тема | Re: [HACKERS] perl interface bug? |
Дата | |
Msg-id | 199810151828.MAA13870@trillium.nmsu.edu обсуждение исходный текст |
Ответ на | Re: [HACKERS] perl interface bug? (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [HACKERS] perl interface bug?
|
Список | pgsql-hackers |
Edmund is thinking of a different situation. The perl5 interface is also a "Perl module", which means that it is supposed to build and install under very rigid rules --- this is supposed to work: perl Makefile.PL make make test make install Ok, I see now. So, we need the following: - a Makefile.PL that works out of the box for the above sequence, given that POSTGRES_HOME is set properly. - a Makefile.PL that works with the Postgres installation and gets the right shared library, so if we run `make test' later (or use the interface in any way) it works immediately upon Postgres installation. A solution: - a default Makefile.PL that works - a Makefile.PL replaced from Makefile.PL.in that still works with the above, but satisfies the second criterion. The patches below do this and I think satisfy all considerations (you'll let me know if they don't, right? :) - Makefile.PL has an explanation and if POSTGRES_HOME is not set will print a useful message. - Makefile.PL.in replaces that message with the right thing for finding the installed shared library based on configure. - Makefile: same as before; do the clean before installing to pick up the right shared library. Note that no clean is done for any other targets. - configure.in: output Makefile.PL along with the rest. Note also, that in the current version $WHOAMI is never set so the perl test always fails. Perhaps this should be fixed by setting the variable correctly, but in any case the comments no longer agree with this stuff anyway. Cheers, Brook =========================================================================== --- Makefile.PL.orig Thu Oct 15 11:13:55 1998 +++ Makefile.PL Thu Oct 15 12:16:33 1998 @@ -1,4 +1,3 @@ -# Generated automatically from Makefile.PL.in by configure. #------------------------------------------------------- # # $Id: Makefile.PL,v 1.9 1998/09/27 19:12:21 mergl Exp $ @@ -11,29 +10,25 @@ use Config; use strict; -# because the perl5 interface is always contained in the source tree, -# we can be sure about the location of the include files and libs. -# For development and testing we still test for POSTGRES_HOME. -# -#print "\nConfiguring Pg\n"; -#print "Remember to actually read the README file !\n"; -#die "\nYou didn't read the README file !\n" unless ($] >= 5.002); -# -#if (! $ENV{POSTGRES_HOME}) { -# warn "\$POSTGRES_HOME not defined. Searching for PostgreSQL...\n"; -# foreach(qw(../../../ /usr/local/pgsql /usr/pgsql /home/pgsql /opt/pgsql /usr/local/postgres /usr/postgres /home/postgres/opt/postgres)) { -# if (-d "$_/lib") { -# $ENV{POSTGRES_HOME} = $_; -# last; -# } -# } -#} -# -#if (-d "$ENV{POSTGRES_HOME}/lib") { -# print "Found PostgreSQL in $ENV{POSTGRES_HOME}\n"; -#} else { -# die "Unable to determine PostgreSQL\n"; -#} +# This Makefile.PL is intended for standalone use when PostgreSQL is +# already installed. In that case, install the perl module as follows: +# +# setenv POSTGRES_HOME /path/to/root/of/installed/postgres +# perl Makefile.PL +# make +# make test +# make install + +# During normal installation of PostgreSQL, this file will be replaced +# by one derived from Makefile.PL.in so that the installed shared +# library libpq.so will be found during installation of this module. +# As a result, the POSTGRES_HOME environment variable need not be set +# during PostgreSQL installation. Note that ../Makefile takes care of +# the `perl Makefile.PL' command. Note also that it is still possible +# to follow the standalone installation procedure, even after +# configuring and installing PostgreSQL, because the `else' +# conditional branch below is identical in both Makefile.PL and +# Makefile.PL.in. my %opts; @@ -42,13 +37,16 @@ my $cwd = `pwd`; chop $cwd; - %opts = ( - NAME => 'Pg', - VERSION_FROM => 'Pg.pm', - INC => "-I$cwd/../libpq -I$cwd/../../include", - OBJECT => "Pg\$(OBJ_EXT)", - LIBS => ["-L/usr/pkg/pgsql/lib -L$cwd/../libpq -lpq"], - ); + print "To install the perl interface for PostgreSQL do the following:\n"; + print " - install PostgreSQL\n"; + print " - set the POSTGRES_HOME environment variable appropriately\n"; + print " - in this directory ($cwd):\n"; + print " perl Makefile.PL\n"; + print " make\n"; + print " make test [ with a postmaster running ]\n"; + print " make install\n"; + + exit(1); } else { =========================================================================== --- interfaces/perl5/Makefile.PL.in.orig Thu Oct 15 11:09:15 1998 +++ interfaces/perl5/Makefile.PL.in Thu Oct 15 11:57:17 1998 @@ -0,0 +1,44 @@ +#------------------------------------------------------- +# +# $Id: Makefile.PL,v 1.9 1998/09/27 19:12:21 mergl Exp $ +# +# Copyright (c) 1997, 1998 Edmund Mergl +# +#------------------------------------------------------- + +use ExtUtils::MakeMaker; +use Config; +use strict; + +my %opts; + +if (! $ENV{POSTGRES_HOME}) { + + my $cwd = `pwd`; + chop $cwd; + + %opts = ( + NAME => 'Pg', + VERSION_FROM => 'Pg.pm', + INC => "-I$cwd/../libpq -I$cwd/../../include", + OBJECT => "Pg\$(OBJ_EXT)", + LIBS => ["-L@prefix@/lib -L$cwd/../libpq -lpq"], + ); + +} else { + + %opts = ( + NAME => 'Pg', + VERSION_FROM => 'Pg.pm', + INC => "-I$ENV{POSTGRES_HOME}/include", + OBJECT => "Pg\$(OBJ_EXT)", + LIBS => ["-L$ENV{POSTGRES_HOME}/lib -lpq"], + ); +} + + +WriteMakefile(%opts); + +exit(0); + +# end of Makefile.PL =========================================================================== --- interfaces/Makefile.orig Wed Oct 7 01:00:23 1998 +++ interfaces/Makefile Tue Oct 13 16:29:16 1998 @@ -15,13 +15,11 @@ include $(SRCDIR)/Makefile.global -perl-makefile-dep := -ifeq ($(USE_PERL), true) - perl-makefile-dep := perl5/Makefile -endif +PERL_CLEAN := DO_NOTHING +install: PERL_CLEAN := clean -.DEFAULT all install clean dep depend distclean: $(perl-makefile-dep) +.DEFAULT all install clean dep depend distclean: $(MAKE) -C libpq $@ $(MAKE) -C ecpg $@ ifeq ($(HAVE_Cplusplus), true) @@ -33,6 +31,8 @@ $(MAKE) -C libpgtcl $@ endif ifeq ($(USE_PERL), true) + -$(MAKE) -C perl5 $(PERL_CLEAN) + $(MAKE) perl5/Makefile $(MAKE) -C perl5 $@ endif ifeq ($(USE_ODBC), true) =========================================================================== --- configure.in.orig Thu Oct 15 01:00:20 1998 +++ configure.in Thu Oct 15 11:54:09 1998 @@ -266,17 +266,6 @@ [ USE_PERL=false; AC_MSG_RESULT(disabled) ] ) -#dnl Verify that postgres is already installed -#dnl per instructions for perl interface installation -if test "$USE_PERL" = "true" -then - if test "$WHOAMI" != "root" - then AC_MSG_WARN(perl support disabled; must be root to install) - USE_PERL= - fi -fi -export USE_PERL - dnl We include odbc support unless we disable it with --with-odbc=false AC_MSG_CHECKING(setting USE_ODBC) AC_ARG_WITH( @@ -917,6 +906,7 @@ interfaces/libpgtcl/Makefile interfaces/odbc/GNUmakefile interfaces/odbc/Makefile.global + interfaces/perl5/Makefile.PL pl/plpgsql/src/Makefile pl/plpgsql/src/mklang.sql pl/tcl/mkMakefile.tcldefs.sh
В списке pgsql-hackers по дате отправления: