aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-02-14 11:51:02 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-02-14 11:51:02 -0500
commit02b61dd08f9973eee3058c458afba7b9336230dc (patch)
treee5a10cc708284358b16d3e93b6bca11fa53a1ff9
parenta7983e989d9cafc9cef49becfee054e34b1ed9b4 (diff)
downloadpostgresql-02b61dd08f9973eee3058c458afba7b9336230dc.tar.gz
postgresql-02b61dd08f9973eee3058c458afba7b9336230dc.zip
In mingw builds, make our own import library for libperl.
Borrow the method already used by plpython. This is pretty ugly, but it might fix the build failure exhibited by buildfarm member narwhal since commit 846e91e0223cf9f2821c3ad4dfffffbb929cb027. Hiroshi Inoue
-rw-r--r--src/pl/plperl/GNUmakefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile
index e0e31ecfbf8..1e800a344c8 100644
--- a/src/pl/plperl/GNUmakefile
+++ b/src/pl/plperl/GNUmakefile
@@ -36,6 +36,27 @@ DATA = plperl.control plperl--1.0.sql plperl--unpackaged--1.0.sql \
PERLCHUNKS = plc_perlboot.pl plc_trusted.pl
+# Perl on win32 ships with import libraries only for Microsoft Visual C++,
+# which are not compatible with mingw gcc. Therefore we need to build a
+# new import library to link with.
+ifeq ($(PORTNAME), win32)
+
+perlwithver := $(subst -l,,$(filter -l%, $(perl_embed_ldflags)))
+PERLDLL := $(dir $(subst ',,$(PERL)))$(perlwithver).dll
+# we no longer want to include the original -l spec in SHLIB_LINK
+override perl_embed_ldflags :=
+
+OBJS += lib$(perlwithver).a
+
+lib$(perlwithver).a: $(perlwithver).def
+ dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib lib$(perlwithver).a
+
+$(perlwithver).def: $(PERLDLL)
+ pexports $^ > $@
+
+endif # win32
+
+
SHLIB_LINK = $(perl_embed_ldflags)
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl --load-extension=plperlu
@@ -105,6 +126,9 @@ submake:
clean distclean maintainer-clean: clean-lib
rm -f SPI.c Util.c $(OBJS) perlchunks.h plperl_opmask.h
rm -rf $(pg_regress_clean_files)
+ifeq ($(PORTNAME), win32)
+ rm -f $(perlwithver).def
+endif
else # can't build