summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorBruce Momjian2004-10-06 09:20:41 +0000
committerBruce Momjian2004-10-06 09:20:41 +0000
commit5431393274dd9349490d56d9594782365ca8ddfc (patch)
treed44e028e5186b23ae94adae09fbd2a54cc4dd449 /src/pl
parent4542581bf1120c0ce706ee6029a723abc8147d60 (diff)
Allow plpython to build on Win32.
Magnus Hagander
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plpython/Makefile26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile
index 4bcc9d88a06..5ed72d155f8 100644
--- a/src/pl/plpython/Makefile
+++ b/src/pl/plpython/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.14 2004/09/24 20:08:42 tgl Exp $
+# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.15 2004/10/06 09:20:41 momjian Exp $
subdir = src/pl/plpython
top_builddir = ../../..
@@ -12,6 +12,12 @@ ifneq (,$(wildcard $(python_configdir)/libpython*$(DLSUFFIX)*))
shared_libpython = yes
endif
+# Convert backslashed paths to normal slashes
+ifeq ($(PORTNAME), win32)
+shared_libpython = yes
+python_includespec := $(subst \,/,$(python_includespec))
+endif
+
# Darwin (OS X) has its own ideas about how to do this.
ifeq ($(PORTNAME), darwin)
shared_libpython = yes
@@ -30,6 +36,21 @@ SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 0
OBJS = plpython.o
+
+# Python 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)
+pytverstr=$(subst .,,${python_version})
+OBJS += libpython${pytverstr}.a
+libpython${pytverstr}.a: python${pytverstr}.def
+ dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
+WD=$(subst \,/,$(WINDIR))
+python${pytverstr}.def: $(WD)/system32/python${pytverstr}.dll
+ pexports $(WD)/system32/python${pytverstr}.dll > python${pytverstr}.def
+endif
+
+
SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec)
include $(top_srcdir)/src/Makefile.shlib
@@ -55,6 +76,9 @@ uninstall:
clean distclean maintainer-clean: clean-lib
rm -f $(OBJS)
@rm -f error.diff feature.diff error.output feature.output test.log
+ifeq ($(PORTNAME), win32)
+ rm -f python${pytverstr}.def
+endif
installcheck:
PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh