Commit 3076559e authored by Jason Tishler's avatar Jason Tishler

This patch enables the building of Cygwin Python with a static core

which still supports shared extensions. It takes advantage the latest
Cygwin binutils (i.e., 20030901-1) which can export symbols from
executables:

http://cygwin.com/ml/cygwin-announce/2003-09/msg00002.html

Additionally, it finally lays to rest the following mailing list
subthread:

http://mail.python.org/pipermail/python-list/2002-May/102500.html

I tested the patch under Red Hat Linux 8.0 too
parent 8ad1dd7d
...@@ -421,7 +421,8 @@ extern double hypot(double, double); ...@@ -421,7 +421,8 @@ extern double hypot(double, double);
# define HAVE_DECLSPEC_DLL # define HAVE_DECLSPEC_DLL
#endif #endif
#if defined(Py_ENABLE_SHARED) /* only get special linkage if built as shared */ /* only get special linkage if built as shared or platform is Cygwin */
#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)
# if defined(HAVE_DECLSPEC_DLL) # if defined(HAVE_DECLSPEC_DLL)
# ifdef Py_BUILD_CORE # ifdef Py_BUILD_CORE
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
......
...@@ -379,10 +379,14 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \ ...@@ -379,10 +379,14 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
$(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
# This rule builds the Cygwin Python DLL # This rule builds the Cygwin Python DLL and import library if configured
libpython$(VERSION).dll.a: $(LIBRARY_OBJS) # for a shared core library; otherwise, this rule is a noop.
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
$(LIBS) $(MODLIBS) $(SYSLIBS) if test -n "$(DLLLIBRARY)"; then \
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
$(LIBS) $(MODLIBS) $(SYSLIBS); \
else true; \
fi
oldsharedmods: $(SHAREDMODS) oldsharedmods: $(SHAREDMODS)
......
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.428 . # From configure.in Revision: 1.429 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for python 2.4. # Generated by GNU Autoconf 2.57 for python 2.4.
# #
...@@ -3619,6 +3619,13 @@ _ACEOF ...@@ -3619,6 +3619,13 @@ _ACEOF
BASECFLAGS="$BASECFLAGS -pic" BASECFLAGS="$BASECFLAGS -pic"
;; ;;
esac esac
else # shared is disabled
case $ac_sys_system in
CYGWIN*)
BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(VERSION).dll.a'
;;
esac
fi fi
echo "$as_me:$LINENO: result: $LDLIBRARY" >&5 echo "$as_me:$LINENO: result: $LDLIBRARY" >&5
...@@ -10192,6 +10199,11 @@ then ...@@ -10192,6 +10199,11 @@ then
LINKFORSHARED="-Xlinker --export-dynamic" LINKFORSHARED="-Xlinker --export-dynamic"
fi;; fi;;
esac;; esac;;
CYGWIN*)
if test $enable_shared = "no"
then
LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
fi;;
esac esac
fi fi
echo "$as_me:$LINENO: result: $LINKFORSHARED" >&5 echo "$as_me:$LINENO: result: $LINKFORSHARED" >&5
......
...@@ -539,6 +539,13 @@ if test $enable_shared = "yes"; then ...@@ -539,6 +539,13 @@ if test $enable_shared = "yes"; then
BASECFLAGS="$BASECFLAGS -pic" BASECFLAGS="$BASECFLAGS -pic"
;; ;;
esac esac
else # shared is disabled
case $ac_sys_system in
CYGWIN*)
BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(VERSION).dll.a'
;;
esac
fi fi
AC_MSG_RESULT($LDLIBRARY) AC_MSG_RESULT($LDLIBRARY)
...@@ -1371,6 +1378,11 @@ then ...@@ -1371,6 +1378,11 @@ then
LINKFORSHARED="-Xlinker --export-dynamic" LINKFORSHARED="-Xlinker --export-dynamic"
fi;; fi;;
esac;; esac;;
CYGWIN*)
if test $enable_shared = "no"
then
LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
fi;;
esac esac
fi fi
AC_MSG_RESULT($LINKFORSHARED) AC_MSG_RESULT($LINKFORSHARED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment