Re: perl install problem with pg7.1 - Mailing list pgsql-interfaces

From Lamar Owen
Subject Re: perl install problem with pg7.1
Date
Msg-id 3ADC6AE1.D56B8C4B@wgcr.org
Whole thread Raw
In response to perl install problem with pg7.1  (AGottinger@t-online.de (Achim Gottinger))
List 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/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_LIB="$(RPM_BUILD_ROOT)$(libdir)" \
+      POSTGRES_INCLUDE="$(RPM_BUILD_ROOT)$(includedir)" \      $(PERL) $(srcdir)/Makefile.PL    $(MAKE) -f Makefile
all   -@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
build.  

Stage two is a make DESTDIR=$RPM_BUILD_ROOT install. This builds the Pg
module yet again -- but linked to libpq.so 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
install
# 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.listfind
$RPM_BUILD_ROOT/usr/lib/perl5-type d -name Pg -print | \    sed -e "s|$RPM_BUILD_ROOT/|%dir /|g" >> perlfiles.list#
checkand fixup Pg manpage location....if [ ! -e $RPM_BUILD_ROOT%{_mandir}/man3/Pg.* ]then    mkdir -p
$RPM_BUILD_ROOT%{_mandir}/man3   cp `find $RPM_BUILD_ROOT -name 'Pg.3*' -print`
 
$RPM_BUILD_ROOT%{_mandir}/man3fipushd src/interfacesmkdir -p $RPM_BUILD_ROOT/usr/share/pgsql/perl5cp -a perl5/test.pl
$RPM_BUILD_ROOT/usr/share/pgsql/perl5popd#remove perllocal.pod and Pg.bs from the file list - only occurs with
 
5.6
perl -pi -e "s/^.*perllocal.pod$//" perlfiles.listperl -pi -e "s/^.*Pg.bs$//" perlfiles.listmkdir -p
$RPM_BUILD_ROOT/usr/lib/perl5/site_perl/%{_arch}-linux/auto/Pg
------------------

Whew!

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


pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] drastic reduction in speed of inserts as the table grows
Next
From: Rini Dutta
Date:
Subject: Another qs Re: [GENERAL] drastic reduction in speed of inserts as the table grows