source: trunk/dports/python/py-sip/Portfile

Last change on this file was 150898, checked in by michaelld@…, 16 months ago

py*-sip: update to 4.18.1; same SIP API as 4.18.0, so no rev-bump needed for dependent ports.

  • 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 150898 2016-08-01 18:57:41Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           python 1.0
6
7name                py-sip
8categories-append   devel
9maintainers         michaelld openmaintainer
10license             {GPL-2 GPL-3 PSF}
11platforms           macosx
12
13description         create Python bindings for C and C++ libraries
14long_description \
15    SIP is a tool that makes it very easy to create \
16    Python bindings for C and C++ libraries. \
17    It was originally developed to create PyQt, \
18    the Python bindings for the Qt toolkit, \
19    but can be used to create bindings for any \
20    C or C++ library.
21
22homepage            http://www.riverbankcomputing.co.uk/software/sip/intro
23
24version             4.18.1
25
26# from siplib/sip.h.in:
27#
28# Define the current API version number.  SIP must handle modules with
29# the same major number and with the same or earlier minor number.
30# Whenever data structure elements are added they must be appended and
31# the minor number incremented.  Whenever data structure elements are
32# removed or the order changed then the major number must be
33# incremented and the minor number set to 0.
34#
35# SIP 4.18.[0-1] provides SIP API 11.3
36# SIP 4.17.0 provides SIP API 11.2
37# SIP 4.16.[8-9] provides SIP API 11.2
38#  -> BUT: the change is to the private API, not the public one.
39#  -> SO: no rev-bumps are be needed.
40# SIP 4.16.[1-7] provides SIP API 11.1.
41# SIP 4.15.5 provided SIP API 11.0.
42
43set branch          [join [lrange [split ${version} .] 0 1] .]
44set patch           [lindex [split ${version} .] 2]
45
46python.versions     27 34 35
47python.default_version 27
48
49if {${name} ne ${subport}} {
50
51    master_sites        sourceforge:pyqt
52
53    if {${patch} == 0} {
54        distname        sip-${branch}
55    } else {
56        distname        sip-${version}
57    }
58
59    checksums           rmd160 adcbd5a87b375e1b357922b608db45862ccf37ea \
60                        sha256 9bce7a2dbf7f105bf68ad1bab58eebc0ce33087ec40396da756463f086ffa290
61
62    patchfiles          patch-siputils.py.diff \
63                        patch-specs_macx-g++.diff \
64                        patch-configure.py.diff
65
66    use_configure       yes
67    pre-configure {
68        # Ensure correct compilers are used
69        reinplace "s|@CC@|${configure.cc}|" \
70            ${worksrcpath}/specs/macx-g++
71        reinplace "s|@CXX@|${configure.cxx}|" \
72            ${worksrcpath}/specs/macx-g++
73    }
74
75    post-configure {
76        # fix sip bin name
77        reinplace "s|bin/sip|bin/sip-${python.branch}|g" \
78            ${worksrcpath}/sipconfig.py
79    }
80
81    configure.cmd       ${python.bin} configure.py
82    configure.pre_args  -d ${python.bin} \
83                        -e ${python.include} \
84                        -v ${prefix}/share/sip \
85                        -p macx-g++ \
86                        --bindir=${prefix}/bin \
87                        --destdir=${python.pkgd} \
88                        --incdir=${python.include} \
89                        --sipdir=${prefix}/share/${subport}
90
91    # always add some arch flags, since the user might have overridden
92    # the default arch build (e.g., ticket #44086).
93
94    python.add_archflags    no
95    if {[variant_isset universal]} {
96
97        foreach arch ${configure.universal_archs} {
98            configure.args-append   "--arch=${arch}"
99        }
100        configure.universal_args
101        configure.post_args LFLAGS="-F${frameworks_dir} -L${prefix}/lib \
102                                    ${configure.universal_ldflags}"
103        configure.post_args-append  CFLAGS="${configure.universal_cflags}"
104        configure.post_args-append  CXXFLAGS="${configure.universal_cxxflags}"
105
106    } else {
107
108        configure.args-append       "--arch=${configure.build_arch}"
109        configure.post_args LFLAGS="-F${frameworks_dir} -L${prefix}/lib \
110                                    ${configure.ld_archflags}"
111        configure.post_args-append  CFLAGS="${configure.cc_archflags}"
112        configure.post_args-append  CXXFLAGS="${configure.cxx_archflags}"
113
114    }
115
116    if {[vercmp ${xcodeversion} 4.3] < 0} {
117        set sdk_dir ${developer_dir}/SDKs
118    } else {
119        set sdk_dir ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
120    }
121
122    switch ${os.major} {
123        8   { configure.args-append   "--sdk=${sdk_dir}/MacOSX10.4u.sdk" }
124        9   { configure.args-append   "--sdk=${sdk_dir}/MacOSX10.5.sdk" }
125        10  { configure.args-append   "--sdk=${sdk_dir}/MacOSX10.6.sdk" }
126        11  { configure.args-append   "--sdk=${sdk_dir}/MacOSX10.7.sdk" }
127        12  { configure.args-append   "--sdk=${sdk_dir}/MacOSX10.8.sdk" }
128        13  { configure.args-append   "--sdk=${sdk_dir}/MacOSX10.9.sdk" }
129    }
130
131    build.cmd           make
132    build.target        all
133
134    test.run    yes
135    test.cmd    cd siplib && ${python.bin} -c 'import sip'
136
137    destroot.cmd        make
138    destroot.destdir    DESTDIR=${destroot}
139
140    # Move ${prefix}/bin/sip to ${prefix}/bin/sip-${python.branch} for
141    # all Python versions.
142    python.move_binaries yes
143
144    post-destroot {
145        xinstall -m 755 -d ${destroot}${prefix}/share/doc
146        file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${subport}
147        xinstall -m 644 -W ${worksrcpath} LICENSE LICENSE-GPL2 LICENSE-GPL3 NEWS README \
148            ${destroot}${prefix}/share/doc/${subport}
149        system "${python.bin} ${python.libdir}/compileall.py ${destroot}${prefix}"
150        system "${python.bin} -O ${python.libdir}/compileall.py ${destroot}${prefix}"
151    }
152
153    notes "${subport} is available under a PSF license with one addition: \n
154    4. Licensee may not use SIP to generate Python bindings for any C or
155       C++ library for which bindings are already provided by Riverbank. \n
156GPL-2 or GPL-3 licenses are also available. For details see
157${prefix}/share/doc/${subport}/LICENSE \[-GPL2 -GPL3\]\n\n"
158
159}
160
161if {[string last devel ${subport}] != -1} {
162
163    livecheck.type   none
164
165} else {
166
167    livecheck.type   regex
168    livecheck.url       http://www.riverbankcomputing.co.uk/software/sip/download
169    livecheck.regex     sip-(\\d+(\\.\\d+)+)${extract.suffix}
170
171}
Note: See TracBrowser for help on using the repository browser.