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