| 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 | |
|---|
| 4 | PortSystem 1.0 |
|---|
| 5 | |
|---|
| 6 | name qt4-mac |
|---|
| 7 | conflicts qt4-mac-devel kdelibs3 libevent |
|---|
| 8 | epoch 1 |
|---|
| 9 | version 4.6.0 |
|---|
| 10 | revision 1 |
|---|
| 11 | categories aqua |
|---|
| 12 | platforms macosx |
|---|
| 13 | maintainers nomaintainer |
|---|
| 14 | |
|---|
| 15 | homepage http://www.trolltech.com/ |
|---|
| 16 | description Qt Tool Kit (Native Aqua Version) |
|---|
| 17 | long_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. |
|---|
| 19 | master_sites trolltech |
|---|
| 20 | distname qt-everywhere-opensource-src-${version} |
|---|
| 21 | |
|---|
| 22 | checksums md5 2a7b5126f2450d8525af355fc4c12ad6 \ |
|---|
| 23 | sha1 c2cbbde83f1ebac3b8dd13a112fcad757d395041 \ |
|---|
| 24 | rmd160 7842b9f4a5364016677fc2162dfd31f1440bb05d |
|---|
| 25 | |
|---|
| 26 | depends_build port:pkgconfig |
|---|
| 27 | |
|---|
| 28 | depends_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. |
|---|
| 34 | patchfiles 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. |
|---|
| 42 | configure.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 | |
|---|
| 50 | configure.cflags |
|---|
| 51 | configure.cppflags |
|---|
| 52 | configure.cxxflags |
|---|
| 53 | configure.ldflags |
|---|
| 54 | configure.objcflags |
|---|
| 55 | |
|---|
| 56 | configure.universal_cflags |
|---|
| 57 | configure.universal_cppflags |
|---|
| 58 | configure.universal_cxxflags |
|---|
| 59 | configure.universal_ldflags |
|---|
| 60 | |
|---|
| 61 | configure.cc_archflags |
|---|
| 62 | configure.cxx_archflags |
|---|
| 63 | configure.objc_archflags |
|---|
| 64 | configure.ld_archflags |
|---|
| 65 | |
|---|
| 66 | set dirname qt4-mac |
|---|
| 67 | set 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 | # |
|---|
| 78 | configure.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 | |
|---|
| 93 | lappend cpath ${prefix}/include |
|---|
| 94 | lappend library_path ${prefix}/lib |
|---|
| 95 | |
|---|
| 96 | pre-configure { |
|---|
| 97 | configure.env-append \ |
|---|
| 98 | CPATH=[join ${cpath} :] \ |
|---|
| 99 | LIBRARY_PATH=[join ${library_path} :] |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | pre-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. |
|---|
| 110 | foreach 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. |
|---|
| 118 | foreach driver {mysql odbc psql sqlite2} { |
|---|
| 119 | configure.args-append -no-sql-${driver} |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | platform darwin 10 { |
|---|
| 123 | default_variants +cocoa |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | variant 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 | |
|---|
| 135 | variant odbc description {Enable unixODBC SQL Driver} { |
|---|
| 136 | depends_lib-append port:unixODBC |
|---|
| 137 | configure.args-delete -no-sql-odbc |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | variant 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 | |
|---|
| 149 | variant sqlite2 description {Enable SQLite version 2 SQL Driver} { |
|---|
| 150 | depends_lib-append port:sqlite2 |
|---|
| 151 | configure.args-delete -no-sql-sqlite2 |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | variant 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 | |
|---|
| 165 | variant noframework description {Do not build frameworks} conflicts cocoa { |
|---|
| 166 | configure.args-append -no-framework |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | build.target first |
|---|
| 170 | use_parallel_build yes |
|---|
| 171 | |
|---|
| 172 | destroot.destdir INSTALL_ROOT="${destroot}" |
|---|
| 173 | |
|---|
| 174 | post-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 | |
|---|
| 181 | post-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 | |
|---|
| 235 | variant raster description {Use raster graphics system by default} { |
|---|
| 236 | configure.args-append -graphicssystem raster |
|---|
| 237 | } |
|---|
| 238 | |
|---|
| 239 | variant 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 | |
|---|
| 248 | livecheck.type regex |
|---|
| 249 | livecheck.url http://qt.nokia.com/downloads/mac-os-cpp |
|---|
| 250 | livecheck.regex "qt-mac-opensource-src-(4(?:\\.\\d+)*)${extract.suffix}" |
|---|