# -*- 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 # $Id: port=qt5 1 2014-12-08 18:51:13Z rjvbertin@gmail.com, mcalhoun@macports.org $ # set building_qt5 immediately! set building_qt5 1 PortGroup qt5 1.0 set branch [join [lrange [split ${version} .] 0 1] .] categories aqua platforms macosx maintainers mcalhoun openmaintainer license {LGPL-2.1 GPL-3} homepage http://qt-project.org description Qt Tool Kit 5.3 long_description Qt Tool Kit: A cross-platform framework \ (headers, data, and libraries) for writing \ cross-platform GUI-based applications. \ Installs to ${qt_dir} distname qt-everywhere-opensource-src-${version} master_sites http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/ checksums rmd160 5cd61acc2fbfba2597a386a09d83710ed2fdf483 \ sha256 c8d3fd2ead30705c6673c5e4af6c6f3973346b4fb2bd6079c7be0943a5b0282d if { ${os.major} < 10 } { pre-fetch { ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt." ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested." ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" return -code error "unsupported OS" } } elseif { ${os.major} == 10 } { pre-fetch { ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt." if { [variant_isset universal] } { ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode." ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4." } else { if { ${build_arch} eq "i386" } { ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"." ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4." } else { ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode." ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4." } } ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" } } elseif { ${os.major} > 13 } { pre-fetch { ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt." ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" } } else { # 11 <= ${os.major} <= 13 if { [variant_isset universal] } { pre-fetch { ui_warn "Multiple architectures is not a Reference Configuration for Qt." ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" } } else { if { ${build_arch} eq "i386" } { pre-fetch { ui_warn "32-bit mode is not a Reference Configuration for Qt." ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations" } } } } if { ${subport} eq "${name}-docs" } { universal_variant no } if {[info exists env(QTDIR)]} { ui_msg "unsetting \$QTDIR" unset env(QTDIR) } if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } { # use the qt5 group; set 'building_qt5' so that the portgroup # does not include certain parts PortGroup conflicts_build 1.0 conflicts qt3 qt3-mac #PortGroup xcodeversion 1.0 #minimum_xcodeversions {10 3.2} if {[variant_isset exclusive]} { conflicts-append qt4-mac # See https://bugreports.qt-project.org/browse/QTBUG-34902 conflicts_build-append qt4-mac } # else: the concurrent qt5-mac version ought to be able to co-exist with any qt4-mac version. # Kuba states in https://trac.macports.org/ticket/44207#comment:7 # "There's no reason to have parallel building disabled. Really." #use_parallel_build no # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)" # code from header is used only "ifdef Q_OF_MACH_O" # the two must be consistent # assume the header include code is correct patchfiles-append patch-tst_qpluginloader.diff # When testing, ensure that a universal object file is not inadvertently created. patchfiles-append patch-machtest.diff # On testing of 32-bit systems, # Pre-patch: QCOMPARE(unsigned long const&, unsigned int const& # Post-patch: QCOMPARE(unsigned int const&, unsigned int const& # Function template is only instantiated for same first and second arguments. patchfiles-append patch-tst_qarraydata.diff # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm patchfiles-append patch-tst_benchlibcallgrind.diff # During testing, NSStringFromRect requires NSRect. patchfiles-append patch-tst_qaccessibilitymac_helpers.diff # see #44934 (and #35067 for the qt4-mac version) patchfiles-append patch-shared.diff # see https://bugreports.qt-project.org/browse/QTBUG-41136 patchfiles-append patch-avfmediaplayersession.diff # see https://bugreports.qt-project.org/browse/QTBUG-41367 patchfiles-append patch-qmacstyle_mac.diff # avoid leaving zombies when starting an inexisting executable through QProcess patchfiles-append qprocess-nozombies.patch # add (prepend) ${prefix}/share to the standard search paths so they become XDG-compliant patchfiles-append fix-qstandardpaths.patch variant KDE description {Include a number of patches tailoring Qt5 for use with KDE, and enable useful backtraces into Qt code for debugging} { patchfiles-append correct-systraymenu-iconhandling.patch \ deactivate-menurole-heuristics.patch \ debug-negative-qtimerint.patch configure.args-append -force-debug-info -no-strip -no-separate-debug-info } # patches from Ubuntu 5.3.2+dfsg-4ubuntu8 (from Vivid Velvet) # TODO : check Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch and Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch # for relevance for qstandard_mac.? patchfiles-append remove_icon_from_example.patch \ gnukfreebsd.diff \ fix_bug_in_internal_comparison_operator.patch \ fix_sparc_atomics.patch \ remove_google_adsense.patch \ load_testability_from_env_var.patch \ Add-workaround-for-GL-on-Android-emulator.patch \ dbus_correct_signal_name_disconnect.patch \ Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch \ Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch \ Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch \ disable-generic-plugin-when-others-available.patch \ update-QtBearer-NetworkManager-backend-API.patch \ Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch \ Use-a-property-cache-to-cut-down-on-blocking-calls.patch \ QtBearer-networkmanager-make-sure-to-set-flag-Active.patch \ Always-lock-the-DBus-dispatcher-before-dbus_connecti.patch \ QDBusConnection-Merge-the-dispatch-and-the-watch-and.patch \ Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch \ Break-after-handling-the-read-write.patch # --prefix is not recognised. configure.pre_args-delete --prefix=${prefix} # --disable-dependency-tracking is not recognised. configure.universal_args-delete --disable-dependency-tracking if {${configure.sdkroot} ne ""} { configure.args-append \ -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]] } # NB: -prefix->${prefix} ! configure.args-append \ -prefix ${prefix} \ -archdatadir ${qt_dir} \ -docdir ${qt_docs_dir} \ -headerdir ${qt_includes_dir} \ -plugindir ${qt_plugins_dir} \ -importdir ${qt_imports_dir} \ -qmldir ${qt_qml_dir} \ -datadir ${qt_data_dir} \ -libdir ${qt_frameworks_dir} \ -bindir ${qt_bins_dir} \ -libexecdir ${qt_dir}/libexec \ -translationdir ${qt_translations_dir} \ -sysconfdir ${qt_sysconf_dir} \ -examplesdir ${qt_examples_dir} \ -testsdir ${qt_tests_dir} \ -hostbindir ${qt_bins_dir} \ -hostlibdir ${qt_frameworks_dir} \ -hostdatadir ${qt_host_data_dir} # Configure options: configure.args-append \ -v \ -release \ -opensource \ -confirm-license \ -shared \ -process # Third Party Libraries: configure.args-append \ -no-mtdev \ -no-harfbuzz \ -openssl-linked \ -no-xinput2 \ -no-xcb-xlib # configure options that don't show up in configure --help configure.args-append \ -no-libudev \ -no-egl # Additional options: configure.args-append \ {-make libs} \ {-make tools} \ {-nomake examples} \ {-nomake tests} \ -verbose \ -nis \ -cups \ -iconv \ -no-evdev \ -icu \ -fontconfig \ -no-pch \ -dbus-linked \ -no-xcb \ -glib \ -directfb \ -no-linuxfb \ -no-kms \ -framework if {[variant_isset exclusive]} { configure.args-append -no-optimized-qmake } else { configure.args-append -optimized-qmake } foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } { configure.args-append -no-sql-${driver} } if { ![variant_isset universal] } { configure.args-append "-platform ${qt_qmake_spec}" } else { set merger_configure_args(i386) "-platform ${qt_qmake_spec_32}" set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}" } # configure options that don't show up in configure --help # openvg makes sense only when using X11 ... configure.args-append -no-openvg # Qt builds part of the system using environment provided by MacPorts. # It builds the rest using its own internal environment. # For consistency, clear MacPorts environment. configure.cxx_stdlib configure.sdkroot configure.cc_archflags configure.cxx_archflags configure.objc_archflags configure.objcxx_archflags configure.ld_archflags configure.cppflags if {[variant_isset exclusive]} { configure.cflags configure.cxxflags configure.objcflags configure.objcxxflags configure.ldflags } else { configure.objcflags-append "-g" configure.objcxxflags-append "-g" } configure.pipe no if { [variant_isset universal] } { set merger_arch_flag no } configure.march configure.mtune configure.universal_ldflags configure.universal_cflags configure.universal_cxxflags configure.universal_cppflags } if { ${subport} eq ${name} } { depends_lib \ port:zlib \ port:libpng \ port:jpeg \ port:freetype \ path:bin/dbus-daemon:dbus \ port:openssl \ port:tiff \ port:libmng \ path:lib/pkgconfig/glib-2.0.pc:glib2 \ port:icu \ port:pcre \ port:libiconv # see https://bugreports.qt-project.org/browse/QTBUG-35514 build.target post-patch { #reinplace "s|//opt//local//|${prefix}/|g" ${worksrcpath}/qtbase/src/corelib/io/qstandardpaths_mac.cpp } if { [variant_isset universal] } { merger-post-destroot { foreach arch ${universal_archs_to_use} { set dir ${destroot}-${arch} reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] { reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} } foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] { reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} } foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] { reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} } reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri reinplace \ "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\")|" \ ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake } } post-destroot { # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64 reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri reinplace "/^#else.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri reinplace "/^#endif.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri } # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged # The solution is ???. } post-destroot { # see #44204 foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] { set framework [file rootname [file tail ${f}]] set incname [string map {Qt5 Qt} ${framework}] reinplace "s|-I\${includedir}/${incname}|-I\${includedir}|g" ${f} reinplace "s|includedir=\${prefix}/include|includedir=\${libdir}/${framework}/Headers|g" ${f} } # move items out of the Frameworks directory that are more appropriate to lib directory xinstall -m 775 -d ${destroot}${qt_cmake_module_dir} foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] { xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d} foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] { # ${qt_frameworks_dir} is ${qt_dir}/Library/Frameworks while # ${qt_libs_dir} is ${qt_dir}/lib # unless modified, cmake files will point to a directory that is too high in the directory hierarchy reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f} file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/ } } if {![variant_isset exclusive]} { # get Qt's version numbers set qt_vers [split ${version} "."] set qt_major [lindex ${qt_vers} 0] set qt_minor [lindex ${qt_vers} 1] set qt_patch [lindex ${qt_vers} 2] # link includes and libraries for each actual installed framework # make sure that the target directories exist exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_dir} foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \ -name "*.framework" | \ sed -e "s@${destroot}@@g"] { set tf_full [strsed ${fixfile} {s@\\.framework@@}] set tf [strsed ${tf_full} {g@.*\/@@}] # special for QtWebKit entries set t_minor ${qt_minor} set is_QtWebKit 0 if {[string compare ${tf} QtWebKit] == 0} { set t_minor 9 set is_QtWebKit 1 } # link headers into ${qt_includes_dir}, removing directories # if they are already there first set inc_file ${destroot}${qt_includes_dir}/${tf} if {[file exists ${inc_file}]} { file delete -force ${inc_file} } ln -s ${tf_full}.framework/Headers ${inc_file} # link libraries into ${qt_libs_dir}, all 4 number variants set dr_qt_libs_dir ${destroot}${qt_libs_dir} ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib # copy .prl file, then correct it for library usage copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl # fix TARGET in .prl file reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl # fix PRL_LIBS -F -> -L in .prl file reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl # fix "-framework Qt*" -> "-lQt*" in .prl file reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \ ${dr_qt_libs_dir}/lib${tf}.prl # remove the QMAKE_PRL_BUILD_DIR line from the .prl file reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl # deal with debug files # RJVB: I have *not* tested the block below! if {[variant_isset debug]} { # but not if QtWebKit and +universal, since that one does # not exist (the 32-bit version of the debug library is # larger than fits into the 32-bit filespace). if {[variant_isset debug] && ${is_QtWebKit}} { continue } # link libraries into ${qt_libs_dir}, all 4 number variants ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib # copy .prl file, then correct it for library usage copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl # fix TARGET in .prl file reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl # fix PRL_LIBS -F -> -L in .prl file reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl # fix "-framework Qt*" -> "-lQt*_debug" in .prl file reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl } } ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake${qt_major}.${qt_minor} ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc${qt_major}.${qt_minor} ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic${qt_major}.${qt_minor} ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease${qt_major}.${qt_minor} } xinstall -m 775 -d ${destroot}${qt_pkg_config_dir} foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] { file rename ${f} ${destroot}${qt_pkg_config_dir} } xinstall -m 775 -d ${destroot}${qt_libs_dir}/ foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] { file rename ${f} ${destroot}${qt_libs_dir}/ } # move items out of the bin directory that are more appropriate to the Applications directory xinstall -m 775 -d ${destroot}${qt_apps_dir} foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] { file rename ${f} ${destroot}${qt_apps_dir}/ } if {[variant_isset KDE]} { # expose KF5 styles to Qt5 ... once we know where those styles are stored and if it's still required. #ln -s ${prefix}/lib/kf5??/plugins/styles ${destroot}${qt_plugins_dir}/ } } variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} { depends_lib-append port:harfbuzz configure.args-replace \ -no-harfbuzz \ -system-harfbuzz } variant tests description {Enable tests} { configure.args-replace {-nomake tests} {-make tests} } variant examples description {Build examples} { configure.args-replace {-nomake examples} {-make examples} } variant debug description {Build both release and debug library} { configure.args-replace -release -debug-and-release } } subport ${name}-docs { depends_lib-append \ path:${prefix}/bin/qdoc:${name} \ path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin supported_archs noarch build.target docs destroot.target install_docs post-extract { # For the most part, generated makefiles use ${prefix}/bin/qdoc. # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/. ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/ ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin # Similarly, location of qhelpgenerator is expected in ${worksrcpath} xinstall -d -m 755 ${worksrcpath}/qttools/bin/ ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/ # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target # keeps generating itself over and over again. # This file is only created when the library is being built, however. xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc } } # See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers subport ${name}-sqlite3-plugin { PortGroup qmake5 1.0 depends_lib-append port:sqlite3 # for single architecture, easier to use # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite, # but doesn't work for universal build configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite build.dir ${configure.dir} destroot.dir ${configure.dir} configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\"" } subport ${name}-psql84-plugin { PortGroup qmake5 1.0 depends_lib-append port:postgresql84 # for single architecture, easier to use # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql, # but doesn't work for universal build configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql build.dir ${configure.dir} destroot.dir ${configure.dir} configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\"" } subport ${name}-mysql56-plugin { PortGroup qmake5 1.0 depends_lib-append port:mysql56 # for single architecture, easier to use # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql, # but doesn't work for universal build configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql build.dir ${configure.dir} destroot.dir ${configure.dir} configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\"" } livecheck.type regex livecheck.url http://qt-project.org/downloads livecheck.regex "Qt (5(?:\\.\\d+)*) for Mac"