Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 34fd508

Browse files
committed
VPATH and DESTDIR support for PL/Perl, using the same techniques employed
in interfaces/perl5 a brief while ago. Also, since building PL/Perl without a shared libperl actually works on some platforms we can enable it there to get some development happening. I've only checked off linux right now, but others should be added in the future.
1 parent ef7152f commit 34fd508

File tree

3 files changed

+53
-21
lines changed

3 files changed

+53
-21
lines changed

src/makefiles/Makefile.linux

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ AROPT = crs
22
export_dynamic = -export-dynamic
33
rpath = -Wl,-rpath,$(libdir)
44
shlib_symbolic = -Wl,-Bsymbolic
5+
allow_nonpic_in_shlib = yes
56
DLSUFFIX = .so
67
CFLAGS_SL = -fpic
78

src/pl/plperl/GNUmakefile

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
# $Header: /cvsroot/pgsql/src/pl/plperl/GNUmakefile,v 1.6 2000/11/02 18:40:13 petere Exp $
1+
# $Header: /cvsroot/pgsql/src/pl/plperl/GNUmakefile,v 1.7 2001/08/26 23:54:41 petere Exp $
22

33
subdir = src/pl/plperl
44
top_builddir = ../../..
55
include $(top_builddir)/src/Makefile.global
66

7-
plperl_installdir = $(DESTDIR)$(libdir)
7+
ifeq ($(allow_nonpic_in_shlib),yes)
8+
makefile_pl_flags = --force
9+
endif
810

911

1012
all: Makefile
11-
$(MAKE) -f $< all
13+
$(MAKE) -f $< all VPATH=$(VPATH)
1214

1315
Makefile: Makefile.PL
14-
plperl_installdir='$(plperl_installdir)' \
15-
EXTRA_INCLUDES='$(filter -I%, $(CPPFLAGS))' \
16-
$(PERL) $<
16+
plperl_installdir='$$(DESTDIR)$(libdir)' \
17+
$(PERL) $< $(makefile_pl_flags) INC='-I$(srcdir) $(filter -I%, $(CPPFLAGS))'
1718

1819
install: all installdirs
19-
$(MAKE) -f Makefile install
20+
$(MAKE) -f Makefile install DESTDIR='$(DESTDIR)'
2021

2122
installdirs:
22-
$(mkinstalldirs) $(DESTDIR)$(plperl_installdir)
23+
$(mkinstalldirs) $(DESTDIR)$(libdir)
2324

2425
uninstall:
2526
rm -f $(DESTDIR)$(libdir)/plperl$(DLSUFFIX)

src/pl/plperl/Makefile.PL

+43-13
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ use ExtUtils::Embed;
33
use DynaLoader;
44
use Config;
55

6-
#
7-
# Can't build a shared plperl unless libperl is shared too.
8-
# (Actually, it would be enough if code in libperl.a is compiled
9-
# to be position-independent, but that is hard to check for and
10-
# seems pretty unlikely anyway.)
11-
#
12-
if ($Config{'useshrplib'} ne 'true') {
6+
# On some platforms you can't build plperl unless libperl is a shared
7+
# library. (Actually, it would be enough if code in libperl.a is
8+
# compiled to be position-independent, but that is hard to check for
9+
# and seems pretty unlikely anyway.) On some platforms it doesn't
10+
# matter and they can pass in the --force flag to build anyway.
11+
# (Having a shared libperl is still a lot better for efficiency,
12+
# though.)
13+
14+
if ($Config{'useshrplib'} ne 'true' && $ARGV[0] ne '--force') {
1315
open(OUT, ">Makefile") or die "Can't write Makefile: $!\n";
1416
print OUT <<'EndOfMakefile';
1517
# Dummy Makefile for use when we can't build plperl
1618
17-
all install:
18-
@echo "*****"; \
19-
echo "* Cannot build PL/Perl because libperl is not a shared library." ; \
20-
echo "* Skipped."; \
21-
echo "*****"
19+
all:
20+
@echo ""; \
21+
echo "*** Cannot build PL/Perl because libperl is not a shared library." ; \
22+
echo "*** You might have to rebuild your Perl installation. Refer to"; \
23+
echo "*** the documentation for details."; \
24+
echo ""
2225
26+
install:
2327
2428
clean realclean:
2529
rm -f Makefile
@@ -34,7 +38,6 @@ $ldopts=~s/$Config{ccdlflags}//;
3438

3539
WriteMakefile( 'NAME' => 'plperl',
3640
dynamic_lib => { 'OTHERLDFLAGS' => $ldopts } ,
37-
INC => "$ENV{EXTRA_INCLUDES}",
3841
XS => { 'SPI.xs' => 'SPI.c' },
3942
OBJECT => 'plperl.o eloglvl.o SPI.o',
4043
);
@@ -66,3 +69,30 @@ install :: all
6669
];
6770

6871
}
72+
73+
74+
sub MY::xs_o {
75+
'';
76+
}
77+
78+
sub MY::makefile {
79+
'';
80+
}
81+
82+
# VPATH-aware version of this rule
83+
sub MY::xs_c {
84+
my($self) = shift;
85+
return '' unless $self->needs_linking();
86+
'
87+
.xs.c:
88+
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $< > $@
89+
';
90+
}
91+
92+
# somebody doesn't know how to write make rules...
93+
sub MY::c_o {
94+
package MY; # so that "SUPER" works right
95+
my $inherited = shift->SUPER::c_o(@_);
96+
$inherited =~ s/\$\*\.\S+/\$\</g;
97+
$inherited;
98+
}

0 commit comments

Comments
 (0)