Skip site navigation (1) Skip section navigation (2)

Re: perl install problem with pg7.1

From: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
To: achim(at)gentoo(dot)org
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: perl install problem with pg7.1
Date: 2001-04-17 16:10:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Achim Gottinger wrote:
> If I try to install postgress7.1 in a temporary directory using $DESTDIR
> it fails with the
> following message:
> *****
> * Skipping the installation of the Perl module for lack of permissions.
> * To install it, change to the directory
> /mnt/cdrom/tmp/portage/postgresql-7.1/work/postgresql-7.1/src/interfaces/perl5,
> * become the appropriate user, and do `make install'.
> *****

The perl build doesn't directly support DESTDIR.  If you know anything
at all about RPM spec files, see the build procedure in the Source RPM.

But, to make it easy, here's what I have to do in the RPM build:

First, I patch the GNUmakefile in the perl interfaces directory (while
the patch here is against 7.1beta4, it applies cleanly against the
released 7.1):
diff -uNr postgresql-7.1beta4.orig/src/interfaces/perl5/GNUmakefile
--- postgresql-7.1beta4.orig/src/interfaces/perl5/GNUmakefile	Thu Nov 16
19:08:57 2000
+++ postgresql-7.1beta4/src/interfaces/perl5/GNUmakefile	Mon Jan 29
00:00:31 2001
@@ -36,8 +36,8 @@
 install: Makefile
 	$(MAKE) -f Makefile clean
-	POSTGRES_LIB="$(libdir)" \
-	  POSTGRES_INCLUDE="$(includedir)" \
+	  POSTGRES_INCLUDE="$(RPM_BUILD_ROOT)$(includedir)" \
 	  $(PERL) $(srcdir)/Makefile.PL
 	$(MAKE) -f Makefile all
 	-(at)if [ -w "`$(MAKE) --quiet -f Makefile echo-installdir`" ]; then \
You will need to change the $RPM_BUILD_ROOT to $DESTDIR.

The spec file does the build in three stages.  Stage one is a standard
make all after the appropriate configure line -- this builds the
Makefile and runs a compile pass on the client -- it is actually
unnecessary, but the build system does it anyway as part of the main

Stage two is a make DESTDIR=$RPM_BUILD_ROOT install. This builds the Pg
module yet again -- but linked to in the right location this
time.  But the install stage fails, as you've seen. 

Stage three is rather funky, as it bypasses the GNUmakefile (which has
already done all it needs to do), as well as Makefile.PL, which is not
needed at all for the actual install. As stage two's build has built the
right Makefile, but passes the wrong values to it, thus the third
half-stage is needed to finish the install -- which is more than just
putting the right files in the right location. Here's the relevant
section of the spec file that does the build stage three:

	make PREFIX=$RPM_BUILD_ROOT/usr -C src/interfaces/perl5 -f Makefile

	# Get rid of the packing list generated by the perl Makefile, and build
my own...
	find $RPM_BUILD_ROOT/usr/lib/perl5 -name .packlist -exec rm -f {} \;
	find $RPM_BUILD_ROOT/usr/lib/perl5 -type f -print | \
		sed -e "s|$RPM_BUILD_ROOT/|/|g"  | \
		sed -e "s|.*/man/.*|&\*|" > perlfiles.list
	find $RPM_BUILD_ROOT/usr/lib/perl5 -type d -name Pg -print | \
		sed -e "s|$RPM_BUILD_ROOT/|%dir /|g" >> perlfiles.list
	# check and fixup Pg manpage location....
	if [ ! -e $RPM_BUILD_ROOT%{_mandir}/man3/Pg.* ]
		mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3
		cp `find $RPM_BUILD_ROOT -name 'Pg.3*' -print`
	pushd src/interfaces
	mkdir -p $RPM_BUILD_ROOT/usr/share/pgsql/perl5
	cp -a perl5/ $RPM_BUILD_ROOT/usr/share/pgsql/perl5
	# remove perllocal.pod and from the file list - only occurs with

	perl -pi -e "s/^.*perllocal.pod$//" perlfiles.list
	perl -pi -e "s/^.*$//" perlfiles.list
	mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/site_perl/%{_arch}-linux/auto/Pg


It  took quite a bit of time to get that to work right with more than
one version of perl (and the work of more people than just me -- Thomas
Lockhart and Trond Eivind Glomsrød both had big parts of getting it
right), but if someone else can use it, it will make it more
worthwhile.  Don't let the %{} rpm macros throw you -- substitute the
appropriate locations for your situation.
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

In response to

pgsql-interfaces by date

Next:From: Lonnie CumberlandDate: 2001-04-17 22:18:10
Subject: VARDATA strangness!!!
Previous:From: Peter EisentrautDate: 2001-04-17 15:58:08
Subject: Re: perl install problem with pg7.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group