| 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: qt5-1.0.tcl 113952 2013-11-26 18:01:53Z michaelld@macports.org $ |
|---|
| 3 | |
|---|
| 4 | # Copyright (c) 2014 The MacPorts Project |
|---|
| 5 | # All rights reserved. |
|---|
| 6 | # |
|---|
| 7 | # Redistribution and use in source and binary forms, with or without |
|---|
| 8 | # modification, are permitted provided that the following conditions are |
|---|
| 9 | # met: |
|---|
| 10 | # |
|---|
| 11 | # 1. Redistributions of source code must retain the above copyright |
|---|
| 12 | # notice, this list of conditions and the following disclaimer. |
|---|
| 13 | # 2. Redistributions in binary form must reproduce the above copyright |
|---|
| 14 | # notice, this list of conditions and the following disclaimer in the |
|---|
| 15 | # documentation and/or other materials provided with the distribution. |
|---|
| 16 | # 3. Neither the name of Apple Computer, Inc. nor the names of its |
|---|
| 17 | # contributors may be used to endorse or promote products derived from |
|---|
| 18 | # this software without specific prior written permission. |
|---|
| 19 | # |
|---|
| 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|---|
| 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|---|
| 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|---|
| 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|---|
| 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|---|
| 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|---|
| 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|---|
| 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|---|
| 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|---|
| 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|---|
| 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 31 | # |
|---|
| 32 | # |
|---|
| 33 | # This portgroup defines standard settings when using Qt5. |
|---|
| 34 | # |
|---|
| 35 | # Usage: |
|---|
| 36 | # PortGroup qt5 1.0 |
|---|
| 37 | |
|---|
| 38 | # no universal binary support in Qt 5 |
|---|
| 39 | # see http://lists.qt-project.org/pipermail/interest/2012-December/005038.html |
|---|
| 40 | # see also https://bugreports.qt-project.org/browse/QTBUG-24952 |
|---|
| 41 | if { ![exists universal_variant] || [option universal_variant] } { |
|---|
| 42 | PortGroup muniversal 1.0 |
|---|
| 43 | #universal_archs_supported i386 x86_64 |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | # check for +debug variant of this port, and make sure Qt was |
|---|
| 47 | # installed with +debug as well; if not, error out. |
|---|
| 48 | platform darwin { |
|---|
| 49 | pre-extract { |
|---|
| 50 | if {[variant_exists debug] && \ |
|---|
| 51 | [variant_isset debug] && \ |
|---|
| 52 | ![info exists building_qt5]} { |
|---|
| 53 | if {![file exists ${qt_frameworks_dir}/QtCore.framework/QtCore_debug]} { |
|---|
| 54 | return -code error "\n\nERROR:\n\ |
|---|
| 55 | In order to install this port as +debug, |
|---|
| 56 | Qt5 must also be installed with +debug.\n" |
|---|
| 57 | } |
|---|
| 58 | } |
|---|
| 59 | } |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | variant exclusive description {Builds and installs Qt5-mac the older way, such that other Qt versions can NOT be installed alongside it} {} |
|---|
| 63 | |
|---|
| 64 | # standard Qt5 name |
|---|
| 65 | global qt_name |
|---|
| 66 | set qt_name qt5 |
|---|
| 67 | |
|---|
| 68 | # standard install directory |
|---|
| 69 | global qt_dir |
|---|
| 70 | global qt_dir_rel |
|---|
| 71 | # standard Qt documents directory |
|---|
| 72 | global qt_docs_dir |
|---|
| 73 | # standard Qt plugins directory |
|---|
| 74 | global qt_plugins_dir |
|---|
| 75 | # standard Qt mkspecs directory |
|---|
| 76 | global qt_mkspecs_dir |
|---|
| 77 | # standard Qt imports directory |
|---|
| 78 | global qt_imports_dir |
|---|
| 79 | # standard Qt qml directory |
|---|
| 80 | global qt_qml_dir |
|---|
| 81 | # standard Qt includes directory |
|---|
| 82 | global qt_includes_dir |
|---|
| 83 | # standard Qt libraries directory |
|---|
| 84 | global qt_libs_dir |
|---|
| 85 | # standard Qt libraries directory |
|---|
| 86 | global qt_frameworks_dir |
|---|
| 87 | global qt_frameworks_dir_rel |
|---|
| 88 | # standard Qt non-.app executables directory |
|---|
| 89 | global qt_bins_dir |
|---|
| 90 | # standard Qt data directory |
|---|
| 91 | global qt_data_dir |
|---|
| 92 | # standard Qt translations directory |
|---|
| 93 | global qt_translations_dir |
|---|
| 94 | # standard Qt sysconf directory |
|---|
| 95 | global qt_sysconf_dir |
|---|
| 96 | # standard Qt examples directory |
|---|
| 97 | global qt_examples_dir |
|---|
| 98 | # standard Qt tests directory |
|---|
| 99 | global qt_tests_dir |
|---|
| 100 | # standard Qt demos directory |
|---|
| 101 | global qt_demos_dir |
|---|
| 102 | # standard CMake module directory for Qt-related files |
|---|
| 103 | global qt_cmake_module_dir |
|---|
| 104 | # standard qmake command location |
|---|
| 105 | global qt_qmake_cmd |
|---|
| 106 | # standard moc command location |
|---|
| 107 | global qt_moc_cmd |
|---|
| 108 | # standard uic command location |
|---|
| 109 | global qt_uic_cmd |
|---|
| 110 | # standard lrelease command location |
|---|
| 111 | global qt_lrelease_cmd |
|---|
| 112 | |
|---|
| 113 | global qt5_is_concurrent |
|---|
| 114 | if {![variant_isset exclusive]} { |
|---|
| 115 | # check if we're building qt5 itself |
|---|
| 116 | if {![info exists building_qt5] || ![info exists name] || ${name} ne "qt5-mac"} { |
|---|
| 117 | # no, this must be a dependent port: check the qt5 install: |
|---|
| 118 | if {[file exists ${prefix}/libexec/${qt_name}/bin/qmake]} { |
|---|
| 119 | # we have a "concurrent" install, which means we must look for the various components |
|---|
| 120 | # in different locations (esp. qmake) |
|---|
| 121 | set qt5_is_concurrent 1 |
|---|
| 122 | set auto_concurrent 1 |
|---|
| 123 | ui_msg "NB:\nQt5 has been installed in concurrent mode\n" |
|---|
| 124 | } |
|---|
| 125 | } else { |
|---|
| 126 | # we're building qt5-mac or one of its subports |
|---|
| 127 | if {![info exists qt5_is_concurrent]} { |
|---|
| 128 | ui_msg "NB:\nQt5 has been or will be installed in concurrent mode\n" |
|---|
| 129 | } |
|---|
| 130 | # we're asking for the standard concurrent install. No need to guess anything, give the user what s/he wants |
|---|
| 131 | set qt5_is_concurrent 1 |
|---|
| 132 | set auto_concurrent 1 |
|---|
| 133 | } |
|---|
| 134 | } |
|---|
| 135 | |
|---|
| 136 | if {[info exists qt5_is_concurrent]} { |
|---|
| 137 | set qt_dir ${prefix}/libexec/${qt_name} |
|---|
| 138 | set qt_dir_rel libexec/${qt_name} |
|---|
| 139 | set qt_docs_dir ${prefix}/share/doc/${qt_name} |
|---|
| 140 | set qt_plugins_dir ${prefix}/share/${qt_name}/plugins |
|---|
| 141 | set qt_mkspecs_dir ${prefix}/share/${qt_name}/mkspecs |
|---|
| 142 | set qt_imports_dir ${prefix}/share/${qt_name}/imports |
|---|
| 143 | set qt_qml_dir ${prefix}/share/${qt_name}/qml |
|---|
| 144 | set qt_includes_dir ${prefix}/include/${qt_name} |
|---|
| 145 | set qt_libs_dir ${qt_dir}/lib |
|---|
| 146 | set qt_frameworks_dir ${qt_dir}/Library/Frameworks |
|---|
| 147 | set qt_bins_dir ${qt_dir}/bin |
|---|
| 148 | set qt_data_dir ${prefix}/share/${qt_name} |
|---|
| 149 | set qt_translations_dir ${prefix}/share/${qt_name}/translations |
|---|
| 150 | set qt_sysconf_dir ${prefix}/etc/${qt_name} |
|---|
| 151 | set qt_examples_dir ${prefix}/share/${qt_name}/examples |
|---|
| 152 | set qt_tests_dir ${prefix}/share/${qt_name}/tests |
|---|
| 153 | set qt_demos_dir ${prefix}/share/${qt_name}/demos |
|---|
| 154 | set qt_cmake_module_dir ${prefix}/lib/cmake |
|---|
| 155 | set qt_qmake_cmd ${qt_dir}/bin/qmake |
|---|
| 156 | set qt_moc_cmd ${qt_dir}/bin/moc |
|---|
| 157 | set qt_uic_cmd ${qt_dir}/bin/uic |
|---|
| 158 | set qt_lrelease_cmd ${qt_dir}/bin/lrelease |
|---|
| 159 | } else { |
|---|
| 160 | set qt_dir ${prefix} |
|---|
| 161 | set qt_dir_rel "" |
|---|
| 162 | set qt_docs_dir ${qt_dir}/share/doc/${qt_name} |
|---|
| 163 | set qt_plugins_dir ${qt_dir}/share/${qt_name}/plugins |
|---|
| 164 | set qt_mkspecs_dir ${qt_dir}/share/${qt_name}/mkspecs |
|---|
| 165 | set qt_imports_dir ${qt_dir}/share/${qt_name}/imports |
|---|
| 166 | set qt_qml_dir ${qt_dir}/share/${qt_name}/qml |
|---|
| 167 | set qt_includes_dir ${qt_dir}/include |
|---|
| 168 | set qt_libs_dir ${qt_dir}/lib |
|---|
| 169 | set qt_frameworks_dir ${qt_dir}/Library/Frameworks |
|---|
| 170 | set qt_bins_dir ${qt_dir}/bin |
|---|
| 171 | set qt_data_dir ${qt_dir}/share/${qt_name} |
|---|
| 172 | set qt_translations_dir ${qt_dir}/share/${qt_name}/translations |
|---|
| 173 | set qt_sysconf_dir ${qt_dir}/etc/${qt_name} |
|---|
| 174 | set qt_examples_dir ${qt_dir}/share/${qt_name}/examples |
|---|
| 175 | set qt_tests_dir ${qt_dir}/share/${qt_name}/tests |
|---|
| 176 | set qt_demos_dir ${qt_dir}/share/${qt_name}/demos |
|---|
| 177 | set qt_cmake_module_dir ${qt_libs_dir}/cmake |
|---|
| 178 | set qt_qmake_cmd ${qt_dir}/bin/qmake |
|---|
| 179 | set qt_moc_cmd ${qt_dir}/bin/moc |
|---|
| 180 | set qt_uic_cmd ${qt_dir}/bin/uic |
|---|
| 181 | set qt_lrelease_cmd ${qt_dir}/bin/lrelease |
|---|
| 182 | } |
|---|
| 183 | set qt_frameworks_dir_rel ${qt_dir_rel}/Library/Frameworks |
|---|
| 184 | |
|---|
| 185 | # standard Qt .app executables directory, if created |
|---|
| 186 | global qt_apps_dir |
|---|
| 187 | set qt_apps_dir ${applications_dir}/Qt5 |
|---|
| 188 | |
|---|
| 189 | # standard qmake spec |
|---|
| 190 | # configure script prefers clang (but "[a]dvertise[s] g++ as an alternative on Lion and below"). |
|---|
| 191 | # According to http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations, |
|---|
| 192 | # however, Snow Leopard is only tested on "GCC as provided by Apple" |
|---|
| 193 | # Create a variant for Snow Leopard that uses "-platform macx-g++-32" or "-platform macx-g++"? |
|---|
| 194 | global qt_qmake_spec |
|---|
| 195 | global qt_qmake_spec_32 |
|---|
| 196 | global qt_qmake_spec_64 |
|---|
| 197 | compiler.whitelist clang |
|---|
| 198 | |
|---|
| 199 | set qt_qmake_spec_32 macx-clang-32 |
|---|
| 200 | set qt_qmake_spec_64 macx-clang |
|---|
| 201 | |
|---|
| 202 | if { ![option universal_variant] || ![variant_isset universal] } { |
|---|
| 203 | if { ${build_arch} eq "i386" } { |
|---|
| 204 | set qt_qmake_spec ${qt_qmake_spec_32} |
|---|
| 205 | } else { |
|---|
| 206 | set qt_qmake_spec ${qt_qmake_spec_64} |
|---|
| 207 | } |
|---|
| 208 | } else { |
|---|
| 209 | set qt_qmake_spec "" |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | # standard PKGCONFIG path |
|---|
| 213 | global qt_pkg_config_dir |
|---|
| 214 | set qt_pkg_config_dir ${prefix}/lib/pkgconfig |
|---|
| 215 | |
|---|
| 216 | # data used by qmake |
|---|
| 217 | global qt_host_data_dir |
|---|
| 218 | set qt_host_data_dir ${prefix}/share/${qt_name} |
|---|
| 219 | |
|---|
| 220 | # standard cmake info for Qt5 |
|---|
| 221 | global qt_cmake_defines |
|---|
| 222 | set qt_cmake_defines \ |
|---|
| 223 | "-DQT_QT_INCLUDE_DIR=${qt_includes_dir} \ |
|---|
| 224 | -DQT_QMAKESPEC=${qt_qmake_spec} \ |
|---|
| 225 | -DQT_ZLIB_LIBRARY=${prefix}/lib/libz.dylib \ |
|---|
| 226 | -DQT_PNG_LIBRARY=${prefix}/lib/libpng.dylib" |
|---|
| 227 | |
|---|
| 228 | # allow for depending on either qt5-mac and qt5-mac-devel, simultaneously |
|---|
| 229 | |
|---|
| 230 | if {![info exists building_qt5]} { |
|---|
| 231 | if {${os.platform} eq "darwin"} { |
|---|
| 232 | |
|---|
| 233 | # see if the framework install exists, and if so depend on it; |
|---|
| 234 | # if not, depend on the library version |
|---|
| 235 | |
|---|
| 236 | if {[info exists qt5_is_concurrent]} { |
|---|
| 237 | if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} { |
|---|
| 238 | depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore.framework/QtCore:qt5-mac |
|---|
| 239 | } else { |
|---|
| 240 | depends_lib-append path:libexec/${qt_name}/lib/libQtCore.5.dylib:qt5-mac |
|---|
| 241 | } |
|---|
| 242 | } else { |
|---|
| 243 | if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} { |
|---|
| 244 | depends_lib-append path:Library/Frameworks/QtCore.framework/QtCore:qt5-mac |
|---|
| 245 | } else { |
|---|
| 246 | depends_lib-append path:lib/libQtCore.5.dylib:qt5-mac |
|---|
| 247 | } |
|---|
| 248 | } |
|---|
| 249 | } |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | # standard configure environment, when not building qt5 |
|---|
| 253 | |
|---|
| 254 | if {![info exists building_qt5]} { |
|---|
| 255 | configure.env-append \ |
|---|
| 256 | QTDIR=${qt_dir} \ |
|---|
| 257 | QMAKE=${qt_qmake_cmd} \ |
|---|
| 258 | MOC=${qt_moc_cmd} |
|---|
| 259 | |
|---|
| 260 | if { ![option universal_variant] || ![variant_isset universal] } { |
|---|
| 261 | configure.env-append QMAKESPEC=${qt_qmake_spec} |
|---|
| 262 | } else { |
|---|
| 263 | set merger_configure_env(i386) "QMAKESPEC=${qt_qmake_spec_32}" |
|---|
| 264 | set merger_configure_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}" |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | # make sure the Qt binaries' directory is in the path, if it is |
|---|
| 268 | # not the current prefix |
|---|
| 269 | |
|---|
| 270 | if {${qt_dir} ne ${prefix}} { |
|---|
| 271 | configure.env-append PATH=${qt_dir}/bin:$env(PATH) |
|---|
| 272 | } |
|---|
| 273 | } else { |
|---|
| 274 | configure.env-append QMAKE_NO_DEFAULTS="" |
|---|
| 275 | } |
|---|
| 276 | |
|---|
| 277 | # standard build environment, when not building qt5 |
|---|
| 278 | |
|---|
| 279 | if {![info exists building_qt5]} { |
|---|
| 280 | build.env-append \ |
|---|
| 281 | QTDIR=${qt_dir} \ |
|---|
| 282 | QMAKE=${qt_qmake_cmd} \ |
|---|
| 283 | MOC=${qt_moc_cmd} |
|---|
| 284 | |
|---|
| 285 | if { ![option universal_variant] || ![variant_isset universal] } { |
|---|
| 286 | build.env-append QMAKESPEC=${qt_qmake_spec} |
|---|
| 287 | } else { |
|---|
| 288 | set merger_build_env(i386) "QMAKESPEC=${qt_qmake_spec_32}" |
|---|
| 289 | set merger_build_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}" |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | # make sure the Qt binaries' directory is in the path, if it is |
|---|
| 293 | # not the current prefix |
|---|
| 294 | |
|---|
| 295 | if {${qt_dir} ne ${prefix}} { |
|---|
| 296 | build.env-append PATH=${qt_dir}/bin:$env(PATH) |
|---|
| 297 | } |
|---|
| 298 | } |
|---|
| 299 | |
|---|
| 300 | # use PKGCONFIG for Qt discovery in configure scripts |
|---|
| 301 | depends_build-append port:pkgconfig |
|---|
| 302 | |
|---|
| 303 | # standard destroot environment |
|---|
| 304 | if { ![option universal_variant] || ![variant_isset universal] } { |
|---|
| 305 | destroot.env-append \ |
|---|
| 306 | INSTALL_ROOT=${destroot} |
|---|
| 307 | } else { |
|---|
| 308 | foreach arch ${configure.universal_archs} { |
|---|
| 309 | lappend merger_destroot_env($arch) INSTALL_ROOT=${workpath}/destroot-${arch} |
|---|
| 310 | } |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | # standard destroot environment, when not building qt5 |
|---|
| 314 | |
|---|
| 315 | if {![info exists building_qt5]} { |
|---|
| 316 | destroot.env-append \ |
|---|
| 317 | QTDIR=${qt_dir} \ |
|---|
| 318 | QMAKE=${qt_qmake_cmd} \ |
|---|
| 319 | MOC=${qt_moc_cmd} |
|---|
| 320 | |
|---|
| 321 | if { ![option universal_variant] || ![variant_isset universal] } { |
|---|
| 322 | build.env-append QMAKESPEC=${qt_qmake_spec} |
|---|
| 323 | } else { |
|---|
| 324 | set destroot_build_env(i386) "QMAKESPEC=${qt_qmake_spec_32}" |
|---|
| 325 | set destroot_build_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}" |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | # make sure the Qt binaries' directory is in the path, if it is |
|---|
| 329 | # not the current prefix |
|---|
| 330 | |
|---|
| 331 | if {${qt_dir} ne ${prefix}} { |
|---|
| 332 | destroot.env-append PATH=${qt_dir}/bin:$env(PATH) |
|---|
| 333 | } |
|---|
| 334 | } |
|---|