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.
This commit is contained in:
parent
ef7152f99b
commit
34fd50880f
@ -2,6 +2,7 @@ AROPT = crs
|
|||||||
export_dynamic = -export-dynamic
|
export_dynamic = -export-dynamic
|
||||||
rpath = -Wl,-rpath,$(libdir)
|
rpath = -Wl,-rpath,$(libdir)
|
||||||
shlib_symbolic = -Wl,-Bsymbolic
|
shlib_symbolic = -Wl,-Bsymbolic
|
||||||
|
allow_nonpic_in_shlib = yes
|
||||||
DLSUFFIX = .so
|
DLSUFFIX = .so
|
||||||
CFLAGS_SL = -fpic
|
CFLAGS_SL = -fpic
|
||||||
|
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
# $Header: /cvsroot/pgsql/src/pl/plperl/GNUmakefile,v 1.6 2000/11/02 18:40:13 petere Exp $
|
# $Header: /cvsroot/pgsql/src/pl/plperl/GNUmakefile,v 1.7 2001/08/26 23:54:41 petere Exp $
|
||||||
|
|
||||||
subdir = src/pl/plperl
|
subdir = src/pl/plperl
|
||||||
top_builddir = ../../..
|
top_builddir = ../../..
|
||||||
include $(top_builddir)/src/Makefile.global
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
plperl_installdir = $(DESTDIR)$(libdir)
|
ifeq ($(allow_nonpic_in_shlib),yes)
|
||||||
|
makefile_pl_flags = --force
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
all: Makefile
|
all: Makefile
|
||||||
$(MAKE) -f $< all
|
$(MAKE) -f $< all VPATH=$(VPATH)
|
||||||
|
|
||||||
Makefile: Makefile.PL
|
Makefile: Makefile.PL
|
||||||
plperl_installdir='$(plperl_installdir)' \
|
plperl_installdir='$$(DESTDIR)$(libdir)' \
|
||||||
EXTRA_INCLUDES='$(filter -I%, $(CPPFLAGS))' \
|
$(PERL) $< $(makefile_pl_flags) INC='-I$(srcdir) $(filter -I%, $(CPPFLAGS))'
|
||||||
$(PERL) $<
|
|
||||||
|
|
||||||
install: all installdirs
|
install: all installdirs
|
||||||
$(MAKE) -f Makefile install
|
$(MAKE) -f Makefile install DESTDIR='$(DESTDIR)'
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
$(mkinstalldirs) $(DESTDIR)$(plperl_installdir)
|
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(libdir)/plperl$(DLSUFFIX)
|
rm -f $(DESTDIR)$(libdir)/plperl$(DLSUFFIX)
|
||||||
|
@ -3,23 +3,27 @@ use ExtUtils::Embed;
|
|||||||
use DynaLoader;
|
use DynaLoader;
|
||||||
use Config;
|
use Config;
|
||||||
|
|
||||||
#
|
# On some platforms you can't build plperl unless libperl is a shared
|
||||||
# Can't build a shared plperl unless libperl is shared too.
|
# library. (Actually, it would be enough if code in libperl.a is
|
||||||
# (Actually, it would be enough if code in libperl.a is compiled
|
# compiled to be position-independent, but that is hard to check for
|
||||||
# to be position-independent, but that is hard to check for and
|
# and seems pretty unlikely anyway.) On some platforms it doesn't
|
||||||
# seems pretty unlikely anyway.)
|
# matter and they can pass in the --force flag to build anyway.
|
||||||
#
|
# (Having a shared libperl is still a lot better for efficiency,
|
||||||
if ($Config{'useshrplib'} ne 'true') {
|
# though.)
|
||||||
|
|
||||||
|
if ($Config{'useshrplib'} ne 'true' && $ARGV[0] ne '--force') {
|
||||||
open(OUT, ">Makefile") or die "Can't write Makefile: $!\n";
|
open(OUT, ">Makefile") or die "Can't write Makefile: $!\n";
|
||||||
print OUT <<'EndOfMakefile';
|
print OUT <<'EndOfMakefile';
|
||||||
# Dummy Makefile for use when we can't build plperl
|
# Dummy Makefile for use when we can't build plperl
|
||||||
|
|
||||||
all install:
|
all:
|
||||||
@echo "*****"; \
|
@echo ""; \
|
||||||
echo "* Cannot build PL/Perl because libperl is not a shared library." ; \
|
echo "*** Cannot build PL/Perl because libperl is not a shared library." ; \
|
||||||
echo "* Skipped."; \
|
echo "*** You might have to rebuild your Perl installation. Refer to"; \
|
||||||
echo "*****"
|
echo "*** the documentation for details."; \
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
install:
|
||||||
|
|
||||||
clean realclean:
|
clean realclean:
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
@ -34,7 +38,6 @@ $ldopts=~s/$Config{ccdlflags}//;
|
|||||||
|
|
||||||
WriteMakefile( 'NAME' => 'plperl',
|
WriteMakefile( 'NAME' => 'plperl',
|
||||||
dynamic_lib => { 'OTHERLDFLAGS' => $ldopts } ,
|
dynamic_lib => { 'OTHERLDFLAGS' => $ldopts } ,
|
||||||
INC => "$ENV{EXTRA_INCLUDES}",
|
|
||||||
XS => { 'SPI.xs' => 'SPI.c' },
|
XS => { 'SPI.xs' => 'SPI.c' },
|
||||||
OBJECT => 'plperl.o eloglvl.o SPI.o',
|
OBJECT => 'plperl.o eloglvl.o SPI.o',
|
||||||
);
|
);
|
||||||
@ -66,3 +69,30 @@ install :: all
|
|||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub MY::xs_o {
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub MY::makefile {
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# VPATH-aware version of this rule
|
||||||
|
sub MY::xs_c {
|
||||||
|
my($self) = shift;
|
||||||
|
return '' unless $self->needs_linking();
|
||||||
|
'
|
||||||
|
.xs.c:
|
||||||
|
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $< > $@
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
# somebody doesn't know how to write make rules...
|
||||||
|
sub MY::c_o {
|
||||||
|
package MY; # so that "SUPER" works right
|
||||||
|
my $inherited = shift->SUPER::c_o(@_);
|
||||||
|
$inherited =~ s/\$\*\.\S+/\$\</g;
|
||||||
|
$inherited;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user