Ticket #20992: Portfile

File Portfile, 9.2 KB (added by royliu@…, 15 years ago)

The patched Portfile.

Line 
1# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id: Portfile 61377 2009-12-09 23:32:32Z jmr@macports.org $
3
4PortSystem          1.0
5
6name                qt4-mac
7conflicts           qt4-mac-devel kdelibs3 libevent
8epoch               1
9version             4.6.0
10revision            1
11categories          aqua
12platforms           macosx
13maintainers         nomaintainer
14
15homepage            http://www.trolltech.com/
16description         Qt Tool Kit (Native Aqua Version)
17long_description    This is Qt, TrollTech's C++ toolkit for writing cross-platform GUI applications. \
18                    This version uses the native Aqua UI. For a X11 version, see qt4-x11.
19master_sites        trolltech
20distname            qt-everywhere-opensource-src-${version}
21
22checksums           md5     2a7b5126f2450d8525af355fc4c12ad6 \
23                    sha1    c2cbbde83f1ebac3b8dd13a112fcad757d395041 \
24                    rmd160  7842b9f4a5364016677fc2162dfd31f1440bb05d
25
26depends_build       port:pkgconfig
27
28depends_lib         port:zlib port:dbus port:openssl port:sqlite3 \
29                    port:tiff port:libpng port:libmng port:jpeg
30
31# Build plugins as bundle files instead of dylib files.
32# Test for Precompiled-headers support requires a C++ compiler, but configure calls it, by default, with a C compiler.
33# Ensure that securesocketclient demo is built even with configure option -openssl-linked.
34patchfiles          patch-mac.conf.diff \
35                    patch-configure.diff \
36                    patch-precomp.test.diff
37
38# The build process uses -fconstant-cfstrings.
39# configure.compiler should therefore not be one of the MacPorts compilers.
40
41# --prefix is not recognized.
42configure.pre_args-delete  --prefix=${prefix}
43# -I${prefix}/include and -L${prefix}/lib must be set in ${configure.args}
44# or else some generated Makefiles will not see them.
45
46################################################################################
47# We do not want flags of any kind -- QT is smart enough to set up its own.    #
48################################################################################
49
50configure.cflags
51configure.cppflags
52configure.cxxflags
53configure.ldflags
54configure.objcflags
55
56configure.universal_cflags
57configure.universal_cppflags
58configure.universal_cxxflags
59configure.universal_ldflags
60
61configure.cc_archflags
62configure.cxx_archflags
63configure.objc_archflags
64configure.ld_archflags
65
66set dirname qt4-mac
67set qt_dir ${prefix}/libexec/${dirname}
68
69#  CPATH is used instead of -I to avoid conflicts with other ports.
70#  See http://trac.macports.org/ticket/15219 and http://trac.macports.org/ticket/18723.
71#
72# -system-sqlite ensures the use SQLite provided by MacPorts instead of Qt.
73#
74# -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
75#     which it is not able to find in ${prefix}.
76# -openssl-linked ensures that the MacPorts openssl is used.
77#
78configure.args                                            \
79    -v                                                    \
80    -debug-and-release                                    \
81    -confirm-license                                      \
82    -opensource                                           \
83    -prefix          ${qt_dir}                            \
84    -docdir          ${prefix}/share/doc/${dirname}       \
85    -examplesdir     ${prefix}/share/${dirname}/examples  \
86    -demosdir        ${prefix}/share/${dirname}/demos     \
87    -system-sqlite                                        \
88    -openssl-linked                                       \
89    -dbus-linked                                          \
90    -L${prefix}/lib                                       \
91    -arch            \"${build_arch}\"
92
93lappend cpath        ${prefix}/include
94lappend library_path ${prefix}/lib
95
96pre-configure {
97    configure.env-append \
98        CPATH=[join ${cpath} :] \
99        LIBRARY_PATH=[join ${library_path} :]
100}
101
102pre-build {
103    build.env-append \
104        CPATH=[join ${cpath} :] \
105        LIBRARY_PATH=[join ${library_path} :]
106}
107
108# Stop configure script from searching for SQL Drivers
109#    not available from MacPorts.
110foreach driver {db2 ibase oci tds} {
111    configure.args-append -no-sql-${driver}
112}
113
114# By default, disable most SQL Drivers.
115# There must be at least one enabled (http://trac.macports.org/ticket/15627).
116# SQLite is chosen to be always enabled because a copy of it is distributed
117#    with Qt, so it is reasonable for the user to expect it.
118foreach driver {mysql odbc psql sqlite2} {
119    configure.args-append -no-sql-${driver}
120}
121
122platform darwin 10 {
123    default_variants +cocoa
124}
125
126variant mysql description {Enable MySQL SQL Driver} {
127    depends_lib-append path:lib/mysql5:mysql5
128
129    lappend cpath        ${prefix}/include/mysql5/mysql
130    lappend library_path ${prefix}/lib/mysql5/mysql
131
132    configure.args-delete -no-sql-mysql
133}
134
135variant odbc description {Enable unixODBC SQL Driver} {
136    depends_lib-append port:unixODBC
137    configure.args-delete -no-sql-odbc
138}
139
140variant psql description {Enable PostgreSQL SQL Driver} {
141    depends_lib-append port:postgresql83
142
143    lappend cpath        ${prefix}/include/postgresql83
144    lappend library_path ${prefix}/lib/postgresql83
145
146    configure.args-delete -no-sql-psql
147}
148
149variant sqlite2 description {Enable SQLite version 2 SQL Driver} {
150    depends_lib-append port:sqlite2
151    configure.args-delete -no-sql-sqlite2
152}
153
154variant cocoa description {Build the Cocoa version of Qt in 32-bit mode} conflicts noframework {
155    configure.args-append  -cocoa
156
157    # Everything might build, but nothing will run.
158    pre-fetch {
159        if { ${os.major} < 9 } {
160            return -code error "Variant cocoa creates Qt binaries which require Mac OS X 10.5 or higher."
161        }
162    }
163}
164
165variant noframework description {Do not build frameworks} conflicts cocoa {
166    configure.args-append   -no-framework
167}
168
169build.target        first
170use_parallel_build  yes
171
172destroot.destdir    INSTALL_ROOT="${destroot}"
173
174post-patch {
175    # Ensure that correct compilers are used.
176    reinplace "s| g++\$| ${configure.cxx}|" ${worksrcpath}/mkspecs/common/g++.conf
177    reinplace "s| gcc\$| ${configure.cc}|"  ${worksrcpath}/mkspecs/common/g++.conf
178    reinplace "s| g++\$| ${configure.cxx}|" ${worksrcpath}/mkspecs/macx-g++/qmake.conf
179}
180
181post-destroot {
182    # Install documentation.
183    foreach doc { INSTALL LGPL_EXCEPTION.txt LICENSE.GPL3 LICENSE.LGPL README } {
184        xinstall -c -m 644 ${worksrcpath}/$doc ${destroot}${prefix}/share/doc/${name}
185    }
186
187    # Create link in ${prefix}/bin to executable files in ${qt_dir}/bin.
188    foreach bin [glob -type f -directory ${destroot}${qt_dir}/bin *] {
189        ln -s ${qt_dir}/bin/[file tail ${bin}] ${destroot}${prefix}/bin
190    }
191
192    xinstall -d -m 0755 ${destroot}${applications_dir}/Qt
193    # Create link in ${applications_dir}/Qt to .app directories in ${qt_dir}/bin/.
194    # Create link in ${prefix}/bin to all *.app/Contents/MacOS/*.
195    foreach app [glob -type d -directory ${destroot}${qt_dir}/bin *.app] {
196        ln -s ${qt_dir}/bin/[file tail ${app}] ${destroot}${applications_dir}/Qt
197        foreach bin [glob -tails -type f -directory ${app}/Contents/MacOS *] {
198            ln -s ${qt_dir}/bin/[file tail ${app}]/Contents/MacOS/${bin} ${destroot}${prefix}/bin
199        }
200    }
201
202    # Avoid conflict with other qt packages.
203    # Ensure lower case names.
204    foreach bin [glob ${destroot}${prefix}/bin/*] {
205        file rename ${bin} ${destroot}${prefix}/bin/[string tolower [file tail ${bin}]]-mac
206    }
207
208    # Fix the .pc and .prl files by removing ${destroot}.
209    foreach fixfile [glob -nocomplain -directory ${destroot} ${qt_dir}/lib/pkgconfig/*.pc ${qt_dir}/lib/*.prl ${qt_dir}/lib/*/*.prl ${prefix}/share/${dirname}/demos/shared/*.prl] {
210        reinplace  \
211            "s|-L${worksrcpath}/lib|-L${qt_dir}/lib|g" \
212            ${fixfile}
213        reinplace  \
214            "s|-F${worksrcpath}/lib|-F${qt_dir}/lib|g" \
215            ${fixfile}
216    }
217
218    # Create link to Frameworks in Frameworks directory.
219    xinstall -d -m 0755 ${destroot}${frameworks_dir}
220    foreach fdir [glob -tails -directory ${destroot}${qt_dir}/lib -nocomplain *.framework] {
221        ln -s ${qt_dir}/lib/${fdir} ${destroot}${frameworks_dir}
222    }
223
224    # The debug .pc files have no counterpart in qt4-x11, so set a link to them in the pkgconfig directory.
225    xinstall -d -m 0755 ${destroot}${prefix}/lib/pkgconfig
226    foreach fl [glob -tails -directory ${destroot}${qt_dir}/lib/pkgconfig *_debug.pc] {
227        ln -s ${qt_dir}/lib/pkgconfig/${fl} ${destroot}${prefix}/lib/pkgconfig/
228    }
229
230    # Install select file for qt4_select.
231    xinstall -m 755 -d ${destroot}${prefix}/etc/select/qt4
232    xinstall -m 644 ${filespath}/${dirname} ${destroot}${prefix}/etc/select/qt4/
233}
234
235variant raster description {Use raster graphics system by default} {
236    configure.args-append   -graphicssystem  raster
237}
238
239variant universal {
240    configure.universal_args-delete --disable-dependency-tracking
241    configure.args-delete -arch            \"${build_arch}\"
242    configure.args-append -arch            \"${universal_archs}\"
243    if {[info exists universal_sysroot]} {
244        configure.args-append -sdk ${universal_sysroot}
245    }
246}
247
248livecheck.type      regex
249livecheck.url       http://qt.nokia.com/downloads/mac-os-cpp
250livecheck.regex     "qt-mac-opensource-src-(4(?:\\.\\d+)*)${extract.suffix}"