diff -rc Python-2.0.orig/Makefile.in Python-2.0/Makefile.in *** Python-2.0.orig/Makefile.in Mon Oct 16 17:50:06 2000 --- Python-2.0/Makefile.in Wed Nov 1 07:37:11 2000 *************** *** 131,136 **** --- 131,137 ---- LIBRARY= libpython$(VERSION).a LDLIBRARY= @LDLIBRARY@ + @SET_DLLLIBRARY@ # Default target all: $(LIBRARY) python$(EXE) sharedmods *************** *** 247,252 **** --- 248,257 ---- $(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \ else true; \ fi + if test -f "$(DLLLIBRARY)"; then \ + $(INSTALL_DATA) $(DLLLIBRARY) $(BINDIR); \ + else true; \ + fi # Install the manual page maninstall: *************** *** 371,379 **** else true; \ fi; \ done ! @if test -d $(LIBRARY); then :; else \ ! $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \ ! $(RANLIB) $(LIBPL)/$(LIBRARY) ; \ fi $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o --- 376,384 ---- else true; \ fi; \ done ! @if test -d $(LDLIBRARY); then :; else \ ! $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \ ! $(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \ fi $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o diff -rc Python-2.0.orig/Modules/Makefile.pre.in Python-2.0/Modules/Makefile.pre.in *** Python-2.0.orig/Modules/Makefile.pre.in Mon Oct 16 17:49:33 2000 --- Python-2.0/Modules/Makefile.pre.in Wed Nov 1 07:37:11 2000 *************** *** 105,110 **** --- 105,111 ---- LIBRARY= ../libpython$(VERSION).a LDLIBRARY= ../@LDLIBRARY@ + @SET_DLLLIBRARY@ # === Rules === *************** *** 126,131 **** --- 127,140 ---- $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \ $(LDLIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python$(EXE) $(LDLAST) mv python$(EXE) ../python$(EXE) + + # This rule builds the Python DLL for Cygwin + $(DLLLIBRARY): $(LIBRARY) + test -d cygwin || mkdir cygwin + (cd cygwin; ar x ../$^) + dlltool --export-all --output-def $(basename $@).def cygwin/*.o + gcc -shared -Wl,--enable-auto-image-base -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 diff -rc Python-2.0.orig/Modules/makesetup Python-2.0/Modules/makesetup *** Python-2.0.orig/Modules/makesetup Mon Oct 16 17:49:33 2000 --- Python-2.0/Modules/makesetup Wed Nov 1 08:07:29 2000 *************** *** 79,84 **** --- 79,102 ---- NL='\ ' + # Default module names to so that their basename ends in "module" + module='module' + + # Cygwin specific definitions: + # 1. do not append ${module} to the end of Cygwin module names + # 2. use -DUSE_DL_IMPORT when compiling shared extensions that are not + # part of the Python core + # 3. use -L$(LIBPL) -lpython$(VERSION) when linking shared extensions + # that are not part of the Python core + case `uname -s` in + CYGWIN*) module='' + if test $srcdir != . + then + CygwinFlags='-DUSE_DL_IMPORT' + CygwinLibs='-L$(LIBPL) -lpython$(VERSION)' + fi;; + esac + # Main loop for i in ${*-Setup} do *************** *** 149,154 **** --- 167,173 ---- *.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";; *************** *** 196,202 **** case $doconfig in no) cc="$cc \$(CCSHARED)";; esac ! rule="$obj: $src; $cc $cpps \$(CFLAGS) -c $src" echo "$rule" >>$rulesf done case $doconfig in --- 215,221 ---- case $doconfig in no) cc="$cc \$(CCSHARED)";; esac ! rule="$obj: $src; $cc $cpps \$(CFLAGS) $CygwinFlags -c $src" echo "$rule" >>$rulesf done case $doconfig in *************** *** 206,219 **** do case $objs in *$mod.o*) base=$mod;; ! *) base=${mod}module;; esac file="$base\$(SO)" case $doconfig in no) SHAREDMODS="$SHAREDMODS $file";; esac rule="$file: $objs" ! rule="$rule; \$(LDSHARED) $objs $libs -o $file" echo "$rule" >>$rulesf done done --- 225,238 ---- do case $objs in *$mod.o*) base=$mod;; ! *) base=${mod}${module};; esac file="$base\$(SO)" case $doconfig in no) SHAREDMODS="$SHAREDMODS $file";; esac rule="$file: $objs" ! rule="$rule; \$(LDSHARED) $objs $libs $CygwinLibs -o $file" echo "$rule" >>$rulesf done done diff -rc Python-2.0.orig/acconfig.h Python-2.0/acconfig.h *** Python-2.0.orig/acconfig.h Mon Oct 16 17:50:06 2000 --- Python-2.0/acconfig.h Wed Nov 1 07:37:11 2000 *************** *** 179,181 **** --- 179,193 ---- /* Leave that blank line there-- autoheader needs it! */ + + @BOTTOM@ + + #ifdef __CYGWIN__ + #ifdef USE_DL_IMPORT + #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE + #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE + #else + #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE + #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE + #endif + #endif diff -rc Python-2.0.orig/configure.in Python-2.0/configure.in *** Python-2.0.orig/configure.in Mon Oct 16 17:50:06 2000 --- Python-2.0/configure.in Wed Nov 1 07:37:11 2000 *************** *** 217,226 **** # LDLIBRARY is the name of the library to link against (as opposed to the # name of the library into which to insert object files). On systems # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in ! # the Makefiles). AC_SUBST(MAKE_LDLIBRARY) AC_SUBST(LDLIBRARY) LDLIBRARY='' # LINKCC is the command that links the python executable -- default is $(CC). # This is altered for AIX in order to build the export list before --- 217,229 ---- # LDLIBRARY is the name of the library to link against (as opposed to the # name of the library into which to insert object files). On systems # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in ! # the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the ! # shared (i.e., DLL) library. AC_SUBST(MAKE_LDLIBRARY) AC_SUBST(LDLIBRARY) + AC_SUBST(SET_DLLLIBRARY) LDLIBRARY='' + SET_DLLLIBRARY='' # LINKCC is the command that links the python executable -- default is $(CC). # This is altered for AIX in order to build the export list before *************** *** 263,268 **** --- 266,275 ---- beos*) LDLIBRARY='libpython$(VERSION).so' ;; + cygwin*) + LDLIBRARY='libpython$(VERSION).dll.a' + SET_DLLLIBRARY='DLLLIBRARY= $(basename $(LDLIBRARY))' + ;; esac AC_MSG_RESULT($LDLIBRARY) *************** *** 272,278 **** LDLIBRARY='libpython$(VERSION).a' MAKE_LDLIBRARY="true" else ! MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)' fi AC_PROG_RANLIB --- 279,288 ---- LDLIBRARY='libpython$(VERSION).a' MAKE_LDLIBRARY="true" else ! case $MACHDEP in ! cygwin*) MAKE_LDLIBRARY='$(MAKE) -C Modules ../$(DLLLIBRARY)';; ! *) MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)';; ! esac fi AC_PROG_RANLIB *************** *** 297,302 **** --- 307,313 ---- if test -z "$LN" ; then case $ac_sys_system in BeOS*) LN="ln -s";; + CYGWIN*) LN="ln -s";; *) LN=ln;; esac fi *************** *** 539,550 **** AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) # SO is the extension of shared libraries `(including the dot!) ! # -- usually .so, .sl on HP-UX AC_MSG_CHECKING(SO) if test -z "$SO" then case $ac_sys_system in hp*|HP*) SO=.sl;; *) SO=.so;; esac fi --- 550,562 ---- AC_SUBST(CCSHARED) AC_SUBST(LINKFORSHARED) # SO is the extension of shared libraries `(including the dot!) ! # -- usually .so, .sl on HP-UX, .dll on Cygwin AC_MSG_CHECKING(SO) if test -z "$SO" then case $ac_sys_system in hp*|HP*) SO=.sl;; + CYGWIN*) SO=.dll;; *) SO=.so;; esac fi *************** *** 602,607 **** --- 614,620 ---- fi;; SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; + CYGWIN*) LDSHARED="gcc -shared";; *) LDSHARED="ld";; esac fi