Ticket #26169: Portfile

File Portfile, 3.7 KB (added by jon.hermansen@…, 14 years ago)

python/py27-pyqt4/Portfile

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$
3
4PortSystem      1.0
5
6name            py27-pyqt4
7version         4.7.5
8categories      python devel
9platforms       macosx
10maintainers     nomaintainer
11description     PyQt4 is a set of Python bindings for the Qt4 toolkit
12long_description \
13    PyQt4 is a set of Python bindings for the Qt4 toolkit. The \
14    bindings are implemented as a set of Python modules: qt, \
15    qtcanvas, qtgl, qtnetwork, qtsql, qttable, qtui and qtxml, \
16    and contains 300 classes and over 5,750 functions and methods.
17
18homepage        http://www.riverbankcomputing.co.uk/software/pyqt/intro
19master_sites    http://www.riverbankcomputing.com/static/Downloads/PyQt4/ \
20                http://pyqwt.sourceforge.net/support/
21distname        PyQt-mac-gpl-${version}
22dist_subdir     python
23
24checksums       md5     8d03927be54f50eae64caab553e9dbed \
25                sha1    6b1b74011c95c9fd999f05e9031ac7b7909302c6 \
26                rmd160  672ba248ae34313d149e6f6d130ffc722b7b93d5
27
28depends_lib     port:py27-sip port:qt4-mac
29
30set pyversion 2.7
31set qt_dir      ${prefix}/libexec/qt4-mac
32
33# The patch file alters configure.py so that the qtdesigner plugin can link.
34# - it ensures that both LFLAGS are included and that the relevant version framework is linked
35patchfiles      patch-configure.py
36post-patch {
37    reinplace "s|@@MACPORTS_PYTHON_FRAMEWORK@@|${frameworks_dir}/Python.framework/Versions/${pyversion}/Python|" ${worksrcpath}/configure.py
38}
39
40pre-configure {
41        file copy -force ${qt_dir}/mkspecs/macx-g++/qmake.conf \
42                ${worksrcpath}/qmake.conf
43
44        reinplace "s|-bundle|-bundle -flat_namespace -undefined suppress|" \
45                ${worksrcpath}/qmake.conf
46}
47
48configure.cmd   "${prefix}/bin/python2.7 configure.py \
49                -q ${qt_dir}/bin/qmake \
50                --confirm-license"
51configure.pre_args
52configure.post_args     LFLAGS="-F${frameworks_dir} -L${prefix}/lib"
53
54variant universal {
55        configure.universal_args
56        configure.post_args     LFLAGS="-F${frameworks_dir} -L${prefix}/lib \
57                                                                ${configure.universal_ldflags}"
58        configure.post_args-append      CFLAGS="${configure.universal_cflags}"
59        configure.post_args-append      CXXFLAGS="${configure.universal_cxxflags}"
60
61}
62
63post-configure {
64        if {[variant_isset universal]} {
65                set conflags ""
66                foreach arch ${configure.universal_archs} {
67                        if {${arch} == "i386"} {append conflags "x86 "} else {
68                                if {${arch} == "ppc64"} {append conflags "ppc_64 "} else {
69                                        append conflags ${arch} " "
70                                }
71                        }
72                }
73
74                set profiles [exec find ${worksrcpath} -name "*.pro"]
75                foreach profile ${profiles} {
76                        reinplace -E "s|^(CONFIG\[ \\t].*)|\\1 ${conflags}|" ${profile}
77               
78                # Cures an isolated case
79                system "cd ${worksrcpath}/designer && \
80                        ${qt_dir}/bin/qmake -spec ${qt_dir}/mkspecs/macx-g++ -macx \
81                                -o Makefile python.pro"
82                }
83        }
84}
85
86
87build.target    all
88use_parallel_build yes
89
90test.run        yes
91test.cmd        cd qt && ${prefix}/bin/python${pyversion} -c 'import PyQt4'
92
93post-destroot {
94    ln -s ${frameworks_dir}/Python.framework/Versions/${pyversion}/bin/pyrcc4 ${destroot}${prefix}/bin/pyrcc4-${pyversion}
95    ln -s ${frameworks_dir}/Python.framework/Versions/${pyversion}/bin/pyuic4 ${destroot}${prefix}/bin/pyuic4-${pyversion}
96
97        xinstall -m 755 -d ${destroot}${prefix}/share/doc
98        file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${name}
99        file copy ${worksrcpath}/examples \
100                ${destroot}${prefix}/share/doc/${name}
101        xinstall -m 644 -W ${worksrcpath} \
102                GPL_EXCEPTION.TXT GPL_EXCEPTION_ADDENDUM.TXT \
103                LICENSE-MERGED-GPL2-GPL3 LICENSE.GPL2 LICENSE.GPL3 OPENSOURCE-NOTICE.TXT NEWS README \
104                THANKS \
105                ${destroot}${prefix}/share/doc/${name}
106}
107
108livecheck.type   regex
109livecheck.url    http://www.riverbankcomputing.co.uk/software/pyqt/download
110livecheck.regex  "PyQt-mac-gpl-(\[0-9.\]\\.\[0-9.\]\\.\[0-9.\]).tar.gz"