From b961920ff4dca0e716ba767aee8e74b6b0abe515 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 10 Jan 2001 21:12:18 +0000 Subject: Final part of SF patch #102409 by jlt63: Cygwin Python DLL and Shared Extension Patch. These are the changes to the Modules Makefile and makesetup script for Cygwin. --- Modules/Makefile.pre.in | 9 +++++++++ Modules/makesetup | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Modules/Makefile.pre.in b/Modules/Makefile.pre.in index 82a4e16..9487980 100644 --- a/Modules/Makefile.pre.in +++ b/Modules/Makefile.pre.in @@ -105,6 +105,7 @@ SYSLIBS= $(LIBM) $(LIBC) LIBRARY= ../libpython$(VERSION).a LDLIBRARY= ../@LDLIBRARY@ +@SET_DLLLIBRARY@ # === Rules === @@ -127,6 +128,14 @@ link: $(MAINOBJ) $(LDLIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python$(EXE) $(LDLAST) mv python$(EXE) ../python$(EXE) +# This rule builds the Cygwin Python DLL +$(DLLLIBRARY): $(LIBRARY) + test -d cygwin || mkdir cygwin + (cd cygwin; ar x ../$^) + dlltool --export-all --output-def $(basename $@).def cygwin/*.o + $(LDSHARED) -Wl,--out-implib=$(LDLIBRARY) -o $@ $(basename $@).def cygwin/*.o $(MODLIBS) $(LIBS) $(SYSLIBS) + rm -fr cygwin + clean: -rm -f *.o python$(EXE) core *~ [@,#]* *.old *.orig *.rej -rm -f add2lib hassignal diff --git a/Modules/makesetup b/Modules/makesetup index 528f118..125a51e 100755 --- a/Modules/makesetup +++ b/Modules/makesetup @@ -79,6 +79,18 @@ esac NL='\ ' +# Setup to link with extra libraries when makeing shared extensions. +# Currently, only Cygwin needs this baggage. +case `uname -s` in +CYGWIN*) if test $srcdir = . + then + ExtraLibDir=.. + else + ExtraLibDir='$(LIBPL)' + fi + ExtraLibs="-L$ExtraLibDir -lpython\$(VERSION)";; +esac + # Main loop for i in ${*-Setup} do @@ -149,6 +161,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | *.so) libs="$libs $arg";; *.sl) libs="$libs $arg";; /*.o) libs="$libs $arg";; + *.def) libs="$libs $arg";; *.o) srcs="$srcs `basename $arg .o`.c";; *.[cC]) srcs="$srcs $arg";; *.cc) srcs="$srcs $arg";; @@ -213,7 +226,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | no) SHAREDMODS="$SHAREDMODS $file";; esac rule="$file: $objs" - rule="$rule; \$(LDSHARED) $objs $libs -o $file" + rule="$rule; \$(LDSHARED) $objs $libs $ExtraLibs -o $file" echo "$rule" >>$rulesf done done -- cgit v0.12