| 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: port=qt5 1 2014-12-08 18:51:13Z rjvbertin@gmail.com, mcalhoun@macports.org $ |
|---|
| 3 | |
|---|
| 4 | # set building_qt5 immediately! |
|---|
| 5 | set building_qt5 1 |
|---|
| 6 | |
|---|
| 7 | PortGroup qt5 2.0 |
|---|
| 8 | set branch [join [lrange [split ${version} .] 0 1] .] |
|---|
| 9 | |
|---|
| 10 | categories aqua |
|---|
| 11 | platforms macosx |
|---|
| 12 | maintainers mcalhoun openmaintainer |
|---|
| 13 | license {LGPL-2.1 GPL-3} |
|---|
| 14 | |
|---|
| 15 | homepage http://qt.io |
|---|
| 16 | description Qt Tool Kit 5.4 |
|---|
| 17 | long_description Qt Tool Kit: A cross-platform framework \ |
|---|
| 18 | (headers, data, and libraries) for writing \ |
|---|
| 19 | cross-platform GUI-based applications. \ |
|---|
| 20 | Installs to ${qt_dir}. |
|---|
| 21 | |
|---|
| 22 | distname qt-everywhere-opensource-src-${version} |
|---|
| 23 | |
|---|
| 24 | master_sites http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/ |
|---|
| 25 | |
|---|
| 26 | use_xz yes |
|---|
| 27 | checksums rmd160 5c6b5a0e3ea6a7d3d9754b87fc502af7a4ff7a85 \ |
|---|
| 28 | sha256 b2d9df47b9fd2fcfa5ebd162e1373b7eddf4759e6ba148c4589f3d8b6628c39c |
|---|
| 29 | |
|---|
| 30 | if { ${os.platform} ne "darwin" } { |
|---|
| 31 | pre-fetch { |
|---|
| 32 | ui_msg "You're on your own on \"${os.platform}\"!!" |
|---|
| 33 | } |
|---|
| 34 | } elseif { ${os.major} < 10 } { |
|---|
| 35 | pre-fetch { |
|---|
| 36 | ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt." |
|---|
| 37 | ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested." |
|---|
| 38 | ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" |
|---|
| 39 | return -code error "unsupported OS" |
|---|
| 40 | } |
|---|
| 41 | } elseif { ${os.major} == 10 } { |
|---|
| 42 | pre-fetch { |
|---|
| 43 | ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt." |
|---|
| 44 | if { [variant_isset universal] } { |
|---|
| 45 | ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode." |
|---|
| 46 | ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4." |
|---|
| 47 | } else { |
|---|
| 48 | if { ${build_arch} eq "i386" } { |
|---|
| 49 | ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"." |
|---|
| 50 | ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4." |
|---|
| 51 | } else { |
|---|
| 52 | ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode." |
|---|
| 53 | ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4." |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" |
|---|
| 57 | } |
|---|
| 58 | } elseif { ${os.major} > 13 } { |
|---|
| 59 | pre-fetch { |
|---|
| 60 | ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt." |
|---|
| 61 | ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" |
|---|
| 62 | } |
|---|
| 63 | } else { |
|---|
| 64 | # 11 <= ${os.major} <= 13 |
|---|
| 65 | if { [variant_isset universal] } { |
|---|
| 66 | pre-fetch { |
|---|
| 67 | ui_warn "Multiple architectures is not a Reference Configuration for Qt." |
|---|
| 68 | ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" |
|---|
| 69 | } |
|---|
| 70 | } else { |
|---|
| 71 | if { ${build_arch} eq "i386" } { |
|---|
| 72 | pre-fetch { |
|---|
| 73 | ui_warn "32-bit mode is not a Reference Configuration for Qt." |
|---|
| 74 | ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" |
|---|
| 75 | } |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | if { ${subport} eq "${name}-docs" } { |
|---|
| 81 | universal_variant no |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | if {[info exists env(QTDIR)]} { |
|---|
| 85 | ui_msg "unsetting \$QTDIR" |
|---|
| 86 | unset env(QTDIR) |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | if { ${subport} eq ${name} || ${subport} eq "${name}-docs" || ${subport} eq "${name}-x11"} { |
|---|
| 90 | # use the qt5 group; set 'building_qt5' so that the portgroup |
|---|
| 91 | # does not include certain parts |
|---|
| 92 | PortGroup conflicts_build 1.0 |
|---|
| 93 | conflicts qt3 qt3-mac |
|---|
| 94 | PortGroup xcodeversion 1.0 |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | minimum_xcodeversions {10 3.2} |
|---|
| 98 | |
|---|
| 99 | # From 5.4.0, qt5-mac ought to be able to co-exist with any qt4-mac version. |
|---|
| 100 | |
|---|
| 101 | # Kuba states in https://trac.macports.org/ticket/44207#comment:7 |
|---|
| 102 | # "There's no reason to have parallel building disabled. Really." |
|---|
| 103 | #use_parallel_build no |
|---|
| 104 | |
|---|
| 105 | # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)" |
|---|
| 106 | # code from header is used only "ifdef Q_OF_MACH_O" |
|---|
| 107 | # the two must be consistent |
|---|
| 108 | # assume the header include code is correct |
|---|
| 109 | patchfiles-append patch-tst_qpluginloader.diff |
|---|
| 110 | |
|---|
| 111 | # When testing, ensure that a universal object file is not inadvertently created. |
|---|
| 112 | patchfiles-append patch-machtest.diff |
|---|
| 113 | |
|---|
| 114 | # On testing of 32-bit systems, |
|---|
| 115 | # Pre-patch: QCOMPARE(unsigned long const&, unsigned int const& |
|---|
| 116 | # Post-patch: QCOMPARE(unsigned int const&, unsigned int const& |
|---|
| 117 | # Function template is only instantiated for same first and second arguments. |
|---|
| 118 | patchfiles-append patch-tst_qarraydata.diff |
|---|
| 119 | |
|---|
| 120 | # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm |
|---|
| 121 | patchfiles-append patch-tst_benchlibcallgrind.diff |
|---|
| 122 | |
|---|
| 123 | # During testing, NSStringFromRect requires NSRect. |
|---|
| 124 | patchfiles-append patch-tst_qaccessibilitymac_helpers.diff |
|---|
| 125 | |
|---|
| 126 | if {${subport} ne "${name}-x11"} { |
|---|
| 127 | # see #44934 (and #35067 for the qt4-mac version) |
|---|
| 128 | patchfiles-append patch-shared.diff |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | # avoid leaving zombies when starting an inexisting executable through QProcess |
|---|
| 132 | patchfiles-append qprocess-nozombies.patch |
|---|
| 133 | |
|---|
| 134 | # add (prepend) ${prefix}/share to the standard search paths so they become XDG-compliant |
|---|
| 135 | patchfiles-append fix-qstandardpaths.patch |
|---|
| 136 | |
|---|
| 137 | # make sure the private headers are always found through the CMake files, |
|---|
| 138 | # even in an out-of-tree build |
|---|
| 139 | patchfiles-append always_include_private_headers.diff |
|---|
| 140 | |
|---|
| 141 | # print out some more info when warning about a menu item already added somewhere else |
|---|
| 142 | patchfiles-append debug-menuItem-already-in-menu.patch |
|---|
| 143 | |
|---|
| 144 | # it's not Qt's role to inform the user constantly if s/he removed fonts that are in Apple's fallback font list |
|---|
| 145 | patchfiles-append dont-warn-missing-fallback-fonts.patch |
|---|
| 146 | |
|---|
| 147 | variant KDE description {Include a number of patches tailoring Qt5 for use with KDE, and enable useful backtraces into Qt code for debugging} { |
|---|
| 148 | patchfiles-append deactivate-menurole-heuristics.patch \ |
|---|
| 149 | debug-negative-qtimerint.patch |
|---|
| 150 | configure.args-append -force-debug-info -no-strip -no-separate-debug-info |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | # patches from Ubuntu 5.3.2+dfsg-4ubuntu8 (from Vivid Velvet) |
|---|
| 154 | # TODO : check Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch and Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch |
|---|
| 155 | # for relevance for qstandard_mac.? |
|---|
| 156 | patchfiles-append remove_icon_from_example.patch \ |
|---|
| 157 | remove_google_adsense.patch \ |
|---|
| 158 | load_testability_from_env_var.patch \ |
|---|
| 159 | Add-workaround-for-GL-on-Android-emulator.patch \ |
|---|
| 160 | disable-generic-plugin-when-others-available.patch \ |
|---|
| 161 | QtBearer-networkmanager-make-sure-to-set-flag-Active.patch \ |
|---|
| 162 | Break-after-handling-the-read-write.patch |
|---|
| 163 | |
|---|
| 164 | # https://bugreports.qt.io/browse/QTBUG-43279 |
|---|
| 165 | patchfiles-append patch-qcompilerdetection_h.diff |
|---|
| 166 | |
|---|
| 167 | if {${subport} ne "${name}-x11"} { |
|---|
| 168 | # allow building without first uninstalling a previous Qt5 version (bug in QtWebEngine 5.4.0) |
|---|
| 169 | patchfiles-append ignore-installed-headers.diff |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | # --prefix is not recognised. |
|---|
| 173 | configure.pre_args-delete --prefix=${prefix} |
|---|
| 174 | |
|---|
| 175 | # --disable-dependency-tracking is not recognised. |
|---|
| 176 | configure.universal_args-delete --disable-dependency-tracking |
|---|
| 177 | |
|---|
| 178 | if {${configure.sdkroot} ne ""} { |
|---|
| 179 | configure.args-append \ |
|---|
| 180 | -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]] |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | # NB: -prefix->${prefix} ! |
|---|
| 184 | configure.args-append \ |
|---|
| 185 | -prefix ${prefix} \ |
|---|
| 186 | -archdatadir ${qt_dir} \ |
|---|
| 187 | -docdir ${qt_docs_dir} \ |
|---|
| 188 | -headerdir ${qt_includes_dir} \ |
|---|
| 189 | -plugindir ${qt_plugins_dir} \ |
|---|
| 190 | -importdir ${qt_imports_dir} \ |
|---|
| 191 | -qmldir ${qt_qml_dir} \ |
|---|
| 192 | -datadir ${qt_data_dir} \ |
|---|
| 193 | -libdir ${qt_frameworks_dir} \ |
|---|
| 194 | -bindir ${qt_bins_dir} \ |
|---|
| 195 | -libexecdir ${qt_dir}/libexec \ |
|---|
| 196 | -translationdir ${qt_translations_dir} \ |
|---|
| 197 | -sysconfdir ${qt_sysconf_dir} \ |
|---|
| 198 | -examplesdir ${qt_examples_dir} \ |
|---|
| 199 | -testsdir ${qt_tests_dir} \ |
|---|
| 200 | -hostbindir ${qt_bins_dir} \ |
|---|
| 201 | -hostlibdir ${qt_frameworks_dir} \ |
|---|
| 202 | -hostdatadir ${qt_host_data_dir} |
|---|
| 203 | |
|---|
| 204 | # Configure options: |
|---|
| 205 | configure.args-append \ |
|---|
| 206 | -v \ |
|---|
| 207 | -release \ |
|---|
| 208 | -opensource \ |
|---|
| 209 | -confirm-license \ |
|---|
| 210 | -shared \ |
|---|
| 211 | -force-pkg-config |
|---|
| 212 | |
|---|
| 213 | # Third Party Libraries: |
|---|
| 214 | configure.args-append \ |
|---|
| 215 | -no-mtdev \ |
|---|
| 216 | -no-harfbuzz \ |
|---|
| 217 | -openssl-linked \ |
|---|
| 218 | -no-xinput2 \ |
|---|
| 219 | -no-xcb \ |
|---|
| 220 | -no-xcb-xlib |
|---|
| 221 | |
|---|
| 222 | # configure options that don't show up in configure --help |
|---|
| 223 | configure.args-append \ |
|---|
| 224 | -no-libudev \ |
|---|
| 225 | -no-egl |
|---|
| 226 | |
|---|
| 227 | # Additional options: |
|---|
| 228 | configure.args-append \ |
|---|
| 229 | {-make libs} \ |
|---|
| 230 | {-make tools} \ |
|---|
| 231 | {-nomake examples} \ |
|---|
| 232 | {-nomake tests} \ |
|---|
| 233 | -verbose \ |
|---|
| 234 | -nis \ |
|---|
| 235 | -cups \ |
|---|
| 236 | -iconv \ |
|---|
| 237 | -no-evdev \ |
|---|
| 238 | -icu \ |
|---|
| 239 | -fontconfig \ |
|---|
| 240 | -no-pch \ |
|---|
| 241 | -dbus-linked \ |
|---|
| 242 | -glib \ |
|---|
| 243 | -directfb \ |
|---|
| 244 | -no-linuxfb \ |
|---|
| 245 | -no-kms \ |
|---|
| 246 | -framework |
|---|
| 247 | |
|---|
| 248 | configure.args-append -optimized-qmake |
|---|
| 249 | |
|---|
| 250 | foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } { |
|---|
| 251 | configure.args-append -no-sql-${driver} |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | if { ![variant_isset universal] } { |
|---|
| 255 | configure.args-append "-platform ${qt_qmake_spec}" |
|---|
| 256 | } else { |
|---|
| 257 | set merger_configure_args(i386) "-platform ${qt_qmake_spec_32}" |
|---|
| 258 | set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}" |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | if {${subport} eq "${name}-x11"} { |
|---|
| 263 | patchfiles-append patch-to-build-xcb.diff |
|---|
| 264 | configure.args-delete -no-xinput2 \ |
|---|
| 265 | -no-xcb \ |
|---|
| 266 | -no-xcb-xlib |
|---|
| 267 | configure.args-append -qt-xcb -xcb-xlib -openvg |
|---|
| 268 | } else { |
|---|
| 269 | # configure options that don't show up in configure --help |
|---|
| 270 | # openvg makes sense only when using X11 ... |
|---|
| 271 | configure.args-append -no-openvg |
|---|
| 272 | } |
|---|
| 273 | |
|---|
| 274 | # Qt builds part of the system using environment provided by MacPorts. |
|---|
| 275 | # It builds the rest using its own internal environment. |
|---|
| 276 | # For consistency, clear MacPorts environment. |
|---|
| 277 | configure.cxx_stdlib |
|---|
| 278 | configure.sdkroot |
|---|
| 279 | configure.cc_archflags |
|---|
| 280 | configure.cxx_archflags |
|---|
| 281 | configure.objc_archflags |
|---|
| 282 | configure.objcxx_archflags |
|---|
| 283 | configure.ld_archflags |
|---|
| 284 | configure.cppflags |
|---|
| 285 | # configure.cflags |
|---|
| 286 | # configure.cxxflags |
|---|
| 287 | # configure.objcflags |
|---|
| 288 | # configure.objcxxflags |
|---|
| 289 | # configure.ldflags |
|---|
| 290 | configure.objcflags-append "-g" |
|---|
| 291 | configure.objcxxflags-append "-g" |
|---|
| 292 | configure.pipe no |
|---|
| 293 | if { [variant_isset universal] } { |
|---|
| 294 | set merger_arch_flag no |
|---|
| 295 | } |
|---|
| 296 | configure.march |
|---|
| 297 | configure.mtune |
|---|
| 298 | configure.universal_ldflags |
|---|
| 299 | configure.universal_cflags |
|---|
| 300 | configure.universal_cxxflags |
|---|
| 301 | configure.universal_cppflags |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | # Qt5 is huge. Enable HFS compression. |
|---|
| 305 | depends_extract-append port:libarchive |
|---|
| 306 | extract.post_args "| bsdtar -x --hfsCompression" |
|---|
| 307 | |
|---|
| 308 | # the QtWebengine components is built using ninja |
|---|
| 309 | depends_build port:ninja |
|---|
| 310 | |
|---|
| 311 | if { ${subport} eq ${name} || ${subport} eq "${name}-x11"} { |
|---|
| 312 | depends_lib \ |
|---|
| 313 | port:zlib \ |
|---|
| 314 | port:libpng \ |
|---|
| 315 | port:jpeg \ |
|---|
| 316 | port:freetype \ |
|---|
| 317 | path:bin/dbus-daemon:dbus \ |
|---|
| 318 | port:openssl \ |
|---|
| 319 | port:tiff \ |
|---|
| 320 | port:libmng \ |
|---|
| 321 | path:lib/pkgconfig/glib-2.0.pc:glib2 \ |
|---|
| 322 | port:icu \ |
|---|
| 323 | port:pcre \ |
|---|
| 324 | port:libiconv |
|---|
| 325 | |
|---|
| 326 | post-extract { file mkdir ${workpath}/build } |
|---|
| 327 | if {${subport} eq "${name}-x11"} { |
|---|
| 328 | default configure.cmd {../${worksrcdir}/qtbase/configure} |
|---|
| 329 | destroot.destdir DESTDIR=${destroot}/tmp |
|---|
| 330 | destroot.env-replace INSTALL_ROOT=${destroot} INSTALL_ROOT=${destroot}/tmp |
|---|
| 331 | } else { |
|---|
| 332 | default configure.cmd {../${worksrcdir}/configure} |
|---|
| 333 | } |
|---|
| 334 | default configure.dir {${workpath}/build} |
|---|
| 335 | default build.dir {${workpath}/build} |
|---|
| 336 | |
|---|
| 337 | # see https://bugreports.qt-project.org/browse/QTBUG-35514 |
|---|
| 338 | build.target |
|---|
| 339 | |
|---|
| 340 | post-patch { |
|---|
| 341 | #reinplace "s|//opt//local//|${prefix}/|g" ${worksrcpath}/qtbase/src/corelib/io/qstandardpaths_mac.cpp |
|---|
| 342 | } |
|---|
| 343 | |
|---|
| 344 | # TODO : check if qtwebengine/src/core always has Release and Debug build directories |
|---|
| 345 | # even when not configured with -force-debug-info -no-strip -no-separate-debug-info |
|---|
| 346 | |
|---|
| 347 | if {${subport} ne "${name}-x11"} { |
|---|
| 348 | pre-build { |
|---|
| 349 | if {[file exists ${workpath}/build/qtwebengine/src/core/Release/obj/src/core/QtWebEngineCore.ninja] \ |
|---|
| 350 | && [file exists ${workpath}/build/qtwebengine/src/core/Debug/obj/src/core/QtWebEngineCore.ninja]} { |
|---|
| 351 | # this is a kludge; should the build system regenerate the ninja files we edited |
|---|
| 352 | # we reinplace them again restarting the `port build` step after the inevitable failure... |
|---|
| 353 | # Should no longer be an issue with the ignore-installed-headers.diff patch file... |
|---|
| 354 | reinplace "s|-I${qt_includes_dir}||g" \ |
|---|
| 355 | ${workpath}/build/qtwebengine/src/core/Release/obj/src/core/QtWebEngineCore.ninja \ |
|---|
| 356 | ${workpath}/build/qtwebengine/src/core/Debug/obj/src/core/QtWebEngineCore.ninja |
|---|
| 357 | } |
|---|
| 358 | } |
|---|
| 359 | } |
|---|
| 360 | |
|---|
| 361 | if { [variant_isset universal] } { |
|---|
| 362 | merger-post-destroot { |
|---|
| 363 | foreach arch ${universal_archs_to_use} { |
|---|
| 364 | set dir ${destroot}-${arch} |
|---|
| 365 | |
|---|
| 366 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc |
|---|
| 367 | |
|---|
| 368 | foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] { |
|---|
| 369 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] { |
|---|
| 373 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] { |
|---|
| 377 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} |
|---|
| 378 | } |
|---|
| 379 | |
|---|
| 380 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri |
|---|
| 381 | |
|---|
| 382 | reinplace \ |
|---|
| 383 | "s|^set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang.*\")$|set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang-32\" \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang\")|" \ |
|---|
| 384 | ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake |
|---|
| 385 | } |
|---|
| 386 | } |
|---|
| 387 | |
|---|
| 388 | post-destroot { |
|---|
| 389 | # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64 |
|---|
| 390 | reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
|---|
| 391 | reinplace "/^#else.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
|---|
| 392 | reinplace "/^#endif.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged |
|---|
| 396 | # The solution is ???. |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | post-destroot { |
|---|
| 400 | |
|---|
| 401 | if {${subport} ne "${name}-x11"} { |
|---|
| 402 | |
|---|
| 403 | # move items out of the Frameworks directory that are more appropriate to lib directory |
|---|
| 404 | xinstall -m 775 -d ${destroot}${qt_cmake_module_dir} |
|---|
| 405 | foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] { |
|---|
| 406 | xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d} |
|---|
| 407 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] { |
|---|
| 408 | # ${qt_frameworks_dir} is ${qt_dir}/Library/Frameworks while |
|---|
| 409 | # ${qt_libs_dir} is ${qt_dir}/lib |
|---|
| 410 | # unless modified, cmake files will point to a directory that is too high in the directory hierarchy |
|---|
| 411 | reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f} |
|---|
| 412 | file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/ |
|---|
| 413 | } |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | # get Qt's version numbers |
|---|
| 417 | |
|---|
| 418 | set qt_vers [split ${version} "."] |
|---|
| 419 | set qt_major [lindex ${qt_vers} 0] |
|---|
| 420 | set qt_minor [lindex ${qt_vers} 1] |
|---|
| 421 | set qt_patch [lindex ${qt_vers} 2] |
|---|
| 422 | |
|---|
| 423 | # link includes and libraries for each actual installed framework |
|---|
| 424 | |
|---|
| 425 | # make sure that the target directories exist |
|---|
| 426 | exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_dir} |
|---|
| 427 | foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \ |
|---|
| 428 | -name "*.framework" | \ |
|---|
| 429 | sed -e "s@${destroot}@@g"] { |
|---|
| 430 | |
|---|
| 431 | set tf_full [strsed ${fixfile} {s@\\.framework@@}] |
|---|
| 432 | set tf [strsed ${tf_full} {g@.*\/@@}] |
|---|
| 433 | |
|---|
| 434 | # special for QtWebKit entries |
|---|
| 435 | |
|---|
| 436 | set t_minor ${qt_minor} |
|---|
| 437 | set is_QtWebKit 0 |
|---|
| 438 | if {[string compare ${tf} QtWebKit] == 0} { |
|---|
| 439 | set t_minor 9 |
|---|
| 440 | set is_QtWebKit 1 |
|---|
| 441 | } |
|---|
| 442 | |
|---|
| 443 | # link headers into ${qt_includes_dir}, removing directories |
|---|
| 444 | # if they are already there first |
|---|
| 445 | |
|---|
| 446 | set inc_file ${destroot}${qt_includes_dir}/${tf} |
|---|
| 447 | if {[file exists ${inc_file}]} { |
|---|
| 448 | ui_msg "*Warning* replacing directory ${inc_file} with a symlink to ${tf_full}.framework/Headers!" |
|---|
| 449 | file delete -force ${inc_file} |
|---|
| 450 | } |
|---|
| 451 | ln -s ${tf_full}.framework/Headers ${inc_file} |
|---|
| 452 | |
|---|
| 453 | # link libraries into ${qt_libs_dir}, all 4 number variants |
|---|
| 454 | |
|---|
| 455 | set dr_qt_libs_dir ${destroot}${qt_libs_dir} |
|---|
| 456 | |
|---|
| 457 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib |
|---|
| 458 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib |
|---|
| 459 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib |
|---|
| 460 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib |
|---|
| 461 | |
|---|
| 462 | # copy .prl file, then correct it for library usage |
|---|
| 463 | |
|---|
| 464 | copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl |
|---|
| 465 | |
|---|
| 466 | # fix TARGET in .prl file |
|---|
| 467 | |
|---|
| 468 | reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl |
|---|
| 469 | |
|---|
| 470 | # fix PRL_LIBS -F -> -L in .prl file |
|---|
| 471 | |
|---|
| 472 | reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl |
|---|
| 473 | |
|---|
| 474 | # fix "-framework Qt*" -> "-lQt*" in .prl file |
|---|
| 475 | |
|---|
| 476 | reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \ |
|---|
| 477 | ${dr_qt_libs_dir}/lib${tf}.prl |
|---|
| 478 | |
|---|
| 479 | # remove the QMAKE_PRL_BUILD_DIR line from the .prl file |
|---|
| 480 | reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl |
|---|
| 481 | |
|---|
| 482 | # deal with debug files |
|---|
| 483 | |
|---|
| 484 | # RJVB: I have *not* tested the block below! |
|---|
| 485 | if {[variant_isset debug]} { |
|---|
| 486 | |
|---|
| 487 | # but not if QtWebKit and +universal, since that one does |
|---|
| 488 | # not exist (the 32-bit version of the debug library is |
|---|
| 489 | # larger than fits into the 32-bit filespace). |
|---|
| 490 | |
|---|
| 491 | if {[variant_isset debug] && ${is_QtWebKit}} { |
|---|
| 492 | continue |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | # link libraries into ${qt_libs_dir}, all 4 number variants |
|---|
| 496 | |
|---|
| 497 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib |
|---|
| 498 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib |
|---|
| 499 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib |
|---|
| 500 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib |
|---|
| 501 | |
|---|
| 502 | # copy .prl file, then correct it for library usage |
|---|
| 503 | |
|---|
| 504 | copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl |
|---|
| 505 | |
|---|
| 506 | # fix TARGET in .prl file |
|---|
| 507 | |
|---|
| 508 | reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl |
|---|
| 509 | |
|---|
| 510 | # fix PRL_LIBS -F -> -L in .prl file |
|---|
| 511 | |
|---|
| 512 | reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl |
|---|
| 513 | |
|---|
| 514 | # fix "-framework Qt*" -> "-lQt*_debug" in .prl file |
|---|
| 515 | |
|---|
| 516 | reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl |
|---|
| 517 | } |
|---|
| 518 | } |
|---|
| 519 | |
|---|
| 520 | ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake-qt${qt_major} |
|---|
| 521 | ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc-qt${qt_major} |
|---|
| 522 | ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic-qt${qt_major} |
|---|
| 523 | ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease-qt${qt_major} |
|---|
| 524 | |
|---|
| 525 | xinstall -m 775 -d ${destroot}${qt_pkg_config_dir} |
|---|
| 526 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] { |
|---|
| 527 | file rename ${f} ${destroot}${qt_pkg_config_dir} |
|---|
| 528 | } |
|---|
| 529 | xinstall -m 775 -d ${destroot}${qt_libs_dir}/ |
|---|
| 530 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] { |
|---|
| 531 | file rename ${f} ${destroot}${qt_libs_dir}/ |
|---|
| 532 | } |
|---|
| 533 | # link back the static libraries to where some Qt components expect them: |
|---|
| 534 | foreach f [exec find ${destroot}${qt_libs_dir} \ |
|---|
| 535 | -name "*.a" | \ |
|---|
| 536 | sed -e "s@${destroot}@@g"] { |
|---|
| 537 | ln -s ${f} ${destroot}${qt_frameworks_dir}/ |
|---|
| 538 | } |
|---|
| 539 | |
|---|
| 540 | # move items out of the bin directory that are more appropriate to the Applications directory |
|---|
| 541 | xinstall -m 775 -d ${destroot}${qt_apps_dir} |
|---|
| 542 | foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] { |
|---|
| 543 | file rename ${f} ${destroot}${qt_apps_dir}/ |
|---|
| 544 | } |
|---|
| 545 | |
|---|
| 546 | if {[variant_isset KDE]} { |
|---|
| 547 | # expose KF5 styles to Qt5 ... once we know where those styles are stored and if it's still required. |
|---|
| 548 | #ln -s ${prefix}/lib/kf5??/plugins/styles ${destroot}${qt_plugins_dir}/ |
|---|
| 549 | } |
|---|
| 550 | } else { |
|---|
| 551 | # everything was installed into ${destroot}/tmp; now cherry-pick the things we want which aren't yet |
|---|
| 552 | # installed through the main port: |
|---|
| 553 | xinstall -d -m 755 ${destroot}${qt_plugins_dir}/platforminputcontexts |
|---|
| 554 | file rename ${destroot}/tmp/${qt_plugins_dir}/platforminputcontexts/libcomposeplatforminputcontextplugin.dylib ${destroot}${qt_plugins_dir}/platforminputcontexts |
|---|
| 555 | xinstall -d -m 755 ${destroot}${qt_plugins_dir}/platforms |
|---|
| 556 | file rename ${destroot}/tmp/${qt_plugins_dir}/platforms/libqxcb.dylib ${destroot}${qt_plugins_dir}/platforms |
|---|
| 557 | xinstall -d -m 755 ${destroot}${qt_cmake_module_dir}/Qt5Gui |
|---|
| 558 | file rename ${destroot}/tmp/${qt_frameworks_dir}/cmake/Qt5Gui/Qt5Gui_QComposePlatformInputContextPlugin.cmake \ |
|---|
| 559 | ${destroot}${qt_cmake_module_dir}/Qt5Gui |
|---|
| 560 | file rename ${destroot}/tmp/${qt_frameworks_dir}/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin.cmake \ |
|---|
| 561 | ${destroot}${qt_cmake_module_dir}/Qt5Gui |
|---|
| 562 | file delete -force ${destroot}/tmp |
|---|
| 563 | } |
|---|
| 564 | |
|---|
| 565 | } |
|---|
| 566 | |
|---|
| 567 | variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} { |
|---|
| 568 | depends_lib-append port:harfbuzz |
|---|
| 569 | configure.args-replace \ |
|---|
| 570 | -no-harfbuzz \ |
|---|
| 571 | -system-harfbuzz |
|---|
| 572 | } |
|---|
| 573 | |
|---|
| 574 | variant tests description {Enable tests} { |
|---|
| 575 | configure.args-replace {-nomake tests} {-make tests} |
|---|
| 576 | } |
|---|
| 577 | |
|---|
| 578 | variant examples description {Build examples} { |
|---|
| 579 | configure.args-replace {-nomake examples} {-make examples} |
|---|
| 580 | } |
|---|
| 581 | |
|---|
| 582 | variant debug description {Build both release and debug library} { |
|---|
| 583 | configure.args-replace -release -debug-and-release |
|---|
| 584 | } |
|---|
| 585 | } |
|---|
| 586 | |
|---|
| 587 | subport ${name}-x11 { |
|---|
| 588 | depends_lib-append port:xorg-xcb-util port:xorg-inputproto \ |
|---|
| 589 | port:xrender port:mesa port:${name} |
|---|
| 590 | description ${description} - the xcb (X11) platform plugin |
|---|
| 591 | long_description ${long_description} This port installs just the xcb \ |
|---|
| 592 | platform plugin, which allows rendering to (remote) X11 servers. |
|---|
| 593 | |
|---|
| 594 | # extract only the qtbase component |
|---|
| 595 | extract.post_args-append ${distname}/qtbase |
|---|
| 596 | } |
|---|
| 597 | |
|---|
| 598 | subport ${name}-docs { |
|---|
| 599 | depends_lib-append \ |
|---|
| 600 | path:${prefix}/bin/qdoc:${name} \ |
|---|
| 601 | path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin |
|---|
| 602 | |
|---|
| 603 | supported_archs noarch |
|---|
| 604 | |
|---|
| 605 | build.target docs |
|---|
| 606 | destroot.target install_docs |
|---|
| 607 | |
|---|
| 608 | post-extract { |
|---|
| 609 | # For the most part, generated makefiles use ${prefix}/bin/qdoc. |
|---|
| 610 | # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/. |
|---|
| 611 | ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/ |
|---|
| 612 | ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin |
|---|
| 613 | |
|---|
| 614 | # Similarly, location of qhelpgenerator is expected in ${worksrcpath} |
|---|
| 615 | xinstall -d -m 755 ${worksrcpath}/qttools/bin/ |
|---|
| 616 | ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/ |
|---|
| 617 | |
|---|
| 618 | # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target |
|---|
| 619 | # keeps generating itself over and over again. |
|---|
| 620 | # This file is only created when the library is being built, however. |
|---|
| 621 | xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated |
|---|
| 622 | touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc |
|---|
| 623 | } |
|---|
| 624 | } |
|---|
| 625 | |
|---|
| 626 | # See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers |
|---|
| 627 | |
|---|
| 628 | subport ${name}-sqlite3-plugin { |
|---|
| 629 | PortGroup qmake5 2.0 |
|---|
| 630 | |
|---|
| 631 | depends_lib-append port:sqlite3 |
|---|
| 632 | |
|---|
| 633 | # extract only the qtbase component |
|---|
| 634 | extract.post_args-append ${distname}/qtbase ${distname}/configure |
|---|
| 635 | # for single architecture, easier to use |
|---|
| 636 | # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite, |
|---|
| 637 | # but doesn't work for universal build |
|---|
| 638 | configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite |
|---|
| 639 | build.dir ${configure.dir} |
|---|
| 640 | destroot.dir ${configure.dir} |
|---|
| 641 | |
|---|
| 642 | configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\"" |
|---|
| 643 | post-destroot { |
|---|
| 644 | xinstall -m 775 -d ${destroot}${qt_cmake_module_dir} |
|---|
| 645 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/ *] { |
|---|
| 646 | file rename ${f} ${destroot}${qt_cmake_module_dir}/ |
|---|
| 647 | } |
|---|
| 648 | } |
|---|
| 649 | } |
|---|
| 650 | |
|---|
| 651 | subport ${name}-psql84-plugin { |
|---|
| 652 | PortGroup qmake5 2.0 |
|---|
| 653 | |
|---|
| 654 | depends_lib-append port:postgresql84 |
|---|
| 655 | |
|---|
| 656 | # extract only the qtbase component |
|---|
| 657 | extract.post_args-append ${distname}/qtbase ${distname}/configure |
|---|
| 658 | # for single architecture, easier to use |
|---|
| 659 | # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql, |
|---|
| 660 | # but doesn't work for universal build |
|---|
| 661 | configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql |
|---|
| 662 | build.dir ${configure.dir} |
|---|
| 663 | destroot.dir ${configure.dir} |
|---|
| 664 | |
|---|
| 665 | configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\"" |
|---|
| 666 | } |
|---|
| 667 | |
|---|
| 668 | subport ${name}-mysql56-plugin { |
|---|
| 669 | PortGroup qmake5 2.0 |
|---|
| 670 | |
|---|
| 671 | depends_lib-append port:mysql56 |
|---|
| 672 | |
|---|
| 673 | # extract only the qtbase component |
|---|
| 674 | extract.post_args-append ${distname}/qtbase ${distname}/configure |
|---|
| 675 | # for single architecture, easier to use |
|---|
| 676 | # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql, |
|---|
| 677 | # but doesn't work for universal build |
|---|
| 678 | configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql |
|---|
| 679 | build.dir ${configure.dir} |
|---|
| 680 | destroot.dir ${configure.dir} |
|---|
| 681 | |
|---|
| 682 | configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\"" |
|---|
| 683 | } |
|---|
| 684 | |
|---|
| 685 | subport ${name}-examples { |
|---|
| 686 | PortGroup qmake5 2.0 |
|---|
| 687 | |
|---|
| 688 | depends_lib-append port:${name} |
|---|
| 689 | |
|---|
| 690 | description ${description} - the examples |
|---|
| 691 | |
|---|
| 692 | # extract only the examples |
|---|
| 693 | extract.post_args-append ${distname}/qtbase/examples/ \ |
|---|
| 694 | ${distname}/qtconnectivity/examples/ \ |
|---|
| 695 | ${distname}/qtdeclarative/examples/ \ |
|---|
| 696 | ${distname}/qtenginio/examples/ \ |
|---|
| 697 | ${distname}/qtlocation/examples/ \ |
|---|
| 698 | ${distname}/qtmacextras/examples/ \ |
|---|
| 699 | ${distname}/qtmultimedia/examples/ \ |
|---|
| 700 | ${distname}/qtquick1/examples/ \ |
|---|
| 701 | ${distname}/qtquickcontrols/examples/ \ |
|---|
| 702 | ${distname}/qtscript/examples/ \ |
|---|
| 703 | ${distname}/qtsensors/examples/ \ |
|---|
| 704 | ${distname}/qtsvg/examples/ \ |
|---|
| 705 | ${distname}/qttools/examples/ \ |
|---|
| 706 | ${distname}/qtwebengine/examples/ \ |
|---|
| 707 | ${distname}/qtwebkit-examples/examples/ \ |
|---|
| 708 | ${distname}/qtxmlpatterns/examples/ |
|---|
| 709 | |
|---|
| 710 | post-extract { |
|---|
| 711 | copy ${filespath}/all-examples.pro ${workpath}/${worksrcdir}/all-examples.pro |
|---|
| 712 | file mkdir ${workpath}/build |
|---|
| 713 | } |
|---|
| 714 | default configure.dir {${workpath}/build} |
|---|
| 715 | configure.pre_args-append ../${worksrcdir}/all-examples.pro |
|---|
| 716 | default build.dir {${workpath}/build} |
|---|
| 717 | } |
|---|
| 718 | |
|---|
| 719 | livecheck.type regex |
|---|
| 720 | livecheck.url http://download.qt.io/archive/qt/5.4/ |
|---|
| 721 | livecheck.regex (\\d+(\\.\\d+)+) |
|---|