Ticket #44994: 0005-python26-Apply-upstream-Yosemite-fixes.patch
File 0005-python26-Apply-upstream-Yosemite-fixes.patch, 9.7 KB (added by larryv (Lawrence Velázquez), 10 years ago) |
---|
-
dports/lang/python26/Portfile
From 2492203f0d6e94a98d486a5151eacd2bb7587aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lawrence=20Vel=C3=A1zquez?= <larryv@macports.org> Date: Sat, 13 Sep 2014 16:50:08 -0400 Subject: [PATCH 5/5] python26: Apply upstream Yosemite fixes Patches adapted from http://bugs.python.org/issue21811. --- dports/lang/python26/Portfile | 5 + .../python26/files/yosemite-configure-fixes.patch | 114 +++++++++++++++++++++ .../python26/files/yosemite-python-fixes.patch | 91 ++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 dports/lang/python26/files/yosemite-configure-fixes.patch create mode 100644 dports/lang/python26/files/yosemite-python-fixes.patch diff --git a/dports/lang/python26/Portfile b/dports/lang/python26/Portfile index e61aef1..7015a30 100644
a b PortGroup select 1.0 7 7 name python26 8 8 # Remember to keep py26-tkinter and py26-gdbm's versions sync'd with this 9 9 version 2.6.9 10 revision 1 10 11 set major [lindex [split $version .] 0] 11 12 set branch [join [lrange [split ${version} .] 0 1] .] 12 13 categories lang … … patchfiles patch-Makefile.pre.in.diff \ 46 47 patch-setup.py-disabled_modules.diff \ 47 48 patch-libedit.diff 48 49 50 # http://bugs.python.org/issue21811 51 patchfiles-append yosemite-configure-fixes.patch \ 52 yosemite-python-fixes.patch 53 49 54 depends_lib port:gettext port:zlib port:openssl \ 50 55 port:sqlite3 port:db46 port:ncurses \ 51 56 port:bzip2 port:libedit -
new file dports/lang/python26/files/yosemite-configure-fixes.patch
diff --git a/dports/lang/python26/files/yosemite-configure-fixes.patch b/dports/lang/python26/files/yosemite-configure-fixes.patch new file mode 100644 index 0000000..111589f
- + 1 Index: configure 2 =================================================================== 3 --- configure.orig 4 +++ configure 5 @@ -5313,8 +5313,14 @@ $as_echo "$CC" >&6; } 6 7 # Calculate the right deployment target for this build. 8 # 9 - cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'` 10 - if test ${cur_target} '>' 10.2; then 11 + cur_target_major=`sw_vers -productVersion | \ 12 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 13 + cur_target_minor=`sw_vers -productVersion | \ 14 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 15 + cur_target="${cur_target_major}.${cur_target_minor}" 16 + if test ${cur_target_major} -eq 10 && \ 17 + test ${cur_target_minor} -ge 3 18 + then 19 cur_target=10.3 20 if test ${enable_universalsdk}; then 21 if test "${UNIVERSAL_ARCHS}" = "all"; then 22 @@ -7366,14 +7372,14 @@ then 23 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 24 # This allows an extension to be used in any Python 25 26 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 27 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 28 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` 29 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 30 + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` 31 + if test ${dep_target_major} -eq 10 && \ 32 + test ${dep_target_minor} -le 2 33 then 34 - if test "${enable_universalsdk}"; then 35 - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 36 - fi 37 - LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' 38 - BLDSHARED="$LDSHARED" 39 - else 40 + # building for OS X 10.0 through 10.2 41 LDSHARED='$(CC) $(LDFLAGS) -bundle' 42 if test "$enable_framework" ; then 43 # Link against the framework. All externals should be defined. 44 @@ -7384,6 +7390,13 @@ then 45 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' 46 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 47 fi 48 + else 49 + # building for OS X 10.3 and later 50 + if test "${enable_universalsdk}"; then 51 + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 52 + fi 53 + LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' 54 + BLDSHARED="$LDSHARED" 55 fi 56 ;; 57 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';; 58 Index: configure.in 59 =================================================================== 60 --- configure.in.orig 61 +++ configure.in 62 @@ -1011,8 +1011,14 @@ yes) 63 64 # Calculate the right deployment target for this build. 65 # 66 - cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` 67 - if test ${cur_target} '>' 10.2; then 68 + cur_target_major=`sw_vers -productVersion | \ 69 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 70 + cur_target_minor=`sw_vers -productVersion | \ 71 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 72 + cur_target="${cur_target_major}.${cur_target_minor}" 73 + if test ${cur_target_major} -eq 10 && \ 74 + test ${cur_target_minor} -ge 3 75 + then 76 cur_target=10.3 77 if test ${enable_universalsdk}; then 78 if test "${UNIVERSAL_ARCHS}" = "all"; then 79 @@ -1809,14 +1815,14 @@ then 80 # Use -undefined dynamic_lookup whenever possible (10.3 and later). 81 # This allows an extension to be used in any Python 82 83 - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 84 + dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 85 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 86 + dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ 87 + sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 88 + if test ${dep_target_major} -eq 10 && \ 89 + test ${dep_target_minor} -le 2 90 then 91 - if test "${enable_universalsdk}"; then 92 - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 93 - fi 94 - LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' 95 - BLDSHARED="$LDSHARED" 96 - else 97 + # building for OS X 10.0 through 10.2 98 LDSHARED='$(CC) $(LDFLAGS) -bundle' 99 if test "$enable_framework" ; then 100 # Link against the framework. All externals should be defined. 101 @@ -1827,6 +1833,13 @@ then 102 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' 103 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' 104 fi 105 + else 106 + # building for OS X 10.3 and later 107 + if test "${enable_universalsdk}"; then 108 + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" 109 + fi 110 + LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' 111 + BLDSHARED="$LDSHARED" 112 fi 113 ;; 114 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';; -
new file dports/lang/python26/files/yosemite-python-fixes.patch
diff --git a/dports/lang/python26/files/yosemite-python-fixes.patch b/dports/lang/python26/files/yosemite-python-fixes.patch new file mode 100644 index 0000000..4699283
- + 1 Index: Lib/distutils/util.py 2 =================================================================== 3 --- Lib/distutils/util.py.orig 4 +++ Lib/distutils/util.py 5 @@ -132,7 +132,16 @@ def get_platform (): 6 release = macver 7 osname = "macosx" 8 9 - if (macrelease + '.') >= '10.4.' and \ 10 + if macrelease: 11 + try: 12 + macrelease = tuple(int(i) for i in macrelease.split('.')[0:2]) 13 + except ValueError: 14 + macrelease = (10, 0) 15 + else: 16 + # assume no universal support 17 + macrelease = (10, 0) 18 + 19 + if (macrelease >= (10, 4)) and \ 20 '-arch' in get_config_vars().get('CFLAGS', '').strip(): 21 # The universal build will build fat binaries, but not on 22 # systems before 10.4 23 Index: Mac/BuildScript/build-installer.py 24 =================================================================== 25 --- Mac/BuildScript/build-installer.py.orig 26 +++ Mac/BuildScript/build-installer.py 27 @@ -105,14 +105,19 @@ SRCDIR = os.path.dirname( 28 # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level 29 DEPTARGET = '10.3' 30 31 -target_cc_map = { 32 +def getDeptargetTuple(): 33 + return tuple([int(n) for n in DEPTARGET.split('.')[0:2]]) 34 + 35 +def getTargetCompiler(): 36 + target_cc_map = { 37 '10.3': 'gcc-4.0', 38 '10.4': 'gcc-4.0', 39 '10.5': 'gcc-4.0', 40 '10.6': 'gcc-4.2', 41 -} 42 + } 43 + return target_cc_map.get(DEPTARGET, 'clang') 44 45 -CC = target_cc_map[DEPTARGET] 46 +CC = getTargetCompiler() 47 48 USAGE = textwrap.dedent("""\ 49 Usage: build_python [options] 50 @@ -136,7 +141,7 @@ USAGE = textwrap.dedent("""\ 51 def library_recipes(): 52 result = [] 53 54 - if DEPTARGET < '10.5': 55 + if getDeptargetTuple() < (10, 5): 56 result.extend([ 57 dict( 58 name="Bzip2 1.0.5", 59 @@ -307,7 +312,7 @@ def pkg_recipes(): 60 ), 61 ] 62 63 - if DEPTARGET < '10.4': 64 + if getDeptargetTuple() < (10, 4): 65 result.append( 66 dict( 67 name="PythonSystemFixes", 68 @@ -497,7 +502,7 @@ def parseOptions(args=None): 69 SDKPATH=os.path.abspath(SDKPATH) 70 DEPSRC=os.path.abspath(DEPSRC) 71 72 - CC=target_cc_map[DEPTARGET] 73 + CC=getTargetCompiler() 74 75 print "Settings:" 76 print " * Source directory:", SRCDIR 77 Index: setup.py 78 =================================================================== 79 --- setup.py.orig 80 +++ setup.py 81 @@ -637,7 +637,9 @@ class PyBuildExt(build_ext): 82 if platform == 'darwin': 83 os_release = int(os.uname()[2].split('.')[0]) 84 dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') 85 - if dep_target and dep_target.split('.') < ['10', '5']: 86 + if (dep_target and 87 + (tuple(int(n) for n in dep_target.split('.')[0:2]) 88 + < (10, 5) ) ): 89 os_release = 8 90 if os_release < 9: 91 # MacOSX 10.4 has a broken readline. Don't try to build