source: trunk/dports/lang/python27/Portfile @ 152947

Last change on this file since 152947 was 152947, checked in by larryv@…, 14 months ago

python27: Improve check for QuickTime/QuickTime.h

This fixes 32-bit builds on Sierra, which removed that header.

Closes: https://trac.macports.org/ticket/52043

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