1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Change PL/Perl and Pg interface build to use configured compiler and

Makefile.shlib system, not MakeMaker.
This commit is contained in:
Peter Eisentraut
2002-05-28 16:57:53 +00:00
parent de1f586f09
commit 7662419f1b
7 changed files with 163 additions and 193 deletions

View File

@@ -1,24 +1,43 @@
# $Header: /cvsroot/pgsql/src/pl/plperl/GNUmakefile,v 1.9 2002/02/23 21:49:10 momjian Exp $
# Makefile for PL/Perl
# $Header: /cvsroot/pgsql/src/pl/plperl/GNUmakefile,v 1.10 2002/05/28 16:57:53 petere Exp $
subdir = src/pl/plperl
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
ifeq ($(allow_nonpic_in_shlib),yes)
makefile_pl_flags = --force
ifeq ($(perl_useshrplib),true)
shared_libperl = yes
endif
# If we don't have a shared library and the platform doesn't allow it
# to work without, we have to skip it.
ifneq (,$(findstring yes, $(shared_libperl)$(allow_nonpic_in_shlib)))
all: Makefile
$(MAKE) -f $< all VPATH=$(VPATH)
# The code isn't clean with regard to these warnings.
ifeq ($(GCC),yes)
override CFLAGS := $(filter-out -Wall -Wmissing-declarations -Wmissing-prototypes, $(CFLAGS))
endif
Makefile: Makefile.PL
plperl_installdir='$$(DESTDIR)$(pkglibdir)' \
$(PERL) $< $(makefile_pl_flags) LIBS='$(BE_DLLLIBS)' \
INC='-I$(srcdir) $(filter -I%, $(CPPFLAGS))'
override CPPFLAGS := -I$(srcdir) -I$(perl_archlibexp)/CORE $(CPPFLAGS)
NAME = plperl
SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 0
OBJS = plperl.o eloglvl.o SPI.o
SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
include $(top_srcdir)/src/Makefile.shlib
all: all-lib
SPI.c: SPI.xs
$(PERL) $(perl_privlibexp)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@
install: all installdirs
$(MAKE) -f Makefile install DESTDIR='$(DESTDIR)'
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
@@ -26,6 +45,16 @@ installdirs:
uninstall:
rm -f $(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)
clean distclean maintainer-clean:
-[ -f Makefile ] && $(MAKE) -f Makefile clean
rm -f Makefile Makefile.old
clean distclean maintainer-clean: clean-lib
rm -f SPI.c $(OBJS)
else # can't build
all:
@echo ""; \
echo "*** Cannot build PL/Perl because libperl is not a shared library."; \
echo "*** You might have to rebuild your Perl installation. Refer to"; \
echo "*** the documentation for details."; \
echo ""
endif # can't build

View File

@@ -1,98 +0,0 @@
use ExtUtils::MakeMaker;
use ExtUtils::Embed;
use DynaLoader;
use Config;
# On some platforms you can't build plperl unless libperl is a shared
# library. (Actually, it would be enough if code in libperl.a is
# compiled to be position-independent, but that is hard to check for
# and seems pretty unlikely anyway.) On some platforms it doesn't
# matter and they can pass in the --force flag to build anyway.
# (Having a shared libperl is still a lot better for efficiency,
# though.)
if ($Config{'useshrplib'} ne 'true' && $ARGV[0] ne '--force') {
open(OUT, ">Makefile") or die "Can't write Makefile: $!\n";
print OUT <<'EndOfMakefile';
# Dummy Makefile for use when we can't build plperl
all:
@echo ""; \
echo "*** Cannot build PL/Perl because libperl is not a shared library." ; \
echo "*** You might have to rebuild your Perl installation. Refer to"; \
echo "*** the documentation for details."; \
echo ""
install:
clean realclean:
rm -f Makefile
EndOfMakefile
close(OUT);
exit(0);
}
my $ldopts=ldopts();
$ldopts=~s/$Config{ccdlflags}//;
WriteMakefile( 'NAME' => 'plperl',
dynamic_lib => { 'OTHERLDFLAGS' => $ldopts } ,
XS => { 'SPI.xs' => 'SPI.c' },
OBJECT => 'plperl.o eloglvl.o SPI.o',
);
sub MY::cflags {
package MY; # so that "SUPER" works right
my $inherited = shift->SUPER::cflags(@_);
#
# Hack for building on HPUX (probably should have a general mechanism
# for system-specific hints, but for now ...)
# The default compiler and flags on this platform is cc -Aa, which
# will reject 'long long' declarations that appear in Postgres headers.
# Need to select -Ae instead.
#
if ($Config::Config{'osname'} eq 'hpux') {
$inherited =~ s/-Aa/-Ae/;
}
$inherited;
}
sub MY::install {
qq[
install :: all
cp \$(INST_DYNAMIC) $ENV{plperl_installdir}
];
}
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;
}