source: trunk/dports/lang/pypy/Portfile

Last change on this file was 153316, checked in by mmoll@…, 12 months ago

pypy: add patch for MacOS Sierra. Closes #52369

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.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 153316 2016-09-29 02:10:36Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                pypy
7version             5.4.1
8categories          lang python devel
9license             MIT PSF
10maintainers         jmr openmaintainer
11description         implementation of Python in Python
12long_description \
13   PyPy is both a reimplementation of Python in Python, and a framework for \
14   implementing interpreters and virtual machines for programming languages, \
15   especially dynamic languages.
16
17platforms           darwin
18
19homepage            http://pypy.org/
20master_sites        https://bitbucket.org/pypy/pypy/downloads/
21use_bzip2           yes
22distname            ${name}2-v${version}-src
23checksums           md5 d1d197d16331aa23a7fd4b5d4c3c1717 \
24                    rmd160 1fa3b9972637aeb597970c7b4666db51a6cffbd6 \
25                    sha256 45dbc50c81498f6f1067201b8fc887074b43b84ee32cc47f15e7db17571e9352
26
27depends_build       port:pkgconfig
28depends_lib         port:libffi \
29                    port:sqlite3 \
30                    port:bzip2 \
31                    path:lib/libssl.dylib:openssl \
32                    port:gettext \
33                    port:ncurses
34
35patchfiles          darwin.py.diff \
36                    make_output.diff \
37                    configure.py.diff \
38                    ffiplatform.py.diff \
39                    cbuild.py.diff
40
41post-patch {
42    reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/lib_pypy/cffi/ffiplatform.py \
43                                        ${worksrcpath}/ctypes_configure/cbuild.py
44}
45
46use_configure       no
47
48# use pypy to build if it's already installed
49#if {[file executable ${prefix}/lib/pypy/pypy]} {
50#    build.cmd       ${prefix}/lib/pypy/pypy
51#} else {
52    if {${os.platform} eq "darwin" && ${os.arch} eq "i386" && ![catch {sysctl hw.cpu64bit_capable} is64bit] && $is64bit == 1} {
53        depends_build-append port:pypy-bootstrap
54        build.cmd       ${prefix}/lib/pypy-bootstrap/bin/pypy
55    } else {
56        depends_build-append port:python27
57        build.cmd       ${prefix}/bin/python2.7
58    }
59#}
60
61# a lot of memory is used before the C compiler even runs, so limit build.jobs
62# according to available memory more tightly than the default
63if {![catch {sysctl hw.memsize} memsize]} {
64    if {$build_arch eq "x86_64" || $build_arch eq "ppc64"} {
65        incr memsize -4000000000
66    } else {
67        incr memsize -2000000000
68    }
69    if {$memsize <= 0} {
70        build.jobs 1
71    } elseif {${build.jobs} > $memsize / 1000000000 + 1} {
72        build.jobs [expr {$memsize / 1000000000 + 1}]
73    }
74}
75
76# memory usage bug in gcc 4.2 on x86_64
77if {$build_arch eq "x86_64"} {
78    compiler.blacklist gcc-4.2
79}
80
81platform darwin {
82    # use arch -foo if available
83    if {${os.major} >= 9} {
84        build.cmd arch -${build_arch} ${build.cmd}
85    }
86    # MacOS Sierra patch
87    if {${os.major} >= 16} {
88        patchfiles-append rtime.py.diff
89    }
90}
91build.env           PYPY_USESSION_DIR=${workpath} PYPY_LOCALBASE=${prefix} \
92                    CFLAGS="${configure.cc_archflags} ${configure.cppflags}" \
93                    LDFLAGS="${configure.ld_archflags} ${configure.ldflags}" \
94                    PYPY_CC="${configure.cc}"
95
96build.dir           ${worksrcpath}/pypy/goal
97build.args          --batch --verbose \
98                    --cc=${configure.cc} --opt=jit \
99                    --make-jobs=${build.jobs}
100build.target        ../../rpython/bin/rpython
101build.post_args     targetpypystandalone
102
103# JIT is not available on powerpc at present
104if {${os.arch} ne "i386"} {
105    build.args-delete --opt=jit
106    build.args-append --opt=3
107}
108
109post-build {
110    # some modules have to be compiled in an extra step
111    foreach script {_audioop_build.py _curses_build.py _pwdgrp_build.py _sqlite3_build.py _syslog_build.py} {
112        system -W ${worksrcpath}/lib_pypy "${build.dir}/pypy-c $script"
113    }
114}
115
116destroot {
117    xinstall -d ${destroot}${prefix}/lib/${name}/lib-python
118    copy ${worksrcpath}/lib-python/2.7 ${destroot}${prefix}/lib/${name}/lib-python
119    copy ${worksrcpath}/lib_pypy ${worksrcpath}/include \
120         ${destroot}${prefix}/lib/${name}
121    # library search paths changed quite inconveniently such that the binary
122    # won't run if it's in ${prefix}/bin
123    xinstall -m 755 ${build.dir}/pypy-c ${destroot}${prefix}/lib/${name}/pypy
124    xinstall ${build.dir}/libpypy-c.dylib ${destroot}${prefix}/lib/${name}
125    ln -s ${prefix}/lib/${name}/pypy ${destroot}${prefix}/bin
126
127    xinstall -d ${destroot}${prefix}/share/doc/${name}
128    xinstall -W ${worksrcpath} -m 644 README.rst LICENSE ${destroot}${prefix}/share/doc/${name}
129}
130
131variant opt1 description {use optimization level 1 for faster build (but slower execution)} {
132    depends_lib-append port:boehmgc
133    build.args-delete  --opt=3 --opt=jit
134    build.args-append  --opt=1
135}
136
137livecheck.type      regex
138livecheck.url       http://pypy.org/download.html
139livecheck.regex     pypy2-v(\[0-9.\]+)-src${extract.suffix}
Note: See TracBrowser for help on using the repository browser.