source: trunk/dports/lang/python27/Portfile

Last change on this file was 153800, checked in by larryv@…, 13 months ago

python*: Enable loadable SQLite extensions

This is disabled by default because Apple's system SQLite does not
support loadable extensions. But ours does.

Closes #49317.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 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 153800 2016-10-11 19:38:22Z ryandesign@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            2
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                    enable-loadable-sqlite-extensions.patch
45
46depends_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
54depends_run         port:python_select \
55                    port:python2_select
56
57# disable-ipv6 for now, getaddrinfo-function missing
58configure.args      --enable-framework=${frameworks_dir} \
59                    --enable-ipv6
60
61configure.cppflags-append -I${prefix}/include/db48
62configure.ldflags-append -L${prefix}/lib/db48
63
64configure.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
68configure.cflags-append -fwrapv
69
70post-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
82post-configure {
83    reinplace "s;/* #undef PY_FORMAT_LONG_LONG */;#define PY_FORMAT_LONG_LONG \"ll\";" pyconfig.h
84}
85
86build.target        all
87
88test.run            yes
89test.target         test
90
91destroot.target     frameworkinstall maninstall
92
93# ensure that correct compiler is used
94build.args-append   MAKE="${build.cmd} CC=${configure.cc}"
95destroot.args-append MAKE="${destroot.cmd} CC=${configure.cc}"
96
97set pythonNoDot python[string map {. {}} $branch]
98select.entries      [list python python-$pythonNoDot $pythonNoDot] \
99                    [list python2 python2-$pythonNoDot $pythonNoDot]
100
101notes "
102To make this the default Python or Python 2 (i.e., the version run by\
103the '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
116post-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
137platform darwin {
138    post-patch {
139        if {![file exists /usr/lib/libSystemStubs.a]} {
140            reinplace s/-lSystemStubs//g ${worksrcpath}/configure
141        }
142    }
143}
144
145variant 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
151variant 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
167variant ucs4 description {Enable support for UCS4} {
168    configure.args-append   --enable-unicode=ucs4
169}
170
171livecheck.type          regex
172#livecheck.url           ${homepage}download/releases/
173livecheck.url           ${homepage}downloads/
174livecheck.regex         Python (${branch}(?:\\.\\d+)*)
Note: See TracBrowser for help on using the repository browser.