1 | # -*- 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 |
---|
2 | # $Id: Portfile 153800 2016-10-11 19:38:22Z larryv@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup select 1.0 |
---|
6 | |
---|
7 | name python27 |
---|
8 | epoch 2 |
---|
9 | # Remember to keep py27-tkinter and py27-gdbm's versions sync'd with this |
---|
10 | version 2.7.12 |
---|
11 | revision 2 |
---|
12 | |
---|
13 | set major [lindex [split $version .] 0] |
---|
14 | set branch [join [lrange [split ${version} .] 0 1] .] |
---|
15 | categories lang |
---|
16 | license PSF |
---|
17 | platforms darwin |
---|
18 | |
---|
19 | maintainers jwa openmaintainer |
---|
20 | |
---|
21 | description An interpreted, object-oriented programming language |
---|
22 | long_description Python is an interpreted, interactive, object-oriented \ |
---|
23 | programming language. |
---|
24 | |
---|
25 | homepage http://www.python.org/ |
---|
26 | master_sites ${homepage}ftp/python/${version}/ |
---|
27 | |
---|
28 | distname Python-${version} |
---|
29 | use_xz yes |
---|
30 | |
---|
31 | checksums rmd160 c330f6ac08ed67f307de0e726a288bab16c832d5 \ |
---|
32 | sha256 d7837121dd5652a05fef807c361909d255d173280c4e1a4ded94d73d80a1f978 |
---|
33 | |
---|
34 | patchfiles patch-Makefile.pre.in.diff \ |
---|
35 | patch-setup.py.diff \ |
---|
36 | patch-setup.py-disabled_modules.diff \ |
---|
37 | patch-Lib-cgi.py.diff \ |
---|
38 | patch-Lib-ctypes-macholib-dyld.py.diff \ |
---|
39 | patch-configure.diff \ |
---|
40 | patch-libedit.diff \ |
---|
41 | patch-Include-pyport.h.diff \ |
---|
42 | omit-local-site-packages.patch \ |
---|
43 | improve-QuickTime.h-check.patch \ |
---|
44 | enable-loadable-sqlite-extensions.patch |
---|
45 | |
---|
46 | depends_lib port:gettext \ |
---|
47 | port:zlib \ |
---|
48 | path:lib/libssl.dylib:openssl \ |
---|
49 | port:sqlite3 \ |
---|
50 | port:db48 \ |
---|
51 | port:ncurses \ |
---|
52 | port:bzip2 \ |
---|
53 | port:libedit |
---|
54 | depends_run port:python_select \ |
---|
55 | port:python2_select |
---|
56 | |
---|
57 | # disable-ipv6 for now, getaddrinfo-function missing |
---|
58 | configure.args --enable-framework=${frameworks_dir} \ |
---|
59 | --enable-ipv6 |
---|
60 | |
---|
61 | configure.cppflags-append -I${prefix}/include/db48 |
---|
62 | configure.ldflags-append -L${prefix}/lib/db48 |
---|
63 | |
---|
64 | configure.ccache no |
---|
65 | |
---|
66 | # signed integer overflow is normally undefined as per the C spec, but python |
---|
67 | # needs it to be defined as twos-complement |
---|
68 | configure.cflags-append -fwrapv |
---|
69 | |
---|
70 | post-patch { |
---|
71 | reinplace "s|@@PREFIX@@|${prefix}|g" \ |
---|
72 | ${worksrcpath}/Lib/cgi.py \ |
---|
73 | ${worksrcpath}/Lib/ctypes/macholib/dyld.py |
---|
74 | reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" \ |
---|
75 | ${worksrcpath}/configure |
---|
76 | |
---|
77 | # See https://trac.macports.org/changeset/37861 |
---|
78 | reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \ |
---|
79 | ${worksrcpath}/Mac/PythonLauncher/Makefile.in |
---|
80 | } |
---|
81 | |
---|
82 | post-configure { |
---|
83 | reinplace "s;/* #undef PY_FORMAT_LONG_LONG */;#define PY_FORMAT_LONG_LONG \"ll\";" pyconfig.h |
---|
84 | } |
---|
85 | |
---|
86 | build.target all |
---|
87 | |
---|
88 | test.run yes |
---|
89 | test.target test |
---|
90 | |
---|
91 | destroot.target frameworkinstall maninstall |
---|
92 | |
---|
93 | # ensure that correct compiler is used |
---|
94 | build.args-append MAKE="${build.cmd} CC=${configure.cc}" |
---|
95 | destroot.args-append MAKE="${destroot.cmd} CC=${configure.cc}" |
---|
96 | |
---|
97 | set pythonNoDot python[string map {. {}} $branch] |
---|
98 | select.entries [list python python-$pythonNoDot $pythonNoDot] \ |
---|
99 | [list python2 python2-$pythonNoDot $pythonNoDot] |
---|
100 | |
---|
101 | notes " |
---|
102 | To make this the default Python or Python 2 (i.e., the version run by\ |
---|
103 | the 'python' or 'python2' commands), run one or both of: |
---|
104 | |
---|
105 | sudo port select --set python $pythonNoDot |
---|
106 | sudo port select --set python2 $pythonNoDot |
---|
107 | |
---|
108 | ############################################################## |
---|
109 | # IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL: |
---|
110 | # py[string map {. {}} $branch]-readline |
---|
111 | # TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE. |
---|
112 | # REF: https://trac.macports.org/ticket/48807 |
---|
113 | ############################################################## |
---|
114 | " |
---|
115 | |
---|
116 | post-destroot { |
---|
117 | set framewpath ${frameworks_dir}/Python.framework |
---|
118 | set framewdir ${framewpath}/Versions/${branch} |
---|
119 | |
---|
120 | foreach dir { Headers Resources Python Versions/Current } { |
---|
121 | file delete ${destroot}${framewpath}/${dir} |
---|
122 | } |
---|
123 | |
---|
124 | ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/ |
---|
125 | ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib |
---|
126 | |
---|
127 | foreach unversionedFile {2to3 2to3-2 idle idle2 pydoc pydoc2 python python2 python-config python2-config pythonw pythonw2 smtpd.py smtpd2.py} { |
---|
128 | delete ${destroot}${prefix}/bin/${unversionedFile} |
---|
129 | } |
---|
130 | |
---|
131 | # remove -arch flags from the config |
---|
132 | reinplace -E {s|-arch [a-z0-9_]+||g} \ |
---|
133 | ${destroot}${framewdir}/lib/python${branch}/config/Makefile \ |
---|
134 | ${destroot}${framewdir}/lib/python${branch}/_sysconfigdata.py |
---|
135 | } |
---|
136 | |
---|
137 | platform darwin { |
---|
138 | post-patch { |
---|
139 | if {![file exists /usr/lib/libSystemStubs.a]} { |
---|
140 | reinplace s/-lSystemStubs//g ${worksrcpath}/configure |
---|
141 | } |
---|
142 | } |
---|
143 | } |
---|
144 | |
---|
145 | variant readline description {Use readline instead of libedit} { |
---|
146 | patchfiles-delete patch-libedit.diff |
---|
147 | depends_lib-append port:readline |
---|
148 | depends_lib-delete port:libedit |
---|
149 | } |
---|
150 | |
---|
151 | variant universal { |
---|
152 | # This patch will need updating when 2.7.6 is released, as ARCH_RUN_32BIT |
---|
153 | # will once again be used for something. See ticket #39270. |
---|
154 | patchfiles-append patch-configure-universal.diff |
---|
155 | post-patch { |
---|
156 | reinplace \ |
---|
157 | "s|__UNIVERSAL_ARCHFLAGS__|${configure.universal_cflags}|" \ |
---|
158 | ${worksrcpath}/configure |
---|
159 | } |
---|
160 | if {${configure.sdkroot} != ""} { |
---|
161 | configure.args-append --enable-universalsdk=${configure.sdkroot} |
---|
162 | } else { |
---|
163 | configure.args-append --enable-universalsdk=/ |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | variant ucs4 description {Enable support for UCS4} { |
---|
168 | configure.args-append --enable-unicode=ucs4 |
---|
169 | } |
---|
170 | |
---|
171 | livecheck.type regex |
---|
172 | #livecheck.url ${homepage}download/releases/ |
---|
173 | livecheck.url ${homepage}downloads/ |
---|
174 | livecheck.regex Python (${branch}(?:\\.\\d+)*) |
---|