The Perl build (PL/Perl and the Pg interface) now use the configured
compiler and flags and none of the MakeMaker stuff.  (I've kept the
interfaces/perl5/Makefile.PL file in case someone wants to resurrect it
for a Win32 build, for instance.)  Since doing Perl builds without
MakeMaker is poorly documented I've reverse-engineered much of this from
the MakeMaker source code.  It works here, but if it doesn't work
somewhere, please let me know.

-- 
Peter Eisentraut   peter_e@gmx.net


Tue, 28 May 2002 18:57:08 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Perl build fix attempted
Peter Eisentraut <peter_e@gmx.net> writes:
> The Perl build (PL/Perl and the Pg interface) now use the configured
> compiler and flags and none of the MakeMaker stuff.  (I've kept the
> interfaces/perl5/Makefile.PL file in case someone wants to resurrect it
> for a Win32 build, for instance.)  Since doing Perl builds without
> MakeMaker is poorly documented I've reverse-engineered much of this from
> the MakeMaker source code.  It works here, but if it doesn't work
> somewhere, please let me know.

On HPUX 10.20, using perl 5.6.1, plperl builds without complaint but
SIGSEGV's upon use.  AFAIR this worked last time I tried it; any idea
what you might have changed?

			regards, tom lane

Thu, 30 May 2002 19:55:46 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Perl build fix attempted 
Tom Lane writes:

> On HPUX 10.20, using perl 5.6.1, plperl builds without complaint but
> SIGSEGV's upon use.  AFAIR this worked last time I tried it; any idea
> what you might have changed?

I have written it so that the commands that are executed during the build
should be the same.  Can you send me the build output from current and
from before the change (7.2 should work), and the generated Makefile from
before the change?

I suspect that the linkage is wrong now, possibly a PIC problem.

-- 
Peter Eisentraut   peter_e@gmx.net


Sat, 1 Jun 2002 17:57:50 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: Perl build fix attempted 
Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> On HPUX 10.20, using perl 5.6.1, plperl builds without complaint but
>> SIGSEGV's upon use.  AFAIR this worked last time I tried it; any idea
>> what you might have changed?

> I have written it so that the commands that are executed during the build
> should be the same.  Can you send me the build output from current and
> from before the change (7.2 should work), and the generated Makefile from
> before the change?

Attached.  However, I have just found that in fact the 7.2 build does
not work either :-( ... which is peculiar, because it worked fine in
January.  (I think.  It could be that I tested the changes I made in
January on a different machine --- can't recall for sure.  I am pretty
sure that I tested plperl on this machine last June.)

I am suspicious of the -D symbols that were used before and are not
being supplied now.  (A less appetizing prospect is that gcc code just
plain won't interoperate with cc-generated code.)  The perl installation
is vanilla 5.6.1 configuration except for requesting that a shared
libperl be built.

			regards, tom lane


Current sources "make" log:

make[3]: Entering directory `/home/postgres/pgsql/src/pl/plperl'
gcc -O1 -g -fPIC -I. -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -I../../../src/include   -c -o plperl.o plperl.c
gcc -O1 -g -fPIC -I. -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -I../../../src/include   -c -o eloglvl.o eloglvl.c
/opt/perl5.6.1/bin/perl /opt/perl5.6.1/lib/5.6.1/ExtUtils/xsubpp -typemap /opt/perl5.6.1/lib/5.6.1/ExtUtils/typemap SPI.xs >SPI.c
gcc -O1 -g -fPIC -I. -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -I../../../src/include   -c -o SPI.o SPI.c
ar crs libplperl.a `lorder plperl.o eloglvl.o SPI.o | tsort`
ranlib libplperl.a
/usr/ccs/bin/ld -b +b /home/postgres/testversion/lib plperl.o eloglvl.o SPI.o  -L/usr/local/lib /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -lperl -lnsl_s -ldld -lm -lc -lndir -lcrypt -lsec   -o libplperl.sl
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/auto/DynaLoader/DynaLoader.a(DynaLoader.o)) was detected. The linked output may not run on a PA 1.x system.
rm -f libplperl.sl.0
ln -s libplperl.sl libplperl.sl.0
make[3]: Leaving directory `/home/postgres/pgsql/src/pl/plperl'

REL7_2 "make" log:

make[3]: Entering directory `/home/postgres/REL7_2/pgsql/src/pl/plperl'
plperl_installdir='$(DESTDIR)/home/postgres/version72/lib' \
/opt/perl5.6.1/bin/perl Makefile.PL  INC='-I. -I../../../src/include'
Writing Makefile for plperl
make -f Makefile all VPATH=
make[4]: Entering directory `/home/postgres/REL7_2/pgsql/src/pl/plperl'
cc -c -I. -I../../../src/include -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O   -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" +z -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  plperl.c
cpp: "perl.h", line 2155: warning 2001: Redefinition of macro DEBUG.
cc: "plperl.c", line 244: warning 558: Empty declaration.
cc -c -I. -I../../../src/include -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O   -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" +z -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  eloglvl.c
/opt/perl5.6.1/bin/perl -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0 -I/opt/perl5.6.1/lib/5.6.1 /opt/perl5.6.1/lib/5.6.1/ExtUtils/xsubpp  -typemap /opt/perl5.6.1/lib/5.6.1/ExtUtils/typemap SPI.xs > SPI.c
cc -c -I. -I../../../src/include -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -O   -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" +z -I/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE  SPI.c
cpp: "perl.h", line 2155: warning 2001: Redefinition of macro DEBUG.
Running Mkbootstrap for plperl ()
chmod 644 plperl.bs
rm -f blib/arch/auto/plperl/plperl.sl
LD_RUN_PATH="" ld  -b +vnocompatwarnings -L/usr/local/lib plperl.o eloglvl.o SPI.o -L/usr/local/lib /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -lperl -lnsl_s -ldld -lm -lc -lndir -lcrypt -lsec -o blib/arch/auto/plperl/plperl.sl     
chmod 755 blib/arch/auto/plperl/plperl.sl
cp plperl.bs blib/arch/auto/plperl/plperl.bs
chmod 644 blib/arch/auto/plperl/plperl.bs
make[4]: Leaving directory `/home/postgres/REL7_2/pgsql/src/pl/plperl'
make[3]: Leaving directory `/home/postgres/REL7_2/pgsql/src/pl/plperl'

REL7_2 generated Makefile:

# This Makefile is for the plperl extension to perl.
#
# It was generated automatically by MakeMaker version
# 5.45 (Revision: 1.222) from the contents of
# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
#
#	ANY CHANGES MADE HERE WILL BE LOST!
#
#   MakeMaker ARGV: (q[INC=-I. -I../../../src/include])
#
#   MakeMaker Parameters:

#	NAME => q[plperl]
#	OBJECT => q[plperl.o eloglvl.o SPI.o]
#	XS => { SPI.xs=>q[SPI.c] }
#	dynamic_lib => { OTHERLDFLAGS=>q[  -L/usr/local/lib /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -lperl -lnsl_s -ldld -lm -lc -lndir -lcrypt -lsec ] }

# --- MakeMaker post_initialize section:


# --- MakeMaker const_config section:

# These definitions are from config.sh (via /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/Config.pm)

# They may have been overridden via Makefile.PL or on the command line
AR = ar
CC = cc
CCCDLFLAGS = +z
CCDLFLAGS = -Wl,-E -Wl,-B,deferred 
DLEXT = sl
DLSRC = dl_hpux.xs
LD = ld
LDDLFLAGS = -b +vnocompatwarnings -L/usr/local/lib
LDFLAGS =  -L/usr/local/lib
LIBC = /lib/libc.sl
LIB_EXT = .a
OBJ_EXT = .o
OSNAME = hpux
OSVERS = 10.20
RANLIB = :
SO = sl
EXE_EXT = 
FULL_AR = /usr/bin/ar


# --- MakeMaker constants section:
AR_STATIC_ARGS = cr
NAME = plperl
DISTNAME = plperl
NAME_SYM = plperl
VERSION = 0.10
VERSION_SYM = 0_10
XS_VERSION = 0.10
INST_BIN = blib/bin
INST_EXE = blib/script
INST_LIB = blib/lib
INST_ARCHLIB = blib/arch
INST_SCRIPT = blib/script
PREFIX = /opt/perl5.6.1
INSTALLDIRS = site
INSTALLPRIVLIB = $(PREFIX)/lib/5.6.1
INSTALLARCHLIB = $(PREFIX)/lib/5.6.1/PA-RISC2.0
INSTALLSITELIB = $(PREFIX)/lib/site_perl/5.6.1
INSTALLSITEARCH = $(PREFIX)/lib/site_perl/5.6.1/PA-RISC2.0
INSTALLBIN = $(PREFIX)/bin
INSTALLSCRIPT = $(PREFIX)/bin
PERL_LIB = /opt/perl5.6.1/lib/5.6.1
PERL_ARCHLIB = /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0
SITELIBEXP = /opt/perl5.6.1/lib/site_perl/5.6.1
SITEARCHEXP = /opt/perl5.6.1/lib/site_perl/5.6.1/PA-RISC2.0
LIBPERL_A = libperl.a
FIRST_MAKEFILE = Makefile
MAKE_APERL_FILE = Makefile.aperl
PERLMAINCC = $(CC)
PERL_INC = /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE
PERL = /opt/perl5.6.1/bin/perl
FULLPERL = /opt/perl5.6.1/bin/perl
FULL_AR = /usr/bin/ar

VERSION_MACRO = VERSION
DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
XS_VERSION_MACRO = XS_VERSION
XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc

MAKEMAKER = /opt/perl5.6.1/lib/5.6.1/ExtUtils/MakeMaker.pm
MM_VERSION = 5.45

# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)  !!! Deprecated from MM 5.32  !!!
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
# DLBASE  = Basename part of dynamic library. May be just equal BASEEXT.
FULLEXT = plperl
BASEEXT = plperl
DLBASE = $(BASEEXT)
INC = -I. -I../../../src/include
OBJECT = plperl$(OBJ_EXT) eloglvl$(OBJ_EXT) SPI$(OBJ_EXT)
LDFROM = $(OBJECT)
LINKTYPE = dynamic

# Handy lists of source code files:
XS_FILES= SPI.xs
C_FILES = SPI.c \
	eloglvl.c \
	plperl.c
O_FILES = SPI.o \
	eloglvl.o \
	plperl.o
H_FILES = eloglvl.h \
	ppport.h
HTMLLIBPODS    = 
HTMLSCRIPTPODS = 
MAN1PODS = 
MAN3PODS = 
HTMLEXT = html
INST_MAN1DIR = blib/man1
INSTALLMAN1DIR = $(PREFIX)/man/man1
MAN1EXT = 1
INST_MAN3DIR = blib/man3
INSTALLMAN3DIR = $(PREFIX)/man/man3
MAN3EXT = 3
PERM_RW = 644
PERM_RWX = 755

# work around a famous dec-osf make(1) feature(?):
makemakerdflt: all

.SUFFIXES: .xs .c .C .cpp .cxx .cc $(OBJ_EXT)

# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
# some make implementations will delete the Makefile when we rebuild it. Because
# we call false(1) when we rebuild it. So make(1) is not completely wrong when it
# does so. Our milage may vary.
# .PRECIOUS: Makefile    # seems to be not necessary anymore

.PHONY: all config static dynamic test linkext manifest

# Where is the Config information that we are using/depend on
CONFIGDEP = $(PERL_ARCHLIB)/Config.pm $(PERL_INC)/config.h

# Where to put things:
INST_LIBDIR      = $(INST_LIB)
INST_ARCHLIBDIR  = $(INST_ARCHLIB)

INST_AUTODIR     = $(INST_LIB)/auto/$(FULLEXT)
INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)

INST_STATIC  = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)
INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
INST_BOOT    = $(INST_ARCHAUTODIR)/$(BASEEXT).bs

EXPORT_LIST = 

PERL_ARCHIVE = 

PERL_ARCHIVE_AFTER = 

TO_INST_PM = 

PM_TO_BLIB = 


# --- MakeMaker tool_autosplit section:

# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'


# --- MakeMaker tool_xsubpp section:

XSUBPPDIR = /opt/perl5.6.1/lib/5.6.1/ExtUtils
XSUBPP = $(XSUBPPDIR)/xsubpp
XSPROTOARG = 
XSUBPPDEPS = $(XSUBPPDIR)/typemap $(XSUBPP)
XSUBPPARGS = -typemap $(XSUBPPDIR)/typemap


# --- MakeMaker tools_other section:

SHELL = /bin/sh
CHMOD = chmod
CP = cp
LD = ld
MV = mv
NOOP = $(SHELL) -c true
RM_F = rm -f
RM_RF = rm -rf
TEST_F = test -f
TOUCH = touch
UMASK_NULL = umask 0
DEV_NULL = > /dev/null 2>&1

# The following is a portable way to say mkdir -p
# To see which directories are created, change the if 0 to if 1
MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath

# This helps us to minimize the effect of the .exists files A yet
# better solution would be to have a stable file in the perl
# distribution with a timestamp of zero. But this solution doesn't
# need any changes to the core distribution and works with older perls
EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime

# Here we warn users that an old packlist file was found somewhere,
# and that they should call some uninstall routine
WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \
-e 'print "WARNING: I have found an old package in\n";' \
-e 'print "\t$$ARGV[0].\n";' \
-e 'print "Please make sure the two installations are not conflicting\n";'

UNINST=0
VERBINST=0

MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
-e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"

DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \
-e 'print "=head2 ", scalar(localtime), ": C<", shift, ">", " L<", $$arg=shift, "|", $$arg, ">";' \
-e 'print "=over 4";' \
-e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \
-e 'print "=back";'

UNINSTALL =   $(PERL) -MExtUtils::Install \
-e 'uninstall($$ARGV[0],1,1); print "\nUninstall is deprecated. Please check the";' \
-e 'print " packlist above carefully.\n  There may be errors. Remove the";' \
-e 'print " appropriate files manually.\n  Sorry for the inconveniences.\n"'


# --- MakeMaker dist section:

DISTVNAME = $(DISTNAME)-$(VERSION)
TAR  = tar
TARFLAGS = cvf
ZIP  = zip
ZIPFLAGS = -r
COMPRESS = gzip --best
SUFFIX = .gz
SHAR = shar
PREOP = @$(NOOP)
POSTOP = @$(NOOP)
TO_UNIX = @$(NOOP)
CI = ci -u
RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
DIST_CP = best
DIST_DEFAULT = tardist


# --- MakeMaker macro section:


# --- MakeMaker depend section:


# --- MakeMaker cflags section:

CCFLAGS = -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae
OPTIMIZE = -O
PERLTYPE = 
MPOLLUTE = 


# --- MakeMaker const_loadlibs section:

# plperl might depend on some other libraries:
# See ExtUtils::Liblist for details
#
LD_RUN_PATH = 


# --- MakeMaker const_cccmd section:
CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \
	$(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \
	$(XS_DEFINE_VERSION)

# --- MakeMaker post_constants section:


# --- MakeMaker pasthru section:

PASTHRU = LIB="$(LIB)"\
	LIBPERL_A="$(LIBPERL_A)"\
	LINKTYPE="$(LINKTYPE)"\
	PREFIX="$(PREFIX)"\
	OPTIMIZE="$(OPTIMIZE)"


# --- MakeMaker c_o section:

.c$(OBJ_EXT):
	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $<

.C$(OBJ_EXT):
	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $<

.cpp$(OBJ_EXT):
	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $<

.cxx$(OBJ_EXT):
	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $<

.cc$(OBJ_EXT):
	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $<


# --- MakeMaker xs_c section:

.xs.c:
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $< > $@


# --- MakeMaker xs_o section:


# --- MakeMaker top_targets section:

#all ::	config $(INST_PM) subdirs linkext manifypods

all :: pure_all htmlifypods manifypods
	@$(NOOP)

pure_all :: config pm_to_blib subdirs linkext
	@$(NOOP)

subdirs :: $(MYEXTLIB)
	@$(NOOP)

config :: Makefile $(INST_LIBDIR)/.exists
	@$(NOOP)

config :: $(INST_ARCHAUTODIR)/.exists
	@$(NOOP)

config :: $(INST_AUTODIR)/.exists
	@$(NOOP)

$(INST_AUTODIR)/.exists :: /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/perl.h
	@$(MKPATH) $(INST_AUTODIR)
	@$(EQUALIZE_TIMESTAMP) /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/perl.h $(INST_AUTODIR)/.exists

	-@$(CHMOD) $(PERM_RWX) $(INST_AUTODIR)

$(INST_LIBDIR)/.exists :: /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/perl.h
	@$(MKPATH) $(INST_LIBDIR)
	@$(EQUALIZE_TIMESTAMP) /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/perl.h $(INST_LIBDIR)/.exists

	-@$(CHMOD) $(PERM_RWX) $(INST_LIBDIR)

$(INST_ARCHAUTODIR)/.exists :: /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/perl.h
	@$(MKPATH) $(INST_ARCHAUTODIR)
	@$(EQUALIZE_TIMESTAMP) /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/perl.h $(INST_ARCHAUTODIR)/.exists

	-@$(CHMOD) $(PERM_RWX) $(INST_ARCHAUTODIR)

$(O_FILES): $(H_FILES)

help:
	perldoc ExtUtils::MakeMaker

Version_check:
	@$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
		-MExtUtils::MakeMaker=Version_check \
		-e "Version_check('$(MM_VERSION)')"


# --- MakeMaker linkext section:

linkext :: $(LINKTYPE)
	@$(NOOP)


# --- MakeMaker dlsyms section:


# --- MakeMaker dynamic section:

## $(INST_PM) has been moved to the all: target.
## It remains here for awhile to allow for old usage: "make dynamic"
#dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT)
	@$(NOOP)


# --- MakeMaker dynamic_bs section:

BOOTSTRAP = plperl.bs

# As Mkbootstrap might not write a file (if none is required)
# we use touch to prevent make continually trying to remake it.
# The DynaLoader only reads a non-empty file.
$(BOOTSTRAP): Makefile  $(INST_ARCHAUTODIR)/.exists
	@echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
	@$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
		-MExtUtils::Mkbootstrap \
		-e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
	@$(TOUCH) $(BOOTSTRAP)
	$(CHMOD) $(PERM_RW) $@

$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
	@rm -rf $(INST_BOOT)
	-cp $(BOOTSTRAP) $(INST_BOOT)
	$(CHMOD) $(PERM_RW) $@


# --- MakeMaker dynamic_lib section:

# This section creates the dynamically loadable $(INST_DYNAMIC)
# from $(OBJECT) and possibly $(MYEXTLIB).
ARMAYBE = :
OTHERLDFLAGS =   -L/usr/local/lib /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/auto/DynaLoader/DynaLoader.a -L/opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE -lperl -lnsl_s -ldld -lm -lc -lndir -lcrypt -lsec

INST_DYNAMIC_DEP = 

$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
	$(RM_F) $@
	LD_RUN_PATH="$(LD_RUN_PATH)" $(LD)  $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST)
	$(CHMOD) $(PERM_RWX) $@


# --- MakeMaker static section:

## $(INST_PM) has been moved to the all: target.
## It remains here for awhile to allow for old usage: "make static"
#static :: Makefile $(INST_STATIC) $(INST_PM)
static :: Makefile $(INST_STATIC)
	@$(NOOP)


# --- MakeMaker static_lib section:

$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
	$(RM_RF) $@
	$(FULL_AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
	$(CHMOD) $(PERM_RWX) $@
	@echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld



# --- MakeMaker htmlifypods section:

htmlifypods : pure_all
	@$(NOOP)


# --- MakeMaker manifypods section:

manifypods : pure_all
	@$(NOOP)


# --- MakeMaker processPL section:


# --- MakeMaker installbin section:


# --- MakeMaker subdirs section:

# none

# --- MakeMaker clean section:

# Delete temporary files but do not touch installed files. We don't delete
# the Makefile here so a later make realclean still has a makefile to use.

clean ::
	-rm -rf SPI.c ./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all perlmain.c mon.out core core.*perl.*.? *perl.core so_locations pm_to_blib *$(OBJ_EXT) *$(LIB_EXT) perl.exe $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def $(BASEEXT).exp
	-mv Makefile Makefile.old $(DEV_NULL)


# --- MakeMaker realclean section:

# Delete temporary files (via clean) and also delete installed files
realclean purge ::  clean
	rm -rf $(INST_AUTODIR) $(INST_ARCHAUTODIR)
	rm -f $(INST_DYNAMIC) $(INST_BOOT)
	rm -f $(INST_STATIC)
	rm -rf Makefile Makefile.old


# --- MakeMaker dist_basics section:

distclean :: realclean distcheck

distcheck :
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=fullcheck \
		-e fullcheck

skipcheck :
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=skipcheck \
		-e skipcheck

manifest :
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=mkmanifest \
		-e mkmanifest

veryclean : realclean
	$(RM_F) *~ *.orig */*~ */*.orig


# --- MakeMaker dist_core section:

dist : $(DIST_DEFAULT)
	@$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \
	    -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "Makefile";'

tardist : $(DISTVNAME).tar$(SUFFIX)

zipdist : $(DISTVNAME).zip

$(DISTVNAME).tar$(SUFFIX) : distdir
	$(PREOP)
	$(TO_UNIX)
	$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
	$(RM_RF) $(DISTVNAME)
	$(COMPRESS) $(DISTVNAME).tar
	$(POSTOP)

$(DISTVNAME).zip : distdir
	$(PREOP)
	$(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
	$(RM_RF) $(DISTVNAME)
	$(POSTOP)

uutardist : $(DISTVNAME).tar$(SUFFIX)
	uuencode $(DISTVNAME).tar$(SUFFIX) \
		$(DISTVNAME).tar$(SUFFIX) > \
		$(DISTVNAME).tar$(SUFFIX)_uu

shdist : distdir
	$(PREOP)
	$(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
	$(RM_RF) $(DISTVNAME)
	$(POSTOP)


# --- MakeMaker dist_dir section:

distdir :
	$(RM_RF) $(DISTVNAME)
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \
		-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"


# --- MakeMaker dist_test section:

disttest : distdir
	cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
	cd $(DISTVNAME) && $(MAKE)
	cd $(DISTVNAME) && $(MAKE) test


# --- MakeMaker dist_ci section:

ci :
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \
		-e "@all = keys %{ maniread() };" \
		-e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \
		-e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'


# --- MakeMaker install section:

install :: all
	cp $(INST_DYNAMIC) $(DESTDIR)/home/postgres/version72/lib


# --- MakeMaker force section:
# Phony target to force checking subdirectories.
FORCE:
	@$(NOOP)


# --- MakeMaker perldepend section:

PERL_HDRS = \
	$(PERL_INC)/EXTERN.h		\
	$(PERL_INC)/INTERN.h		\
	$(PERL_INC)/XSUB.h		\
	$(PERL_INC)/av.h		\
	$(PERL_INC)/cc_runtime.h	\
	$(PERL_INC)/config.h		\
	$(PERL_INC)/cop.h		\
	$(PERL_INC)/cv.h		\
	$(PERL_INC)/dosish.h		\
	$(PERL_INC)/embed.h		\
	$(PERL_INC)/embedvar.h		\
	$(PERL_INC)/fakethr.h		\
	$(PERL_INC)/form.h		\
	$(PERL_INC)/gv.h		\
	$(PERL_INC)/handy.h		\
	$(PERL_INC)/hv.h		\
	$(PERL_INC)/intrpvar.h		\
	$(PERL_INC)/iperlsys.h		\
	$(PERL_INC)/keywords.h		\
	$(PERL_INC)/mg.h		\
	$(PERL_INC)/nostdio.h		\
	$(PERL_INC)/objXSUB.h		\
	$(PERL_INC)/op.h		\
	$(PERL_INC)/opcode.h		\
	$(PERL_INC)/opnames.h		\
	$(PERL_INC)/patchlevel.h	\
	$(PERL_INC)/perl.h		\
	$(PERL_INC)/perlapi.h		\
	$(PERL_INC)/perlio.h		\
	$(PERL_INC)/perlsdio.h		\
	$(PERL_INC)/perlsfio.h		\
	$(PERL_INC)/perlvars.h		\
	$(PERL_INC)/perly.h		\
	$(PERL_INC)/pp.h		\
	$(PERL_INC)/pp_proto.h		\
	$(PERL_INC)/proto.h		\
	$(PERL_INC)/regcomp.h		\
	$(PERL_INC)/regexp.h		\
	$(PERL_INC)/regnodes.h		\
	$(PERL_INC)/scope.h		\
	$(PERL_INC)/sv.h		\
	$(PERL_INC)/thrdvar.h		\
	$(PERL_INC)/thread.h		\
	$(PERL_INC)/unixish.h		\
	$(PERL_INC)/utf8.h		\
	$(PERL_INC)/util.h		\
	$(PERL_INC)/warnings.h

$(OBJECT) : $(PERL_HDRS)

SPI.c : $(XSUBPPDEPS)


# --- MakeMaker makefile section:


# --- MakeMaker staticmake section:

# --- MakeMaker makeaperl section ---
MAP_TARGET    = perl
FULLPERL      = /opt/perl5.6.1/bin/perl

$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
	$(MAKE) -f $(MAKE_APERL_FILE) $@

$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
	@echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
	@$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
		Makefile.PL DIR= \
		MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
		MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= \
		INC='-I. -I../../../src/include'


# --- MakeMaker test section:

TEST_VERBOSE=0
TEST_TYPE=test_$(LINKTYPE)
TEST_FILE = test.pl
TEST_FILES = 
TESTDB_SW = -d

testdb :: testdb_$(LINKTYPE)

test :: $(TEST_TYPE)
	@echo 'No tests defined for $(NAME) extension.'

test_dynamic :: pure_all

testdb_dynamic :: pure_all
	PERL_DL_NONLAZY=1 $(FULLPERL) $(TESTDB_SW) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(TEST_FILE)

test_ : test_dynamic

test_static :: pure_all $(MAP_TARGET)

testdb_static :: pure_all $(MAP_TARGET)
	PERL_DL_NONLAZY=1 ./$(MAP_TARGET) $(TESTDB_SW) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(TEST_FILE)



# --- MakeMaker ppd section:
# Creates a PPD (Perl Package Description) for a binary distribution.
ppd:
	@$(PERL) -e "print qq{<SOFTPKG NAME=\"plperl\" VERSION=\"0,10,0,0\">\n}. qq{\t<TITLE>plperl</TITLE>\n}. qq{\t<ABSTRACT></ABSTRACT>\n}. qq{\t<AUTHOR></AUTHOR>\n}. qq{\t<IMPLEMENTATION>\n}. qq{\t\t<OS NAME=\"$(OSNAME)\" />\n}. qq{\t\t<ARCHITECTURE NAME=\"PA-RISC2.0\" />\n}. qq{\t\t<CODEBASE HREF=\"\" />\n}. qq{\t</IMPLEMENTATION>\n}. qq{</SOFTPKG>\n}" > plperl.ppd

# --- MakeMaker pm_to_blib section:

pm_to_blib: $(TO_INST_PM)
	@$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
	"-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
        -e "pm_to_blib({qw{$(PM_TO_BLIB)}},'$(INST_LIB)/auto','$(PM_FILTER)')"
	@$(TOUCH) $@


# --- MakeMaker selfdocument section:


# --- MakeMaker postamble section:


# End.

Sun, 09 Jun 2002 23:45:50 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Perl build fix attempted 
Further digging: the backtrace from the SIGSEGV looks like

#0  0xc00a02fc in ?? () from /usr/lib/libc.1
	malloc + 1132
#1  0xc267cbb4 in ?? ()
	Perl_sv_grow + 244
   from /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/libperl.sl
#2  0xc26815b0 in ?? ()
	Perl_sv_setpv + 312
   from /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/libperl.sl
#3  0xc26152c0 in ?? ()
	S_incpush + 288
   from /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/libperl.sl
#4  0xc2615110 in ?? ()
	S_init_perllib + 136
   from /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/libperl.sl
#5  0xc261092c in ?? ()
	S_parse_body + 2396
   from /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/libperl.sl
#6  0xc260fc88 in ?? ()
	perl_parse + 272
   from /opt/perl5.6.1/lib/5.6.1/PA-RISC2.0/CORE/libperl.sl
#7  0xc09ec5d0 in plperl_init_interp () at plperl.c:207
#8  0xc09ec4a4 in plperl_init_all () at plperl.c:175
#9  0xc09ec684 in plperl_call_handler (fcinfo=0x7b011418) at plperl.c:240
#10 0x132808 in ExecMakeFunctionResult (fcache=0x402cf108, arguments=0xf000,
    econtext=0x1, isNull=0x3a <Address 0x3a out of bounds>, isDone=0x7b03ba30)
    at execQual.c:825

Since gdb doesn't really know anything about code generated by HP's cc,
it's difficult to get any more info than this.  However, the fact that
the crash is inside malloc() suggests a memory clobber very strongly.
My best theory at this point is that there's some conflict of ideas
about the size of data structures, perhaps triggered by those missing
-D symbols ...

			regards, tom lane

Mon, 10 Jun 2002 01:37:03 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Perl build fix attempted 