forked from macports/macports-ports
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
694 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 | ||
|
||
PortSystem 1.0 | ||
PortGroup select 1.0 | ||
|
||
name python39-devel | ||
|
||
# Remember to keep py39-tkinter and py39-gdbm's versions sync'd with this | ||
version 3.9.0a1 | ||
|
||
set branch [join [lrange [split ${version} .] 0 1] .] | ||
categories lang | ||
license PSF | ||
platforms darwin | ||
maintainers {jmr @jmroot} | ||
|
||
description An interpreted, object-oriented programming language | ||
long_description Python is an interpreted, interactive, object-oriented \ | ||
programming language. | ||
|
||
homepage https://www.python.org/ | ||
#master_sites ${homepage}ftp/python/${version}/ | ||
master_sites ${homepage}ftp/python/3.9.0/ | ||
|
||
distname Python-${version} | ||
use_xz yes | ||
checksums md5 43d57843ad4e4a7627c04930d109e6f9 \ | ||
rmd160 e46cc06534b3c381ff72e23bb869bdb61159c7db \ | ||
sha256 36b83deffb88d0e46319b0ca8f97f9f70b53a057b607b11466d6acbfe7196309 | ||
|
||
patchfiles patch-setup.py.diff \ | ||
patch-Lib-cgi.py.diff \ | ||
patch-configure.diff \ | ||
patch-Lib-ctypes-macholib-dyld.py.diff \ | ||
patch-libedit.diff \ | ||
patch-configure-xcode4bug.diff \ | ||
patch-_osx_support.py.diff | ||
|
||
depends_build port:pkgconfig | ||
depends_lib port:bzip2 \ | ||
port:expat \ | ||
port:gettext \ | ||
port:libedit \ | ||
port:libffi \ | ||
port:ncurses \ | ||
path:lib/libssl.dylib:openssl \ | ||
port:sqlite3 \ | ||
port:xz \ | ||
port:zlib | ||
depends_run port:python_select \ | ||
port:python3_select | ||
|
||
# blacklist llvm-gcc-4.2 compiler known to produce bad code | ||
compiler.blacklist-append *llvm-gcc-4.2 | ||
|
||
# ensurepip arg may be removed later, now conflicts with pip and setuptools | ||
# packages | ||
configure.args --enable-framework=${frameworks_dir} \ | ||
--enable-ipv6 \ | ||
--enable-loadable-sqlite-extensions \ | ||
--with-computed-gotos \ | ||
--with-ensurepip=no \ | ||
--with-system-expat \ | ||
--with-system-ffi | ||
|
||
configure.ccache no | ||
|
||
post-patch { | ||
reinplace "s|@@PREFIX@@|${prefix}|g" \ | ||
${worksrcpath}/Lib/cgi.py \ | ||
${worksrcpath}/Lib/ctypes/macholib/dyld.py | ||
|
||
reinplace "s|/setup.py|/setup.py --no-user-cfg|" ${worksrcpath}/Makefile.pre.in | ||
|
||
# replace /Applications with ${applications_dir} | ||
reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" \ | ||
${worksrcpath}/configure | ||
} | ||
|
||
build.target all | ||
|
||
test.run yes | ||
test.target test | ||
|
||
destroot.target frameworkinstall maninstall | ||
|
||
set pythonNoDot python[string map {. {}} $branch] | ||
select.entries [list python python-$pythonNoDot $pythonNoDot] \ | ||
[list python3 python3-$pythonNoDot $pythonNoDot] | ||
|
||
platform darwin { | ||
set framewpath ${frameworks_dir}/Python.framework | ||
set framewdir ${framewpath}/Versions/${branch} | ||
set confdir config-${branch}-darwin | ||
|
||
post-configure { | ||
# See https://trac.macports.org/ticket/18376 | ||
system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed" | ||
} | ||
|
||
post-build { | ||
set buildlibdir [lindex [glob -directory ${worksrcpath}/build lib.*-*-*-${branch}] 0] | ||
# Without this, LINKFORSHARED is set to | ||
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) | ||
# (this becomes Python.framework/Versions/3.9/Python) which doesn't | ||
# work for dependents that incorrectly use this variable to find out | ||
# how to link against python (see ticket #15099); instead we mirror | ||
# the behavior of `python-config --ldflags` here. | ||
system -W ${buildlibdir} "awk -F : \ | ||
\"/'LINKFORSHARED'/ {printf \\\"%s: '-L${framewdir}/lib/python${branch}/${confdir}\ | ||
-lpython${branch} -ldl -framework CoreFoundation',\\n\\\", \\\$1; getline; next} {print}\"\ | ||
_sysconfigdata__darwin_darwin.py > _sysconfigdata__darwin_darwin.py.new" | ||
file rename -force ${buildlibdir}/_sysconfigdata__darwin_darwin.py.new \ | ||
${buildlibdir}/_sysconfigdata__darwin_darwin.py | ||
|
||
# remove -arch flags from the config | ||
reinplace -E {s|-arch [a-z0-9_]+||g} \ | ||
${buildlibdir}/_sysconfigdata__darwin_darwin.py | ||
|
||
# also remove gettext overlinking | ||
reinplace "s|-lintl||" \ | ||
${buildlibdir}/_sysconfigdata__darwin_darwin.py | ||
} | ||
|
||
post-destroot { | ||
foreach dir { Headers Resources Python Versions/Current } { | ||
file delete ${destroot}${framewpath}/${dir} | ||
} | ||
|
||
ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/ | ||
ln -s ${framewdir}/lib/pkgconfig/python-${branch}.pc ${destroot}${prefix}/lib/pkgconfig/ | ||
ln -s ${framewdir}/lib/pkgconfig/python-${branch}-embed.pc ${destroot}${prefix}/lib/pkgconfig/ | ||
|
||
# Also make the sysconfig changes in the Makefile | ||
reinplace {s|^\(LINKFORSHARED=\).*$|\1 -L$(LIBPL) -lpython$(VERSION)$(ABIFLAGS) $(LIBS) $(SYSLIBS)|} \ | ||
${destroot}${framewdir}/lib/python${branch}/${confdir}/Makefile | ||
|
||
reinplace -E {s|-arch [a-z0-9_]+||g} \ | ||
${destroot}${framewdir}/lib/python${branch}/${confdir}/Makefile | ||
|
||
reinplace "s|-lintl||" \ | ||
${destroot}${framewdir}/lib/python${branch}/${confdir}/Makefile | ||
} | ||
} | ||
|
||
post-destroot { | ||
foreach unversioned {2to3 idle3 pydoc3 python3 python3-config} { | ||
delete ${destroot}${prefix}/bin/${unversioned} | ||
} | ||
} | ||
|
||
notes " | ||
To make this the default Python or Python 3 (i.e., the version run by\ | ||
the 'python' or 'python3' commands), run one or both of: | ||
sudo port select --set python $pythonNoDot | ||
sudo port select --set python3 $pythonNoDot | ||
" | ||
|
||
variant universal { | ||
post-patch { | ||
set universal_arch_flags {} | ||
set arch_run_32bit {} | ||
foreach arch ${universal_archs} { | ||
lappend universal_arch_flags -arch ${arch} | ||
if {${arch} eq "i386" || ${arch} eq "ppc"} { | ||
lappend arch_run_32bit -${arch} | ||
} | ||
} | ||
reinplace \ | ||
"s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \ | ||
${worksrcpath}/configure | ||
if {${arch_run_32bit} ne ""} { | ||
reinplace \ | ||
"s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \ | ||
${worksrcpath}/configure | ||
} | ||
} | ||
if {${configure.sdkroot} ne ""} { | ||
configure.args-append --enable-universalsdk=${configure.sdkroot} | ||
} else { | ||
configure.args-append --enable-universalsdk=/ | ||
} | ||
post-configure { | ||
system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed" | ||
} | ||
|
||
post-destroot { | ||
foreach unversioned {python3-32} { | ||
delete ${destroot}${prefix}/bin/${unversioned} | ||
} | ||
} | ||
} | ||
|
||
variant optimizations description {Compile with LTO and PGO. Build time greatly increased} { | ||
configure.args-append --enable-optimizations | ||
} | ||
|
||
livecheck.type regex | ||
livecheck.url ${homepage}downloads/source/ | ||
#livecheck.regex Python (${branch}\[.0-9\]+) - | ||
livecheck.regex Python (${branch}\[.0-9abrc\]+) - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- Lib/cgi.py.orig 2006-08-10 19:41:07.000000000 +0200 | ||
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200 | ||
@@ -1,13 +1,6 @@ | ||
-#! /usr/local/bin/python | ||
+#! @@PREFIX@@/bin/python3.9 | ||
|
||
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is | ||
-# intentionally NOT "/usr/bin/env python". On many systems | ||
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI | ||
-# scripts, and /usr/local/bin is the default directory where Python is | ||
-# installed, so /usr/bin/env would be unable to find python. Granted, | ||
-# binary installations by Linux vendors often install Python in | ||
-# /usr/bin. So let those vendors patch cgi.py to match their choice | ||
-# of installation. | ||
+# NOTE: /usr/local/bin/python patched for MacPorts installation | ||
|
||
"""Support module for CGI (Common Gateway Interface) scripts. | ||
|
11 changes: 11 additions & 0 deletions
11
lang/python39-devel/files/patch-Lib-ctypes-macholib-dyld.py.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- Lib/ctypes/macholib/dyld.py.orig 2019-10-15 00:34:47.000000000 +1100 | ||
+++ Lib/ctypes/macholib/dyld.py 2019-11-08 19:28:42.000000000 +1100 | ||
@@ -23,7 +23,7 @@ | ||
|
||
DEFAULT_LIBRARY_FALLBACK = [ | ||
os.path.expanduser("~/lib"), | ||
- "/usr/local/lib", | ||
+ "@@PREFIX@@/lib", | ||
"/lib", | ||
"/usr/lib", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py | ||
index db6674ea293fb..79eec6067aed1 100644 | ||
--- Lib/_osx_support.py | ||
+++ Lib/_osx_support.py | ||
@@ -211,7 +211,7 @@ def _remove_universal_flags(_config_vars): | ||
if cv in _config_vars and cv not in os.environ: | ||
flags = _config_vars[cv] | ||
flags = re.sub(r'-arch\s+\w+\s', ' ', flags, flags=re.ASCII) | ||
- flags = re.sub('-isysroot [^ \t]*', ' ', flags) | ||
+ flags = re.sub(r'-isysroot\s*\S+', ' ', flags) | ||
_save_modified_value(_config_vars, cv, flags) | ||
|
||
return _config_vars | ||
@@ -287,7 +287,7 @@ def _check_for_unavailable_sdk(_config_vars): | ||
# to /usr and /System/Library by either a standalone CLT | ||
# package or the CLT component within Xcode. | ||
cflags = _config_vars.get('CFLAGS', '') | ||
- m = re.search(r'-isysroot\s+(\S+)', cflags) | ||
+ m = re.search(r'-isysroot\s*(\S+)', cflags) | ||
if m is not None: | ||
sdk = m.group(1) | ||
if not os.path.exists(sdk): | ||
@@ -295,7 +295,7 @@ def _check_for_unavailable_sdk(_config_vars): | ||
# Do not alter a config var explicitly overridden by env var | ||
if cv in _config_vars and cv not in os.environ: | ||
flags = _config_vars[cv] | ||
- flags = re.sub(r'-isysroot\s+\S+(?:\s|$)', ' ', flags) | ||
+ flags = re.sub(r'-isysroot\s*\S+(?:\s|$)', ' ', flags) | ||
_save_modified_value(_config_vars, cv, flags) | ||
|
||
return _config_vars | ||
@@ -320,7 +320,7 @@ def compiler_fixup(compiler_so, cc_args): | ||
stripArch = stripSysroot = True | ||
else: | ||
stripArch = '-arch' in cc_args | ||
- stripSysroot = '-isysroot' in cc_args | ||
+ stripSysroot = any(arg for arg in cc_args if arg.find('-isysroot') == 0) | ||
|
||
if stripArch or 'ARCHFLAGS' in os.environ: | ||
while True: | ||
@@ -338,23 +338,34 @@ def compiler_fixup(compiler_so, cc_args): | ||
|
||
if stripSysroot: | ||
while True: | ||
- try: | ||
- index = compiler_so.index('-isysroot') | ||
+ indices = [i for i,x in enumerate(compiler_so) if x.find('-isysroot') == 0] | ||
+ if not indices: | ||
+ break | ||
+ index = indices[0] | ||
+ if compiler_so[index] == '-isysroot': | ||
# Strip this argument and the next one: | ||
del compiler_so[index:index+2] | ||
- except ValueError: | ||
- break | ||
+ else: | ||
+ # It's '-isysroot/some/path' in one arg | ||
+ del compiler_so[index:index+1] | ||
|
||
# Check if the SDK that is used during compilation actually exists, | ||
# the universal build requires the usage of a universal SDK and not all | ||
# users have that installed by default. | ||
sysroot = None | ||
- if '-isysroot' in cc_args: | ||
- idx = cc_args.index('-isysroot') | ||
- sysroot = cc_args[idx+1] | ||
- elif '-isysroot' in compiler_so: | ||
- idx = compiler_so.index('-isysroot') | ||
- sysroot = compiler_so[idx+1] | ||
+ argvar = cc_args | ||
+ indices = [i for i,x in enumerate(cc_args) if x.find('-isysroot') == 0] | ||
+ if not indices: | ||
+ argvar = compiler_so | ||
+ indices = [i for i,x in enumerate(compiler_so) if x.find('-isysroot') == 0] | ||
+ | ||
+ for idx in indices: | ||
+ if argvar[idx] == '-isysroot': | ||
+ sysroot = argvar[idx+1] | ||
+ break | ||
+ else: | ||
+ sysroot = argvar[idx][len('-isysroot'):] | ||
+ break | ||
|
||
if sysroot and not os.path.isdir(sysroot): | ||
from distutils import log | ||
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py | ||
index d10a78da31140..4d7a6de740ab3 100644 | ||
--- Lib/distutils/unixccompiler.py | ||
+++ Lib/distutils/unixccompiler.py | ||
@@ -288,7 +288,7 @@ def find_library_file(self, dirs, lib, debug=0): | ||
# vs | ||
# /usr/lib/libedit.dylib | ||
cflags = sysconfig.get_config_var('CFLAGS') | ||
- m = re.search(r'-isysroot\s+(\S+)', cflags) | ||
+ m = re.search(r'-isysroot\s*(\S+)', cflags) | ||
if m is None: | ||
sysroot = '/' | ||
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
https://trac.macports.org/ticket/49272 | ||
https://bugs.python.org/issue24844 | ||
|
||
Compiling python fails in Xcode 4 (clang < 3.3) where existence of 'atomic' | ||
is detected by configure, but it is not fully functional. | ||
|
||
--- configure.orig 2019-11-08 19:37:57.000000000 +1100 | ||
+++ configure 2019-11-08 19:52:06.000000000 +1100 | ||
@@ -16802,6 +16802,24 @@ | ||
volatile int val = 1; | ||
int main() { | ||
__atomic_load_n(&val, __ATOMIC_SEQ_CST); | ||
+ | ||
+ /* https://bugs.python.org/issue24844 */ | ||
+ #define VERSION_CHECK(cc_major, cc_minor, req_major, req_minor) \ | ||
+ ((cc_major) > (req_major) || \ | ||
+ (cc_major) == (req_major) && (cc_minor) >= (req_minor)) | ||
+ #if defined(__clang__) | ||
+ #if defined(__apple_build_version__) | ||
+ // either one test or the other should work | ||
+ // #if __apple_build_version__ < 5000000 | ||
+ #if !VERSION_CHECK(__clang_major__, __clang_minor__, 5, 0) | ||
+ #error | ||
+ #endif | ||
+ // not sure if this is 3.3 or 3.4 | ||
+ #elif !VERSION_CHECK(__clang_major__, __clang_minor__, 3, 3) | ||
+ #error | ||
+ #endif | ||
+ #endif | ||
+ | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- configure.orig 2019-10-15 00:34:47.000000000 +1100 | ||
+++ configure 2019-11-08 14:00:55.000000000 +1100 | ||
@@ -3192,6 +3192,8 @@ | ||
;; | ||
esac | ||
|
||
+ FRAMEWORKINSTALLAPPSPREFIX="@@APPLICATIONS_DIR@@" | ||
+ | ||
prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION | ||
|
||
# Add files for Mac specific code to the list of output |
Oops, something went wrong.