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

Commit 02b61dd

Browse files
committed
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 846e91e. Hiroshi Inoue
1 parent a7983e9 commit 02b61dd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/pl/plperl/GNUmakefile

+24
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ DATA = plperl.control plperl--1.0.sql plperl--unpackaged--1.0.sql \
3636

3737
PERLCHUNKS = plc_perlboot.pl plc_trusted.pl
3838

39+
# Perl on win32 ships with import libraries only for Microsoft Visual C++,
40+
# which are not compatible with mingw gcc. Therefore we need to build a
41+
# new import library to link with.
42+
ifeq ($(PORTNAME), win32)
43+
44+
perlwithver := $(subst -l,,$(filter -l%, $(perl_embed_ldflags)))
45+
PERLDLL := $(dir $(subst ',,$(PERL)))$(perlwithver).dll
46+
# we no longer want to include the original -l spec in SHLIB_LINK
47+
override perl_embed_ldflags :=
48+
49+
OBJS += lib$(perlwithver).a
50+
51+
lib$(perlwithver).a: $(perlwithver).def
52+
dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib lib$(perlwithver).a
53+
54+
$(perlwithver).def: $(PERLDLL)
55+
pexports $^ > $@
56+
57+
endif # win32
58+
59+
3960
SHLIB_LINK = $(perl_embed_ldflags)
4061

4162
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl --load-extension=plperlu
@@ -105,6 +126,9 @@ submake:
105126
clean distclean maintainer-clean: clean-lib
106127
rm -f SPI.c Util.c $(OBJS) perlchunks.h plperl_opmask.h
107128
rm -rf $(pg_regress_clean_files)
129+
ifeq ($(PORTNAME), win32)
130+
rm -f $(perlwithver).def
131+
endif
108132

109133
else # can't build
110134

0 commit comments

Comments
 (0)