Ticket #46496: Portfile.qt5

File Portfile.qt5, 25.5 KB (added by RJVB (René Bertin), 10 years ago)

Portfile payload doing the heavy lifting

Line 
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!
5set building_qt5    1
6
7PortGroup           qt5 1.0
8set branch          [join [lrange [split ${version} .] 0 1] .]
9
10categories          aqua
11platforms           macosx
12maintainers         mcalhoun openmaintainer
13license             {LGPL-2.1 GPL-3}
14
15homepage            http://qt-project.org
16description         Qt Tool Kit 5.3
17long_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
22distname            qt-everywhere-opensource-src-${version}
23
24master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/
25
26checksums           rmd160  5cd61acc2fbfba2597a386a09d83710ed2fdf483 \
27                    sha256  c8d3fd2ead30705c6673c5e4af6c6f3973346b4fb2bd6079c7be0943a5b0282d
28
29if { ${os.major} < 10 } {
30    pre-fetch {
31        ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
32        ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested."
33        ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
34        return -code error "unsupported OS"
35    }
36} elseif { ${os.major} == 10 } {
37    pre-fetch {
38        ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
39        if { [variant_isset universal] } {
40            ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
41            ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
42        } else {
43            if { ${build_arch} eq "i386" } {
44                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"."
45                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
46            } else {
47                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
48                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
49            }
50        }
51        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
52    }
53} elseif { ${os.major} > 13 } {
54    pre-fetch {
55        ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt."
56        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
57    }
58} else {
59    # 11 <= ${os.major} <= 13
60    if { [variant_isset universal] } {
61        pre-fetch {
62            ui_warn "Multiple architectures is not a Reference Configuration for Qt."
63            ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
64        }
65    } else {
66        if { ${build_arch} eq "i386" } {
67            pre-fetch {
68                ui_warn "32-bit mode is not a Reference Configuration for Qt."
69                ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
70            }
71        }
72    }
73}
74
75if { ${subport} eq "${name}-docs"  } {
76    universal_variant no
77}
78
79if {[info exists env(QTDIR)]} {
80    ui_msg "unsetting \$QTDIR"
81    unset env(QTDIR)
82}
83
84if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } {
85    # use the qt5 group; set 'building_qt5' so that the portgroup
86    # does not include certain parts
87    PortGroup           conflicts_build 1.0
88    conflicts           qt3 qt3-mac
89    #PortGroup           xcodeversion 1.0
90
91
92    #minimum_xcodeversions   {10 3.2}
93
94    if {[variant_isset exclusive]} {
95        conflicts-append        qt4-mac
96        # See https://bugreports.qt-project.org/browse/QTBUG-34902
97        conflicts_build-append  qt4-mac
98    }
99    # else: the concurrent qt5-mac version 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    # see #44934 (and #35067 for the qt4-mac version)
127    patchfiles-append patch-shared.diff
128
129    # see https://bugreports.qt-project.org/browse/QTBUG-41136
130    patchfiles-append patch-avfmediaplayersession.diff
131
132    # see https://bugreports.qt-project.org/browse/QTBUG-41367
133    patchfiles-append patch-qmacstyle_mac.diff
134
135    # avoid leaving zombies when starting an inexisting executable through QProcess
136    patchfiles-append qprocess-nozombies.patch
137
138    # add (prepend) ${prefix}/share to the standard search paths so they become XDG-compliant
139    patchfiles-append fix-qstandardpaths.patch
140
141    variant KDE description {Include a number of patches tailoring Qt5 for use with KDE, and enable useful backtraces into Qt code for debugging} {
142        patchfiles-append       correct-systraymenu-iconhandling.patch \
143                                deactivate-menurole-heuristics.patch \
144                                debug-negative-qtimerint.patch
145        configure.args-append   -force-debug-info -no-strip -no-separate-debug-info
146    }
147
148    # patches from Ubuntu 5.3.2+dfsg-4ubuntu8 (from Vivid Velvet)
149    # TODO : check Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch and Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch
150    # for relevance for qstandard_mac.?
151    patchfiles-append           remove_icon_from_example.patch \
152                                gnukfreebsd.diff \
153                                fix_bug_in_internal_comparison_operator.patch \
154                                fix_sparc_atomics.patch \
155                                remove_google_adsense.patch \
156                                load_testability_from_env_var.patch \
157                                Add-workaround-for-GL-on-Android-emulator.patch \
158                                dbus_correct_signal_name_disconnect.patch \
159                                Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch \
160                                Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch \
161                                Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch \
162                                disable-generic-plugin-when-others-available.patch \
163                                update-QtBearer-NetworkManager-backend-API.patch \
164                                Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch \
165                                Use-a-property-cache-to-cut-down-on-blocking-calls.patch \
166                                QtBearer-networkmanager-make-sure-to-set-flag-Active.patch \
167                                Always-lock-the-DBus-dispatcher-before-dbus_connecti.patch \
168                                QDBusConnection-Merge-the-dispatch-and-the-watch-and.patch \
169                                Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch \
170                                Break-after-handling-the-read-write.patch
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        -process
212
213    # Third Party Libraries:
214    configure.args-append \
215        -no-mtdev         \
216        -no-harfbuzz      \
217        -openssl-linked   \
218        -no-xinput2       \
219        -no-xcb-xlib
220
221    # configure options that don't show up in configure --help
222    configure.args-append \
223        -no-libudev       \
224        -no-egl
225
226    # Additional options:
227    configure.args-append    \
228        {-make libs}         \
229        {-make tools}        \
230        {-nomake examples}   \
231        {-nomake tests}      \
232        -verbose             \
233        -nis                 \
234        -cups                \
235        -iconv               \
236        -no-evdev            \
237        -icu                 \
238        -fontconfig          \
239        -no-pch              \
240        -dbus-linked         \
241        -no-xcb              \
242        -glib                \
243        -directfb            \
244        -no-linuxfb          \
245        -no-kms              \
246        -framework
247
248    if {[variant_isset exclusive]} {
249        configure.args-append   -no-optimized-qmake
250    } else {
251        configure.args-append   -optimized-qmake
252    }
253
254    foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } {
255        configure.args-append -no-sql-${driver}
256    }
257
258    if { ![variant_isset universal] } {
259        configure.args-append "-platform ${qt_qmake_spec}"
260    } else {
261        set merger_configure_args(i386)   "-platform ${qt_qmake_spec_32}"
262        set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}"
263    }
264
265    # configure options that don't show up in configure --help
266    # openvg makes sense only when using X11 ...
267    configure.args-append -no-openvg
268
269    # Qt builds part of the system using environment provided by MacPorts.
270    # It builds the rest using its own internal environment.
271    # For consistency, clear MacPorts environment.
272    configure.cxx_stdlib
273    configure.sdkroot
274    configure.cc_archflags
275    configure.cxx_archflags
276    configure.objc_archflags
277    configure.objcxx_archflags
278    configure.ld_archflags
279    configure.cppflags
280    if {[variant_isset exclusive]} {
281        configure.cflags
282        configure.cxxflags
283        configure.objcflags
284        configure.objcxxflags
285        configure.ldflags
286    } else {
287        configure.objcflags-append  "-g"
288        configure.objcxxflags-append  "-g"
289    }
290    configure.pipe  no
291    if { [variant_isset universal] } {
292        set merger_arch_flag no
293    }
294    configure.march
295    configure.mtune
296    configure.universal_ldflags
297    configure.universal_cflags
298    configure.universal_cxxflags
299    configure.universal_cppflags
300}
301
302if { ${subport} eq ${name} } {
303    depends_lib                              \
304        port:zlib                            \
305        port:libpng                          \
306        port:jpeg                            \
307        port:freetype                        \
308        path:bin/dbus-daemon:dbus            \
309        port:openssl                         \
310        port:tiff                            \
311        port:libmng                          \
312        path:lib/pkgconfig/glib-2.0.pc:glib2 \
313        port:icu                             \
314        port:pcre                            \
315        port:libiconv
316
317    # see https://bugreports.qt-project.org/browse/QTBUG-35514
318    build.target
319
320    post-patch {
321        #reinplace "s|//opt//local//|${prefix}/|g" ${worksrcpath}/qtbase/src/corelib/io/qstandardpaths_mac.cpp
322    }
323
324    if { [variant_isset universal] } {
325        merger-post-destroot {
326            foreach arch ${universal_archs_to_use} {
327                set dir ${destroot}-${arch}
328
329                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc
330
331                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
332                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
333                }
334
335                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] {
336                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
337                }
338
339                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
340                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
341                }
342
343                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri
344
345                reinplace \
346                    "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\")|" \
347                    ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
348            }
349        }
350
351        post-destroot {
352            # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64
353            reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri
354            reinplace "/^#else.*$/d"   ${destroot}${qt_mkspecs_dir}/qmodule.pri
355            reinplace "/^#endif.*$/d"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
356        }
357
358        # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged
359        # The solution is ???.
360    }
361
362    post-destroot {
363
364        # see #44204
365        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
366            set framework [file rootname [file tail ${f}]]
367            set incname   [string map {Qt5 Qt} ${framework}]
368            reinplace "s|-I\${includedir}/${incname}|-I\${includedir}|g" ${f}
369            reinplace "s|includedir=\${prefix}/include|includedir=\${libdir}/${framework}/Headers|g" ${f}
370        }
371
372        # move items out of the Frameworks directory that are more appropriate to lib directory
373        xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
374        foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] {
375            xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d}
376            foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] {
377                # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
378                # ${qt_libs_dir}       is  ${qt_dir}/lib
379                # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
380                reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f}
381                file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
382            }
383        }
384
385        if {![variant_isset exclusive]} {
386            # get Qt's version numbers
387
388            set qt_vers [split ${version} "."]
389            set qt_major [lindex ${qt_vers} 0]
390            set qt_minor [lindex ${qt_vers} 1]
391            set qt_patch [lindex ${qt_vers} 2]
392
393            # link includes and libraries for each actual installed framework
394
395            # make sure that the target directories exist
396            exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_dir}
397            foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
398                                 -name "*.framework" | \
399                                 sed -e "s@${destroot}@@g"] {
400
401                set tf_full [strsed ${fixfile} {s@\\.framework@@}]
402                set tf [strsed ${tf_full} {g@.*\/@@}]
403
404                # special for QtWebKit entries
405
406                set t_minor ${qt_minor}
407                set is_QtWebKit 0
408                if {[string compare ${tf} QtWebKit] == 0} {
409                    set t_minor 9
410                    set is_QtWebKit 1
411                }
412
413                # link headers into ${qt_includes_dir}, removing directories
414                # if they are already there first
415
416                set inc_file ${destroot}${qt_includes_dir}/${tf}
417                if {[file exists ${inc_file}]} {
418                    file delete -force ${inc_file}
419                }
420                ln -s ${tf_full}.framework/Headers ${inc_file}
421
422                # link libraries into ${qt_libs_dir}, all 4 number variants
423
424                set dr_qt_libs_dir ${destroot}${qt_libs_dir}
425
426                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
427                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
428                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
429                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
430
431                # copy .prl file, then correct it for library usage
432
433                copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
434
435                # fix TARGET in .prl file
436
437                reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
438
439                # fix PRL_LIBS -F -> -L in .prl file
440
441                reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
442
443                # fix "-framework Qt*" -> "-lQt*" in .prl file
444
445                reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
446                    ${dr_qt_libs_dir}/lib${tf}.prl
447
448                # remove the QMAKE_PRL_BUILD_DIR line from the .prl file
449                reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl
450
451                # deal with debug files
452
453                # RJVB: I have *not* tested the block below!
454                if {[variant_isset debug]} {
455
456                    # but not if QtWebKit and +universal, since that one does
457                    # not exist (the 32-bit version of the debug library is
458                    # larger than fits into the 32-bit filespace).
459
460                    if {[variant_isset debug] && ${is_QtWebKit}} {
461                        continue
462                    }
463
464                    # link libraries into ${qt_libs_dir}, all 4 number variants
465
466                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
467                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
468                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
469                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
470
471                    # copy .prl file, then correct it for library usage
472
473                    copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
474
475                    # fix TARGET in .prl file
476
477                    reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
478
479                    # fix PRL_LIBS -F -> -L in .prl file
480
481                    reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
482
483                    # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
484
485                    reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
486                }
487            }
488
489            ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake${qt_major}.${qt_minor}
490            ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc${qt_major}.${qt_minor}
491            ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic${qt_major}.${qt_minor}
492            ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease${qt_major}.${qt_minor}
493        }
494
495        xinstall -m 775 -d ${destroot}${qt_pkg_config_dir}
496        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
497            file rename ${f} ${destroot}${qt_pkg_config_dir}
498        }
499        xinstall -m 775 -d ${destroot}${qt_libs_dir}/
500        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] {
501            file rename ${f} ${destroot}${qt_libs_dir}/
502        }
503
504        # move items out of the bin directory that are more appropriate to the Applications directory
505        xinstall -m 775 -d ${destroot}${qt_apps_dir}
506        foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] {
507            file rename ${f} ${destroot}${qt_apps_dir}/
508        }
509
510        if {[variant_isset KDE]} {
511            # expose KF5 styles to Qt5 ... once we know where those styles are stored and if it's still required.
512            #ln -s ${prefix}/lib/kf5??/plugins/styles ${destroot}${qt_plugins_dir}/
513        }
514    }
515
516    variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} {
517        depends_lib-append port:harfbuzz
518        configure.args-replace \
519            -no-harfbuzz       \
520            -system-harfbuzz
521    }
522
523    variant tests description {Enable tests} {
524        configure.args-replace {-nomake tests} {-make tests}
525    }
526
527    variant examples description {Build examples} {
528        configure.args-replace {-nomake examples} {-make examples}
529    }
530
531    variant debug description {Build both release and debug library} {
532        configure.args-replace -release -debug-and-release
533    }
534}
535
536subport ${name}-docs {
537    depends_lib-append \
538        path:${prefix}/bin/qdoc:${name} \
539        path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin
540
541    supported_archs   noarch
542
543    build.target      docs
544    destroot.target   install_docs
545
546    post-extract {
547        # For the most part, generated makefiles use ${prefix}/bin/qdoc.
548        # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/.
549        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/
550        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin
551
552        # Similarly, location of qhelpgenerator is expected in ${worksrcpath}
553        xinstall -d -m 755 ${worksrcpath}/qttools/bin/
554        ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/
555
556        # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target
557        #    keeps generating itself over and over again.
558        # This file is only created when the library is being built, however.
559        xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated
560        touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc
561    }
562}
563
564# See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers
565
566subport ${name}-sqlite3-plugin {
567    PortGroup           qmake5 1.0
568
569    depends_lib-append port:sqlite3
570
571    # for single architecture, easier to use
572    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite,
573    #    but doesn't work for universal build
574    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite
575    build.dir     ${configure.dir}
576    destroot.dir  ${configure.dir}
577
578    configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\""
579}
580
581subport ${name}-psql84-plugin {
582    PortGroup           qmake5 1.0
583
584    depends_lib-append port:postgresql84
585
586    # for single architecture, easier to use
587    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql,
588    #    but doesn't work for universal build
589    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql
590    build.dir     ${configure.dir}
591    destroot.dir  ${configure.dir}
592
593    configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\""
594}
595
596subport ${name}-mysql56-plugin {
597    PortGroup           qmake5 1.0
598
599    depends_lib-append port:mysql56
600
601    # for single architecture, easier to use
602    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql,
603    #    but doesn't work for universal build
604    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql
605    build.dir     ${configure.dir}
606    destroot.dir  ${configure.dir}
607
608    configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\""
609}
610
611livecheck.type      regex
612livecheck.url       http://qt-project.org/downloads
613livecheck.regex     "Qt (5(?:\\.\\d+)*) for Mac"