Ticket #48024: qt5mac-mindiff+review.diff

File qt5mac-mindiff+review.diff, 19.3 KB (added by RJVB (René Bertin), 9 years ago)

updated for Qt 5.4.2

  • Portfile

    old new  
    33
    44PortSystem          1.0
    55
     6# RJVB: at the time of the initial request for a Qt5 port, the opinion was voiced and supported by michaelld
     7# that it should be called simply qt5 . I adhere to that opinion because there will be no "non-mac" Qt5 port.
     8# Instead, it is possible to create (and I have implemented) a qt5-x11 subport that installs the xcb platform
     9# plugin in the Qt5 plugin directory. Semantics, but it would be weird to call it qt5-mac-x11 ...
    610name                qt5-mac
    711version             5.4.2
    812set branch          [join [lrange [split ${version} .] 0 1] .]
     
    1216maintainers         mcalhoun openmaintainer
    1317license             {LGPL-2.1 GPL-3}
    1418
    15 homepage            http://qt-project.org
    16 description         Qt Tool Kit
     19homepage            http://qt.io
     20description         Qt Tool Kit ${branch}
    1721long_description    Qt Tool Kit: A cross-platform framework \
    1822    (headers, data, and libraries) for writing \
    1923    cross-platform GUI-based applications.
    2024
    2125distname            qt-everywhere-opensource-src-${version}
    2226
    23 master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/
     27master_sites        http://download.qt.io/official_releases/qt/${branch}/${version}/single/
    2428
    2529checksums           rmd160  3382c482a99e114560f56a9fe9501b8cabf334a9 \
    2630                    sha256  cfc768c55f0a0cd232bed914a9022528f8f2e50cb010bf0e4f3f62db3dfa17bd
     
    7377    # See https://bugreports.qt.io/browse/QTBUG-34902
    7478    conflicts_build-append  qt4-mac
    7579
    76     # Kuba states in https://trac.macports.org/ticket/44207#comment:7 
     80    # Kuba states in https://trac.macports.org/ticket/44207#comment:7
    7781    #  "There's no reason to have parallel building disabled. Really."
    7882    #use_parallel_build no
    7983
     
    135139        set libreplace [string repeat ../ [llength ${qt_list}]][join ${framework_list} /]
    136140        if { ${libreplace} ne "lib" } {
    137141            patchfiles-append patch-shared.diff
    138             reinplace "s|__MACPORTS_FRAMWORK_DIR__|${libreplace}|g" ${worksrcpath}/qttools/src/macdeployqt/shared/shared.cpp
     142            # RJVB: reinplace should be done in the post-patch
     143            post-patch {
     144                reinplace "s|__MACPORTS_FRAMWORK_DIR__|${libreplace}|g" ${worksrcpath}/qttools/src/macdeployqt/shared/shared.cpp
     145            }
    139146        }
    140147    }
    141148
     
    152159    #-hostbindir    HOSTPREFIX/bin
    153160    #-hostlibdir    HOSTPREFIX/lib
    154161    configure.args-append                      \
    155         -prefix         ${qt_dir}              \
     162        -prefix         ${prefix}              \
    156163        -bindir         ${qt_bins_dir}         \
    157164        -headerdir      ${qt_includes_dir}     \
    158         -libdir         ${qt_libs_dir}         \
     165        -libdir         ${qt_frameworks_dir}   \
    159166        -archdatadir    ${qt_archdata_dir}     \
    160167        -plugindir      ${qt_plugins_dir}      \
    161168        -importdir      ${qt_imports_dir}      \
     
    166173        -sysconfdir     ${qt_sysconf_dir}      \
    167174        -examplesdir    ${qt_examples_dir}     \
    168175        -testsdir       ${qt_tests_dir}        \
    169         -hostdatadir    ${qt_host_data_dir}
     176        -hostdatadir    ${qt_host_data_dir}    \
     177        -hostbindir     ${qt_bins_dir}         \
     178        -hostlibdir     ${qt_frameworks_dir}
     179
    170180
    171181    # Configure options:
     182    # RJVB : -c++11 is the default (when auto-detection detects it's supported) and it
     183    # is probably best left implicit (e.g. for building on earlier OS X versions) => remove -c++11
    172184    configure.args-append \
    173185        -release          \
    174186        -opensource       \
     
    177189        -shared           \
    178190        -largefile        \
    179191        -accessibility
    180    
    181     foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } {
     192
     193    # RJVB/pixilla: the sqlite3 plugin ("sqlite") should  be re-absorbed into the main port
     194    configure.args-append -system-sqlite
     195    depends_lib-append port:sqlite3
     196    foreach driver { db2 ibase mysql oci odbc psql sqlite2 tds } {
    182197        configure.args-append -no-sql-${driver}
    183198    }
    184199
     200    # RJVB: -qml-debug is the default
    185201    configure.args-append \
    186202        -qml-debug
    187203
     
    196212        -force-pkg-config
    197213
    198214    # Third Party Libraries:
     215    # RJVB : Qt has no business depending on PulseAudio on OS X; it only pulls in undesirable dependencies (like gnome...)
    199216    configure.args-append   \
    200217        -system-zlib        \
    201218        -no-mtdev           \
     
    216233        -no-gtkstyle
    217234
    218235    # Additional options:
     236    # RJVB: what's the point in not optimising qmake? Any increase in configure time (which I don't believe in)
     237    # can be compensated by patching the configure script so it builds qmake with -j${build.jobs} .
    219238    configure.args-append       \
    220239        {-make libs}            \
    221240        {-make tools}           \
     
    243262        -no-linuxfb             \
    244263        -no-kms                 \
    245264        -no-system-proxies
    246    
     265
    247266    # MacOS/iOS options:
    248267    configure.args-append    \
    249268        -framework
     
    252271        configure.args-append \
    253272            -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]]
    254273    }
    255    
     274
    256275    # configure options that don't show up in configure --help
    257276    configure.args-append \
    258277        -no-libudev       \
     
    288307}
    289308
    290309if { ${subport} eq ${name} } {
     310    # RJVB: port:pulseaudio should disappear from this list when Qt is configured *without* PA support
    291311    depends_lib                              \
    292312        port:zlib                            \
    293313        port:libpng                          \
     
    325345
    326346                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri
    327347                reinplace "s|macx-clang-32|macx-clang|g"              ${dir}${qt_libs_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
    328                
    329                
     348
     349
    330350                if { [variant_isset examples] } {
    331351                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile
    332352                    reinplace -E "/\\w*-arch \\\\/d"                      ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile
     
    358378
    359379    post-destroot {
    360380        # see #44204
    361         foreach f [glob -nocomplain -tails -directory ${destroot}${qt_libs_dir} *.framework] {
    362             set framework [file rootname ${f}]
     381        # RJVB: use the code below ">>>..." instead of this block, which fails to populate qt_includes_dir completely.
     382#         foreach f [glob -nocomplain -tails -directory ${destroot}${qt_libs_dir} *.framework] {
     383#             set framework [file rootname ${f}]
     384#
     385#             set include_list   [split ${qt_includes_dir}   '/']
     386#             set framework_list [split ${qt_libs_dir} '/']
     387#
     388#             while {[llength ${include_list}] && [llength ${framework_list}]} {
     389#                 set var_include   [lindex $include_list   0]
     390#                 set var_framework [lindex $framework_list 0]
     391#
     392#                 if { ${var_include} ne ${var_framework} } {
     393#                     break
     394#                 }
     395#
     396#                 # remove first element from list
     397#                 set include_list   [lreplace ${include_list} 0 0]
     398#                 set framework_list [lreplace ${framework_list} 0 0]
     399#             }
     400#
     401#             ln -s [string repeat ../ [llength ${include_list}]][join ${framework_list} /]/${f}/Headers ${destroot}${qt_includes_dir}/${framework}
     402#         }
     403
     404        # RJVB: tried and true logic copied from the qt4-mac port
     405        # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
     406        # move items out of the Frameworks directory that are more appropriate to lib directory
     407        xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
     408        foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] {
     409            xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d}
     410            foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] {
     411                # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
     412                # ${qt_libs_dir}       is  ${qt_dir}/lib
     413                # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
     414                reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f}
     415                file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
     416            }
     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        # make sure that the target directories exist
     425        exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_dir}
     426        foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
     427                             -name "*.framework" | \
     428                             sed -e "s@${destroot}@@g"] {
     429
     430                set tf_full [strsed ${fixfile} {s@\\.framework@@}]
     431                set tf [strsed ${tf_full} {g@.*\/@@}]
     432
     433                # special for QtWebKit entries
     434                set t_minor ${qt_minor}
     435                set is_QtWebKit 0
     436                if {[string compare ${tf} QtWebKit] == 0} {
     437                    set t_minor 9
     438                    set is_QtWebKit 1
     439                }
     440
     441                # link headers into ${qt_includes_dir}, removing directories
     442                # if they are already there first
     443                set inc_file ${destroot}${qt_includes_dir}/${tf}
     444                if {[file exists ${inc_file}]} {
     445                    ui_msg "*Warning* replacing directory ${inc_file} with a symlink to ${tf_full}.framework/Headers!"
     446                    file delete -force ${inc_file}
     447                }
     448                ln -s ${tf_full}.framework/Headers ${inc_file}
     449
     450                # link libraries into ${qt_libs_dir}, all 4 number variants
     451                set dr_qt_libs_dir ${destroot}${qt_libs_dir}
     452                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
     453                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
     454                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
     455                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
     456
     457                # copy .prl file, then correct it for library usage
     458                copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
     459
     460                # fix TARGET in .prl file
     461                reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
     462
     463                # fix PRL_LIBS -F -> -L in .prl file
     464                reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
     465
     466                # fix "-framework Qt*" -> "-lQt*" in .prl file
     467                reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
     468                    ${dr_qt_libs_dir}/lib${tf}.prl
     469
     470                # remove the QMAKE_PRL_BUILD_DIR line from the .prl file
     471                reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl
    363472
    364             set include_list   [split ${qt_includes_dir}   '/']
    365             set framework_list [split ${qt_libs_dir} '/']
     473                # deal with debug files
     474                # RJVB: this is the only block I never tested
     475                if {[variant_isset debug]} {
    366476
    367             while {[llength ${include_list}] && [llength ${framework_list}]} {
    368                 set var_include   [lindex $include_list   0]
    369                 set var_framework [lindex $framework_list 0]
     477                    # but not if QtWebKit and +universal, since that one does
     478                    # not exist (the 32-bit version of the debug library is
     479                    # larger than fits into the 32-bit filespace).
    370480
    371                 if { ${var_include} ne ${var_framework} } {
    372                     break
     481                    if {[variant_isset debug] && ${is_QtWebKit}} {
     482                        continue
     483                    }
     484
     485                    # link libraries into ${qt_libs_dir}, all 4 number variants
     486                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
     487                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
     488                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
     489                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
     490
     491                    # copy .prl file, then correct it for library usage
     492                    copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
     493
     494                    # fix TARGET in .prl file
     495                    reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     496
     497                    # fix PRL_LIBS -F -> -L in .prl file
     498                    reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     499
     500                    # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
     501                    reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     502                }
     503            }
     504            # RJVB: spoiler: reference to the qt5*-kde subport
     505            if {${subport} eq ${name} || ${subport} eq "${name}-kde"} {
     506                ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake-qt${qt_major}
     507                ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc-qt${qt_major}
     508                ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic-qt${qt_major}
     509                ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease-qt${qt_major}
     510            }
     511            if {${qt_pkg_config_dir} ne "${qt_frameworks_dir}/pkgconfig"} {
     512                # move the pkgconfig files to their assigned location
     513                foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
     514                    file rename ${f} ${destroot}${qt_pkg_config_dir}
     515                }
     516            }
     517            if {${qt_libs_dir} ne ${qt_frameworks_dir}} {
     518                xinstall -m 775 -d ${destroot}${qt_libs_dir}/
     519                foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] {
     520                    file rename ${f} ${destroot}${qt_libs_dir}/
    373521                }
    374522
    375                 # remove first element from list
    376                 set include_list   [lreplace ${include_list} 0 0]
    377                 set framework_list [lreplace ${framework_list} 0 0]
     523                # link back the static libraries to where some Qt components expect them:
     524                foreach f [exec find ${destroot}${qt_libs_dir} \
     525                                     -name "*.a" | \
     526                                     sed -e "s@${destroot}@@g"] {
     527                    ln -s ${f} ${destroot}${qt_frameworks_dir}/
     528                }
     529                # certain applications might expect to find the following .prl files in ${qt_frameworks_dir}
     530                foreach fixfile { libQt5OpenGLExtensions_debug.prl libQt5PlatformSupport_debug.prl \
     531                                    libQt5QmlDevTools.prl libQt5UiTools.prl libQt5UiTools_debug.prl } {
     532                    if {[file exists ${destroot}${qt_libs_dir}/${fixfile}]} {
     533                        ln -s ${qt_libs_dir}/${fixfile} ${destroot}${qt_frameworks_dir}/${fixfile}
     534                    }
     535                }
    378536            }
    379537
    380             ln -s [string repeat ../ [llength ${include_list}]][join ${framework_list} /]/${f}/Headers ${destroot}${qt_includes_dir}/${framework}
    381         }
     538            # Move .apps into the applications_dir, and link each .apps'
     539            # executable back into ${qt_bins_dir}
     540            set dr_qt_apps_dir ${destroot}${qt_apps_dir}
     541            set dr_qt_bins_dir ${destroot}${qt_bins_dir}
     542            xinstall -m 755 -d ${dr_qt_apps_dir}
     543            foreach app [glob -nocomplain ${dr_qt_bins_dir}/*.app] {
     544                # remove the leading stuff
     545                set app [lindex [split ${app} /] end]
     546                # move the .app
     547                move ${dr_qt_bins_dir}/${app} ${dr_qt_apps_dir}
     548                # link it back
     549                ln -s ${qt_apps_dir}/${app} ${dr_qt_bins_dir}
     550                # provide a proxy to the app's executable; symlinks won't
     551                # be accepted by qtchooser if the user has that port installed.
     552                # RJVB: requires ${filespath}/appProxy.sh
     553#                 set texe [strsed ${app} {g@\.app@@}]
     554#                 set appProxy ${dr_qt_bins_dir}/[string tolower ${texe}]
     555#                 copy ${filespath}/appProxy.sh ${appProxy}
     556#                 reinplace "s|@BUNDLEEXEC@|${qt_apps_dir}/${app}/Contents/MacOS/${texe}|g" ${appProxy}
     557
     558            }
     559            if {[file exists ${destroot}${qt_mkspecs_dir}/qmodule.pri]} {
     560                # clean up the generated mkspecs/qmodule.pri:
     561                # undo any symlink normalisation that introduced the clang version number into QMAKE_CC/CXX (e.g. clang++-mp-3.5)
     562                reinplace "s|bin/clang-mp-.*|bin/clang|g"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
     563                reinplace "s|bin/clang\+\+-mp-.*|bin/clang\+\+|g"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
     564            }
     565            if {[file exists ${destroot}${qt_mkspecs_dir}/qmodule.pri]} {
     566                # if the user used configure.optflags="-something" make sure that gets added to compiler options qmake
     567                # determines, rather than replacing all of those
     568                reinplace "s|QMAKE_CFLAGS = |QMAKE_CFLAGS \+= |g"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
     569                reinplace "s|QMAKE_CXXFLAGS = |QMAKE_CXXFLAGS \+= |g"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
     570            }
     571            #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    382572    }
    383573
    384574    variant tests description {Enable tests} {
     
    394584    }
    395585}
    396586
     587# RJVB: the docs subport should be renamed such that it comes last during an `upgrade outdated`
    397588subport ${name}-docs {
    398589    depends_lib-append \
    399590        path:${qt_bins_dir}/qdoc:${name} \
     
    422613
    423614# See http://doc.qt.io/qt-5/sql-driver.html for info on building SQL Database Drivers
    424615
     616# RJVB/pixilla: applications built by the main port depend on the sqlite3 plugin. It should be built
     617# with the main port and not be a separate subport.
    425618subport ${name}-sqlite3-plugin {
     619    replaced_by         ${name}
     620    PortGroup           obsolete 1.0
    426621    PortGroup           qmake5 1.0
    427622
    428623    depends_lib-append port:sqlite3
     
    468663}
    469664
    470665livecheck.type      regex
    471 livecheck.url       http://qt-project.org/downloads
    472 livecheck.regex     "Qt (5(?:\\.\\d+)*) for Mac"
     666livecheck.url       http://download.qt.io/archive/qt/5.4/
     667livecheck.regex     (\\d+(\\.\\d+)+)