-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathPortfile
More file actions
225 lines (186 loc) · 8.23 KB
/
Portfile
File metadata and controls
225 lines (186 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# -*- 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
PortGroup openssl 1.0
PortGroup deprecated 1.0
name python34
epoch 20170810
# Remember to keep py34-tkinter and py34-gdbm's versions sync'd with this
version 3.4.10
revision 10
deprecated.eol_version yes
set major [lindex [split $version .] 0]
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
license PSF
maintainers {jmr @jmroot} openmaintainer
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}/
distname Python-${version}
use_xz yes
checksums md5 f88a98bce17a03c43a6a5f8a66ab2e62 \
rmd160 050bb8f215d9b5ed8287b2a9f9faa6448d7513a5 \
sha256 d46a8f6fe91679e199c671b1b0a30aaf172d2acb5bcab25beb35f16c3d195b4e
patchfiles patch-setup.py.diff \
patch-Lib-cgi.py.diff \
patch-configure.diff \
patch-Lib-ctypes-macholib-dyld.py.diff \
patch-pyconfig.h.in.diff \
patch-Python-random.c.diff \
patch-libedit.diff \
patch-openssl11.diff \
omit-local-site-packages.patch \
patch-Include-pyport.h.diff \
uuid-64bit.patch \
patch-_osx_support.py.diff \
darwin20.diff \
sysconfig.py.diff \
libedit-types.patch
depends_build path:bin/pkg-config:pkgconfig
depends_lib port:bzip2 \
port:expat \
port:gettext-runtime \
port:libedit \
port:libffi \
port:ncurses \
port:sqlite3 \
port:xz \
port:zlib
depends_run port:python_select \
port:python3_select
# Don't let the portgroup use -isystem, it breaks lib detection for modules.
openssl.configure
openssl.branch 1.1
configure.cppflags-prepend -I[openssl::include_dir]
configure.ldflags-prepend -L[openssl::lib_dir]
if {${os.platform} eq "darwin" && ${os.major} >= 20} {
supported_archs x86_64
}
# blacklist llvm-gcc-4.2 compiler known to produce bad code
compiler.blacklist *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
# pkg-config removes -I flags for paths in CPATH, which confuses python.
configure.env PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
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]
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
"
platform darwin {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
set confdir config-${branch}m
post-configure {
# poll() misbehaves on 10.8 and older
# See https://trac.macports.org/ticket/18376
if {${os.major} <= 12} {
system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
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}.pc ${destroot}${prefix}/lib/pkgconfig/python-${branch}m.pc
set libdir ${destroot}${framewdir}/lib/python${branch}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/3.4/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.
set lfs_pattern {^([[:space:]]*'LINKFORSHARED':).*}
set lfs_replacement "\\1 '-L${framewdir}/lib/python${branch}/${confdir} -lpython${branch}m -ldl -framework CoreFoundation',"
reinplace -E s|${lfs_pattern}|${lfs_replacement}| \
${libdir}/_sysconfigdata.py
# remove -arch flags from the config
reinplace -E {s|-arch [a-z0-9_]+||g} \
${libdir}/_sysconfigdata.py
# also remove gettext overlinking
reinplace "s|-lintl||" \
${libdir}/_sysconfigdata.py
# recompile the modified file
set python_for_build python.exe
# executable differs depending on filesystem case sensitivity
if {![file exists ${worksrcpath}/${python_for_build}]} {
set python_for_build python
}
system -W ${worksrcpath} "env DYLD_FRAMEWORK_PATH=. ./${python_for_build} -E -m compileall -d [shellescape ${framewdir}/lib/python${branch}] [shellescape ${libdir}/_sysconfigdata.py]"
system -W ${worksrcpath} "env DYLD_FRAMEWORK_PATH=. ./${python_for_build} -E -O -m compileall -d [shellescape ${framewdir}/lib/python${branch}] [shellescape ${libdir}/_sysconfigdata.py]"
# Also make the sysconfig changes in the Makefile
reinplace {s|^\(LINKFORSHARED=\).*$|\1 -L$(LIBPL) -lpython$(VERSION)$(ABIFLAGS) $(LIBS) $(SYSLIBS)|} \
${libdir}/${confdir}/Makefile
reinplace -E {s|-arch [a-z0-9_]+||g} \
${libdir}/${confdir}/Makefile
reinplace "s|-lintl||" \
${libdir}/${confdir}/Makefile
}
}
post-destroot {
foreach unversioned {2to3 idle3 pydoc3 python3 python3-config pyvenv} {
delete ${destroot}${prefix}/bin/${unversioned}
}
}
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
}
}
configure.args-append --enable-universalsdk=${configure.sysroot}
post-configure {
system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed"
}
post-destroot {
foreach unversioned {python3-32} {
delete ${destroot}${prefix}/bin/${unversioned}
}
}
}
livecheck.type regex
livecheck.url ${homepage}downloads/
livecheck.regex Python (${branch}(?:\\.\\d+)*)