Ticket #46238: qt4-concurrent-patches.diff

File qt4-concurrent-patches.diff, 111.9 KB (added by RJVB (René Bertin), 9 years ago)

diff w.r.t. the current port:qt4-mac files

  • _resources/port1.0/group/kde4-1.1.tcl

    diff --git a/_resources/port1.0/group/kde4-1.1.tcl b/_resources/port1.0/group/kde4-1.1.tcl
    index ab51fc8..f3e9409 100644
    a b configure.args-append -DDOCBOOKXSL_DIR=${prefix}/share/xsl/docbook-xsl \ 
    125125                        -DPNG_INCLUDE_DIR=${prefix}/include \
    126126                        -DPNG_PNG_INCLUDE_DIR=${prefix}/include \
    127127                        -DPNG_LIBRARY=${prefix}/lib/libpng.dylib \
    128                         -DQCA2_INCLUDE_DIR=${prefix}/include/QtCrypto \
    129                         -DQCA2_LIBRARIES=${prefix}/lib/libqca.dylib \
    130128                        -DTIFF_INCLUDE_DIR=${prefix}/include \
    131129                        -DTIFF_LIBRARY=${prefix}/lib/libtiff.dylib
    132130
     131#                        -DQCA2_INCLUDE_DIR=${prefix}/include/QtCrypto \
     132#                        -DQCA2_LIBRARIES=${prefix}/lib/libqca.dylib \
     133
    133134# standard variant for building documentation
    134135variant docs description "Build documentation" {
    135136    depends_lib-append      port:doxygen
  • _resources/port1.0/group/qt4-1.0.tcl

    diff --git a/_resources/port1.0/group/qt4-1.0.tcl b/_resources/port1.0/group/qt4-1.0.tcl
    index baea318..9bcffc9 100644
    a b Qt4 must also be installed with +debug.\n" 
    5151    }
    5252}
    5353
     54if {[info exists name] && ${subport} ne "${name}-transitional"} {
     55    # exclusive mode doesn't make sense for the transitional subport ...
     56    variant exclusive description {Builds and installs Qt4-mac the older way, such that other Qt versions can NOT be installed alongside it} {}
     57}
     58
    5459# standard Qt4 name
    5560global qt_name
    5661set qt_name             qt4
    5762
    5863# standard install directory
    59 global qt_dir
    60 set qt_dir              ${prefix}/libexec/${qt_name}
    61 
     64    global qt_dir
     65    global qt_dir_rel
    6266# standard Qt documents directory
    63 global qt_docs_dir
    64 set qt_docs_dir         ${prefix}/share/doc/${qt_name}
    65 
     67    global qt_docs_dir
    6668# standard Qt plugins directory
    67 global qt_plugins_dir
    68 set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
    69 
     69    global qt_plugins_dir
    7070# standard Qt mkspecs directory
    71 global qt_mkspecs_dir
    72 set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
    73 
     71    global qt_mkspecs_dir
    7472# standard Qt imports directory
    75 global qt_imports_dir
    76 set qt_imports_dir      ${prefix}/share/${qt_name}/imports
    77 
     73    global qt_imports_dir
    7874# standard Qt includes directory
    79 global qt_includes_dir
    80 set qt_includes_dir     ${prefix}/include/${qt_name}
    81 
     75    global qt_includes_dir
    8276# standard Qt libraries directory
    83 global qt_libs_dir
    84 set qt_libs_dir         ${qt_dir}/lib
    85 
     77    global qt_libs_dir
    8678# standard Qt libraries directory
    87 global qt_frameworks_dir
    88 set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
    89 
     79    global qt_frameworks_dir
     80    global qt_frameworks_dir_rel
    9081# standard Qt non-.app executables directory
    91 global qt_bins_dir
    92 set qt_bins_dir         ${qt_dir}/bin
    93 
    94 # standard Qt .app executables directory, if created
    95 global qt_apps_dir
    96 set qt_apps_dir         ${applications_dir}/Qt4
    97 
     82    global qt_bins_dir
    9883# standard Qt data directory
    99 global qt_data_dir
    100 set qt_data_dir         ${prefix}/share/${qt_name}
    101 
     84    global qt_data_dir
    10285# standard Qt translations directory
    103 global qt_translations_dir
    104 set qt_translations_dir ${prefix}/share/${qt_name}/translations
    105 
     86    global qt_translations_dir
    10687# standard Qt sysconf directory
    107 global qt_sysconf_dir
    108 set qt_sysconf_dir      ${prefix}/etc/${qt_name}
    109 
     88    global qt_sysconf_dir
    11089# standard Qt examples directory
    111 global qt_examples_dir
    112 set qt_examples_dir     ${prefix}/share/${qt_name}/examples
    113 
     90    global qt_examples_dir
    11491# standard Qt demos directory
    115 global qt_demos_dir
    116 set qt_demos_dir        ${prefix}/share/${qt_name}/demos
    117 
     92    global qt_demos_dir
    11893# standard CMake module directory for Qt-related files
    119 global qt_cmake_module_dir
    120 set qt_cmake_module_dir ${qt_libs_dir}/cmake
    121 
     94    global qt_cmake_module_dir
    12295# standard qmake command location
    123 global qt_qmake_cmd
    124 set qt_qmake_cmd        ${qt_dir}/bin/qmake
     96    global qt_qmake_cmd
     97# standard moc command location
     98    global qt_moc_cmd
     99# standard uic command location
     100    global qt_uic_cmd
     101# standard lrelease command location
     102    global qt_lrelease_cmd
     103
     104global qt4_is_concurrent
     105if {![variant_isset exclusive]} {
     106    if {![info exists building_qt4] || ![info exists name] || ${name} ne "qt4-mac" || ${subport} eq "${name}-transitional"} {
     107        #exec ls -l ${prefix}/libexec/${qt_name}/bin/qmake
     108        if {[file exists ${prefix}/libexec/${qt_name}/bin/qmake]} {
     109            # we have a "concurrent" install, which means we must look for the various components
     110            # in different locations (esp. qmake)
     111            set qt4_is_concurrent   1
     112            set auto_concurrent 1
     113        }
     114    } else {
     115        if {![info exists qt4_is_concurrent]} {
     116            ui_msg "NB:\nQt4 has been or will be installed in concurrent mode\n"
     117        }
     118        # we're asking for the standard concurrent install. No need to guess anything, give the user what s/he wants
     119        set qt4_is_concurrent   1
     120        set auto_concurrent     1
     121    }
     122}
     123
     124if {[info exists qt4_is_concurrent]} {
     125    set qt_dir              ${prefix}/libexec/${qt_name}
     126    set qt_dir_rel          libexec/${qt_name}
     127    set qt_docs_dir         ${prefix}/share/doc/${qt_name}
     128    set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
     129    set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
     130    set qt_imports_dir      ${prefix}/share/${qt_name}/imports
     131    set qt_includes_dir     ${prefix}/include/${qt_name}
     132    set qt_libs_dir         ${qt_dir}/lib
     133    set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
     134    set qt_bins_dir         ${qt_dir}/bin
     135    set qt_data_dir         ${prefix}/share/${qt_name}
     136    set qt_translations_dir ${prefix}/share/${qt_name}/translations
     137    set qt_sysconf_dir      ${prefix}/etc/${qt_name}
     138    set qt_examples_dir     ${prefix}/share/${qt_name}/examples
     139    set qt_demos_dir        ${prefix}/share/${qt_name}/demos
     140    # no need to change the cmake_module_dir, though I'd have preferred to
     141    # put it into ${prefix}/lib/cmake as qt5-mac also does, and which is the place Linux uses
     142    set qt_cmake_module_dir ${prefix}/share/cmake/Modules
     143    set qt_qmake_cmd        ${qt_dir}/bin/qmake
     144    set qt_moc_cmd          ${qt_dir}/bin/moc
     145    set qt_uic_cmd          ${qt_dir}/bin/uic
     146    set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
     147} else {
     148    set qt_dir              ${prefix}
     149    set qt_dir_rel          ""
     150    set qt_docs_dir         ${qt_dir}/share/doc/${qt_name}
     151    set qt_plugins_dir      ${qt_dir}/share/${qt_name}/plugins
     152    set qt_mkspecs_dir      ${qt_dir}/share/${qt_name}/mkspecs
     153    set qt_imports_dir      ${qt_dir}/share/${qt_name}/imports
     154    set qt_includes_dir     ${qt_dir}/include
     155    set qt_libs_dir         ${qt_dir}/lib
     156    set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
     157    set qt_bins_dir         ${qt_dir}/bin
     158    set qt_data_dir         ${qt_dir}/share/${qt_name}
     159    set qt_translations_dir ${qt_dir}/share/${qt_name}/translations
     160    set qt_sysconf_dir      ${qt_dir}/etc/${qt_name}
     161    set qt_examples_dir     ${qt_dir}/share/${qt_name}/examples
     162    set qt_demos_dir        ${qt_dir}/share/${qt_name}/demos
     163    set qt_cmake_module_dir ${qt_dir}/share/cmake/Modules
     164    set qt_qmake_cmd        ${qt_dir}/bin/qmake
     165    set qt_moc_cmd          ${qt_dir}/bin/moc
     166    set qt_uic_cmd          ${qt_dir}/bin/uic
     167    set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
     168}
     169set qt_frameworks_dir_rel   ${qt_dir_rel}/Library/Frameworks
     170
     171# standard Qt .app executables directory, if created
     172global qt_apps_dir
     173set qt_apps_dir         ${applications_dir}/Qt4
    125174
    126175# standard qmake spec
    127176global qt_qmake_spec
    128177set qt_qmake_spec       macx-g++
    129178
    130 # standard moc command location
    131 global qt_moc_cmd
    132 set qt_moc_cmd          ${qt_dir}/bin/moc
    133 
    134 # standard uic command location
    135 global qt_uic_cmd
    136 set qt_uic_cmd          ${qt_dir}/bin/uic
    137 
    138 # standard lrelease command location
    139 global qt_lrelease_cmd
    140 set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
    141 
    142179# standard PKGCONFIG path
    143180global qt_pkg_config_dir
    144181set qt_pkg_config_dir   ${prefix}/lib/pkgconfig
    if {![info exists building_qt4]} { 
    163200        # see if the framework install exists, and if so depend on it;
    164201        # if not, depend on the library version
    165202
    166         if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
    167             depends_lib-append path:Library/Frameworks/QtCore/QtCore:qt4-mac
     203        if {[info exists qt4_is_concurrent]} {
     204            if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
     205                depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore/QtCore:qt4-mac
     206            } else {
     207                depends_lib-append path:libexec/${qt_name}/lib/libQtCore.4.dylib:qt4-mac
     208            }
    168209        } else {
    169             depends_lib-append path:lib/libQtCore.4.dylib:qt4-mac
     210            if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
     211                depends_lib-append path:Library/Frameworks/QtCore/QtCore:qt4-mac
     212            } else {
     213                depends_lib-append path:lib/libQtCore.4.dylib:qt4-mac
     214            }
    170215        }
    171216
    172217    } else {
  • aqua/qt4-mac/Portfile

    diff --git a/aqua/qt4-mac/Portfile b/aqua/qt4-mac/Portfile
    index 3c680f8..1161a4f 100644
    a b  
    33
    44PortSystem          1.0
    55
    6 # use the qt4 group; set 'building_qt4' so that the portgroup
    7 # does not include certain parts
    8 set building_qt4    1
    9 PortGroup           qt4 1.0
    10 PortGroup           xcodeversion 1.0
    11 PortGroup           compiler_blacklist_versions 1.0
    12 
    136name                qt4-mac
    14 # qt4-mac-devel is "replaced_by" this port,
    15 # so this port cannot conflict with it.
    16 #conflicts           qt3 qt3-mac qt4-mac-devel
    17 conflicts           qt3 qt3-mac qt5-mac
    18 version             4.8.6
    19 set branch          [join [lrange [split ${version} .] 0 1] .]
    20 
    21 categories          aqua
    22 platforms           macosx
    23 maintainers         michaelld openmaintainer
    24 license             {LGPL-2.1 GPL-3}
    25 
    26 homepage            http://qt-project.org
    27 description         Qt Tool Kit
    28 long_description    Qt Tool Kit: A cross-platform framework \
    29                     (headers, data, and libraries) for writing \
    30                     cross-platform GUI-based applications.
    31 
    32 distname            qt-everywhere-opensource-src-${version}
    33 
    34 master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/
    35 
    36 checksums           rmd160  0220d4e76ac761c9ecfb8ddab6f2c1dc6ad70c33 \
    37                     sha256  8b14dd91b52862e09b8e6a963507b74bc2580787d171feda197badfa7034032c
    38 
    39 minimum_xcodeversions   {8 2.5}
    40 
    41 depends_lib-append  port:zlib path:bin/dbus-daemon:dbus \
    42                     port:openssl port:tiff \
    43                     port:libpng port:libmng port:jpeg
    44 
    45 # find a way to specify the OS MINOR version.  For OSX 10.X, this
    46 # value will be X.  The type is this variable is integer, so we can
    47 # use "==" and so forth for comparison.
    48 
    49 global MINOR
    50 set MINOR ""
    51 
    52 # hopefully the MACOSX_DEPLOYMENT_TARGET exists and is set by now.  if
    53 # not, last resort (which is not desirable) is to use the os.version.
     7version             4.8.6
     8revision            3
    549
    55 if {${macosx_deployment_target} ne ""} {
    56     set MINOR [lindex [split ${macosx_deployment_target} "."] 1]
    57 } else {
    58     set MINOR [expr [lindex [split ${os.version} "."] 0] - 4]
     10if {[catch {source "${portpath}/Portfile.qt4"} err]} {
     11    puts stderr "Error reading Portfile.qt4: $err"
     12    return 1;
    5913}
    6014
    61 ###############################################
    62 # Patches are used to both fix compiling on various OS versions, and
    63 # to enhance the functionality of QMake and its build files.  Some of
    64 # these patches are 2-stage: use a file here, and the replace an
    65 # @VARIABLE@ in post-patch.  There are LOTS of patches, because Qt is
    66 # a large, complicated system.
    67 
    68 # (0) Fix the testing script to properly handle both +universal as
    69 # well as the native arch for both CXX and CC compiling; also make
    70 # sure it does not create a Mac app bundle.
    71 
    72 patchfiles-append   patch-config.tests_unix_compile.test.diff
    73 
    74 # (1) Test for Precompiled-headers support (a) requires a C++
    75 # compiler, but configure calls it, by default, with a C compiler;
    76 # thus, enable testing using the C compiler. (b) to work with ccache,
    77 # if used.
    78 
    79 patchfiles-append   patch-config.tests_unix_precomp.test.diff
    80 
    81 # (2) fix 'configure' script: (a) to allow easy replacement of arch
    82 # type(s). (b) to find the correct QMAKE CXX compiler by removing
    83 # possibilities that include the character "$". (c) to declare, use,
    84 # and set QT_INSTALL_FRAMEWORKS and QMAKE_FRAMEWORKDIR_QT, both here
    85 # and in the resulting .qmake.cache files. (d) to allow easy
    86 # replacement of MACOSX_DEPLOYMENT_TARGET: build for just the user's
    87 # current OS. (e) add hooks for C++11 testing.
    88 
    89 patchfiles-append   patch-configure.diff
    90 
    91 # (3) (a) Tweak various scripts to allow easy replacement of
    92 # MACOSX_DEPLOYMENT_TARGET: build for just the user's current OS.
    93 # (b) Assign initial OBJECTIVE_CXXFLAGS.
    94 
    95 patchfiles-append   patch-mkspecs_common_g++-macx.conf.diff
    96 
    97 # (4) (a) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build
    98 # for just the user's current OS; (b) allow QMake to use 'ccache' via,
    99 # e.g., "qmake && make CCACHE=ccache".
    100 
    101 patchfiles-append   patch-mkspecs_common_mac.conf.diff
    102 
    103 # (5) Place the -I path for local moc-created headers -before-
    104 # all other -I paths.
    105 
    106 patchfiles-append   patch-mkspecs_features_moc.prf.diff
    107 
    108 # (6) Remove Qt's LIBDIR and INCDIR from various QMake internal
    109 # variables, since they are already included in the user-supplied
    110 # LIBS and INCLUDEPATH.
    111 
    112 patchfiles-append   patch-mkspecs_features_qt.prf.diff
    113 
    114 # (7) (a) Change placement of Qt's LIBDIR and INCDIR, to always be
    115 # after those supplied by the user's QMake (.pro) files.  By the time
    116 # QMake gets to the patched function, it is creating the Makefile
    117 # parts to find Qt's headers and libraries, so moving these paths to
    118 # this location should always work. (b) If the library is QtWebKit,
    119 # and the build is library (no-framework), universal, and debug, then
    120 # the linkage is just -lQtWebKit, not -lQtWebKit_debug because the
    121 # debug library for 32-bit system cannot be created (too large).
    122 
    123 patchfiles-append   patch-mkspecs_features_qt_functions.prf.diff
    124 
    125 # (8) (a) Change "gcc" and "g++" to @'s for replacement in
    126 # post-patch; (b) add hooks for C++11.
    127 
    128 patchfiles-append   patch-mkspecs_common_g++-base.conf.diff
    129 
    130 # (9) Add default QMake variables for Objective C++.
    131 
    132 patchfiles-append   patch-mkspecs_objective_cxx.diff
    133 
    134 # (10) Add "absolute_library_soname" to the default CONFIG variables,
    135 # so that when a DYLIB is created, if "target.path" is set for it then
    136 # that path is prepended to its "install_name".
    137 
    138 patchfiles-append   patch-mkspecs_macx-g++_qmake.conf.diff
    139 
    140 # (11) Add QT_INSTALL_FRAMEWORKS and related variables to QMake, to
    141 # provide a default variable for the location of QMake installed
    142 # frameworks.
    143 
    144 patchfiles-append   \
    145     patch-qmake_option.h.diff \
    146     patch-qmake_property.cpp.diff \
    147     patch-src_corelib_global_qlibraryinfo.cpp.diff \
    148     patch-src_corelib_global_qlibraryinfo.h.diff
    149 
    150 # (12) In QMake, disable default MKSPECS and FEATURES path
    151 # concatinations if the shell environment variable QMAKE_NO_DEFAULTS
    152 # is set (to anything); we use this variable in this portfile to make
    153 # sure only internal paths (to the build) are searched by QMake.
    154 
    155 patchfiles-append   patch-qmake_project.cpp.diff
    156 
    157 # (13) In QMake: (a) enable correct "-framework foo,bar" parsing as
    158 # specified by Apple's LD; (b) disable "/Library/Frameworks" as a
    159 # default search path; use "PREFIX/Library/Frameworks" and replace
    160 # PREFIX in post-patch.  Also set "PREFIX/lib" as a default library
    161 # search path.
    162 
    163 patchfiles-append   patch-qmake_generators_unix_unixmakke.cpp.diff
    164 
    165 # (14) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build for
    166 # just the user's current OS.
    167 
    168 patchfiles-append   \
    169     patch-qmake_qmake.pri.diff \
    170     patch-src_tools_bootstrap_bootstrap.pro.diff
    171 
    172 # (15) fix use of CARBON, found on PPC64; does not hurt others
    173 
    174 patchfiles-append   \
    175     patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff \
    176     patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
    177 
    178 # (16) fix the corewlan qmake file to use non-standard Developer SDK
    179 # location under 10.6 and newer, e.g., for some developers doing both
    180 # iOS and OSX.  This patch does not change behavior for 10.4 or 10.5.
    181 # Also include fix to use the correct SDK.
    182 
    183 patchfiles-append   patch-src_plugins_bearer_corewlan_corewlan.pro.diff
    184 
    185 # (17) Use the "target.path" for libdir for core libraries instead of
    186 # the standard QT_INSTALL_LIBS; allows us to set for library or
    187 # framework elsewhere and have the install still work here.
    188 
    189 patchfiles-append   patch-src_qbase.pri.diff
    190 
    191 # (18) (a) Disable explicit disabling of framework or static install;
    192 # i.e., install as a framework if that mode is selected, and as
    193 # library otherwise. (b) If installing as framework, use the new
    194 # QT_INSTALL_FRAMEWORKS directory; otherwise, use the old
    195 # QT_INSTALL_LIBS; (c) Get PKGCONFIG dependencies correct, hopefully;
    196 # (d) create and install .pc, .la, and .prl library description files,
    197 # including basic path replacement into DESTDIR; we couple this with a
    198 # post-patch to get the correct install location.
    199 
    200 patchfiles-append   \
    201     patch-src_qt_install.pri.diff \
    202     patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff \
    203     patch-tools_assistant_lib_lib.pro.diff \
    204     patch-tools_designer_src_components_lib_lib.pro.diff \
    205     patch-tools_designer_src_lib_lib.pro.diff \
    206     patch-tools_designer_src_uitools_uitools.pro.diff \
    207     patch-mkspecs_features_uitools.prf.diff
    208 
    209 # (19) fix 'macdeployqt' to look for the correct plugins location by
    210 # default.  This is paired with a "reinplace" in post-patch
    211 
    212 patchfiles-append   \
    213     patch-tools_macdeployqt_macdeployqt_main.cpp.diff
    214 
    215 # (20) Under 10.4 only: patch QMake build files using just "-lQtHelp"
    216 # to do "-lQtHelp -lQtCLucene -lQtNetwork -lQtWebKit" instead.  For
    217 # some reason 10.5+ "knows" that how to do this correctly.
    218 
    219 platform darwin {
    220     if {${MINOR} == 4} {
    221         patchfiles-append patch-QtHelp_10.4_only.diff
     15subport ${name}-transitional {
     16        conflicts           qt3 qt3-mac
     17    if {[file exists ${prefix}/Library/Frameworks/QtCore.framework/Versions/5/QtCore]} {
     18        conflicts       qt5-mac
    22219    }
     20    universal_variant   no
     21    depends_lib         port:qt4-mac
    22322}
    224 
    225 # (21) fix the Mac timer's use of "mach_timebase_info"
    226 
    227 patchfiles-append   \
    228     patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
    229 
    230 # (22) Under 10.8 and 10.9: Patch to fix corelib linking
    231 
    232 platform darwin {
    233     if {${MINOR} >= 8} {
    234         patchfiles-append patch-src_corelib_corelib.pro.diff
    235     }
    236 }
    237 
    238 # (23) fix Framework directory in MacDeployQt tool
    239 
    240 patchfiles-append   \
    241     patch-tools_macdeployqt_shared_shared.cpp.diff
    242 
    243 # (24) minimum patches required for 10.10; squashed; temporary until 4.8.7.
    244 
    245 patchfiles-append   \
    246     patch-10.10.diff
    247 
    248 # error out if trying to build on a new OSX version (> 10.10).
    249 
    250 platform darwin {
    251     if {${MINOR} > 10} {
    252         # This project needs to be updated to build with clang++ against libc++
    253         depends_lib
    254         depends_run
    255         pre-fetch {
    256             ui_error "$name does not currently build on OSX later than 10.10 'Yosemite'."
    257             error "unsupported platform"
    258         }
    259     }
    260 }
    261 
    262 ###############################################
    263 
    264 # disable CCACHE for now (ticket #34856)
    265 
    266 configure.ccache no
    267 
    268 # find a way to specify the SDK to use; Qt will use the 10.4u by
    269 # default which won't work on 10.6 since it is not supported.  Allow
    270 # the user to specify the SDK if desired.
    271 
    272 global SDK
    273 set SDK ${configure.sdkroot}
    274 if {${SDK} eq ""} {
    275     # set SDK version depending on OS version
    276     set sdk_version ""
    277     if {${MINOR} == 4} {
    278         # OSX 10.4 requires an additional 'u'
    279         set sdk_version "10.4u"
    280     } else {
    281         set sdk_version "10.${MINOR}"
    282     }
    283     if {[vercmp ${xcodeversion} 4.3] < 0} {
    284         set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
    285     } else {
    286         set SDK ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk_version}.sdk
    287     }
    288 }
    289 
    290 post-patch {
    291     # set ARCHES in configure (per the third patchfile above), for
    292     # building QMake.  join any 2 or more arch entries with the GCC
    293     # arch flag (join does not effect a single entry).  first "-arch"
    294     # is already in place in the 'configure' script (since there has
    295     # to be at least 1 arch).
    296 
    297     set ARCHES ""
    298     if {[variant_exists universal] && [variant_isset universal]} {
    299         set ARCHES [join ${universal_archs} " -arch "]
    300     } else {
    301         set ARCHES ${build_arch}
    302     }
    303     reinplace "s|@ARCHES@|${ARCHES}|g" ${worksrcpath}/configure
    304 
    305     # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
    306     # were all patched in (2) above, and can be easily changed or
    307     # overridden by the user in a project-local qmake .pro script.
    308 
    309     set TARGET "10.${MINOR}"
    310     foreach fixfile {configure mkspecs/common/g++-macx.conf \
    311                      mkspecs/common/mac.conf qmake/qmake.pri \
    312                      src/tools/bootstrap/bootstrap.pro } {
    313         reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
    314             ${worksrcpath}/${fixfile}
    315     }
    316 
    317     # Fix OS version on Bearer CoreWLAN QMake file
    318 
    319     reinplace "s|@MACOSX_VERSION_MINOR@|${MINOR}|g" \
    320         ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
    321 
    322     # Ensure that correct C/C++ compilers are used.
    323 
    324     reinplace "s|@CXX@|${configure.cxx}|" \
    325         ${worksrcpath}/mkspecs/common/g++-base.conf
    326     reinplace "s|@CC@|${configure.cc}|"  \
    327         ${worksrcpath}/mkspecs/common/g++-base.conf
    328 
    329     # fix the corewlan .pro file to use the correct developer SDK
    330 
    331     reinplace "s,@DEVELOPER_SDK@,${SDK},g" \
    332         ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
    333 
    334     # fix 'macdeployqt' to look for the correct
    335     # plugins location by default.
    336 
    337     reinplace "s,@QT_PLUGINS_DIR@,${qt_plugins_dir},g" \
    338         ${worksrcpath}/tools/macdeployqt/macdeployqt/main.cpp
    339 
    340     # fix PREFIX in QMake makefile generator
    341 
    342     reinplace "s,@PREFIX@,${qt_dir},g" \
    343         ${worksrcpath}/qmake/generators/unix/unixmake.cpp
    344 
    345     # if no debug, then do not even build debug code
    346 
    347     if {![variant_isset debug]} {
    348         foreach fixfile { src/qbase.pri \
    349                           src/3rdparty/webkit/Source/WebKit.pri \
    350                           src/imports/qimportbase.pri \
    351                           src/plugins/qpluginbase.pri \
    352                           tools/designer/src/components/lib/lib.pro \
    353                           tools/designer/src/lib/lib.pro \
    354                           tools/designer/src/plugins/activeqt/activeqt.pro \
    355                           tools/designer/src/plugins/plugins.pri \
    356                           tools/designer/src/uitools/uitools.pro \
    357                           src/3rdparty/webkit/Source/WebKit/qt/declarative/declarative.pro } {
    358             reinplace "/+=/s@debug_and_release@@g" \
    359                 ${worksrcpath}/${fixfile}
    360         }
    361     }
    362 
    363     # copy C++11 files into place, if that variant is set
    364 
    365     if {[variant_isset cxx11]} {
    366         copy ${filespath}/c++11.prf ${worksrcpath}/mkspecs/features
    367         copy ${filespath}/c++11 ${worksrcpath}/config.tests/mac
    368     }
    369 
    370     # copy Objective C / CXX files into place
    371 
    372     copy ${filespath}/objective_cxx.prf \
    373         ${worksrcpath}/mkspecs/features/mac
    374     copy ${filespath}/split_sources.prf \
    375         ${worksrcpath}/mkspecs/features/mac
    376 
    377     # copy extra compiler tests into place; these are patched into the
    378     # configure script to the area before qmake is built.  If any
    379     # fail, configure will fail quickly.
    380 
    381     copy ${filespath}/fconstant_cfstrings.test \
    382         ${worksrcpath}/config.tests/mac
    383     copy ${filespath}/objc_block \
    384         ${worksrcpath}/config.tests/mac
    385     copy ${filespath}/cpath \
    386         ${worksrcpath}/config.tests/mac
    387     copy ${filespath}/library_path \
    388         ${worksrcpath}/config.tests/mac
    389 }
    390 
    391 # Block various compilers:
    392 #
    393 # * The build process requires -Xarch, -fconstant-cfstring, and
    394 # Objective-C(++) blocks (^), which are not supported with vanilla GCC
    395 # as installed by MacPorts but are supported by all versions of CLANG
    396 # (both MacPorts' and Apple's).
    397 #
    398 # * Some older versions of CLANG do not honor the CPATH
    399 # environment variables, which is required for compiling
    400 # this port when using MacPorts.  The versions seem to be: MacPorts
    401 # CLANG 2.9 or earlier, and Apple CLANG 318.0.58 or older.
    402 #
    403 # * Some older versions of CLANG do not honor the LIBRARY_PATH
    404 # environment variables, which is required for compiling
    405 # this port when using MacPorts.  The versions seem to be: MacPorts
    406 # CLANG 3.0 or earlier, and Apple CLANG 318.0.61 or older.
    407 #
    408 # * qt4-creator-mac fails to build with GCC <= 4.0.
    409 #
    410 # See also:
    411 # < http://llvm.org/bugs/show_bug.cgi?id=8971 >,
    412 # < https://trac.macports.org/ticket/30271 >,
    413 # < https://trac.macports.org/ticket/31076 >,
    414 # < https://trac.macports.org/ticket/31638 >,
    415 # < https://trac.macports.org/ticket/37868 >, and
    416 # < https://trac.macports.org/ticket/40422 >.
    417 #
    418 # NOTE: qt4-mac augments the standard Qt4 configure script with
    419 # pre-qmake-build tests for CPATH, LIBRARY_PATH, -Xarch,
    420 # -fconstant-cfstring, Objective-C(++) blocks, and, if requested,
    421 # C++11.  The script will error out quickly if the compiler does not
    422 # seem to provide support for any one of these properties, no matter
    423 # this blacklist.
    424 #
    425 
    426 compiler.blacklist-append { clang <= 318.0.61 } \
    427     gcc-3.3 *gcc-4.0 macports-gcc* \
    428     macports-clang-2.9 macports-clang-3.0
    429 
    430 # --prefix is not recognized.
    431 configure.pre_args-delete       --prefix=${prefix}
    432 
    433 # --disable-dependency-tracking is not recognized.
    434 configure.universal_args-delete --disable-dependency-tracking
    435 
    436 # clear all arch-oriented flags since somehow they impact how qmake is
    437 # created, which in turn messes up LDFLAGS in most created Makefiles.
    438 
    439 configure.ld_archflags
    440 configure.cc_archflags
    441 configure.cxx_archflags
    442 configure.universal_ldflags
    443 configure.universal_cflags
    444 configure.universal_cxxflags
    445 configure.universal_cppflags
    446 configure.march
    447 configure.mtune
    448 
    449 # Use compiler.cpath and compiler.library_path for all -I and -L
    450 # entries, so-as to avoid conflicts with already-installed headers and
    451 # libraries (giving preference to internal-to-this-port first).  CPATH
    452 # is used instead of -I to avoid conflicts with other ports.
    453 #
    454 # See also:
    455 # < https://trac.macports.org/ticket/15219 >,
    456 # < https://trac.macports.org/ticket/18723 >, and
    457 # < https://trac.macports.org/ticket/25321 >.
    458 
    459 # set the default paths to include those for SQLITE3 and DBUS-1
    460 
    461 set header_path [ list ${prefix}/include/dbus-1.0 \
    462                        ${prefix}/lib/dbus-1.0/include \
    463                        ${prefix}/include ]
    464 
    465 set library_path [ list ${prefix}/lib ]
    466 
    467 # -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
    468 #     which it is not able to find in ${prefix}.
    469 #
    470 # -openssl-linked ensures that the MacPorts openssl is used.
    471 #
    472 # -framework ensures that this port is installed as frameworks
    473 #     (collections of {library, headers, resources}); in
    474 #     post-destroot, link headers and libraries from the frameworks
    475 #     into non-framework locations as if "-no-framework" were
    476 #     specified.  Some dependent projects will not work properly if Qt
    477 #     is installed as libraries by default, thus make it so #1.
    478 #
    479 # -no-phonon ensures that Qt does not install the 3rd-parth Phonon
    480 #     port or its backend to QuickTime 7; Phonon is now installed via
    481 #     the 'phonon' port, which is more up to date than that provided
    482 #     by Qt.
    483 
    484 configure.args                                            \
    485     -v                                                    \
    486     -confirm-license                                      \
    487     -opensource                                           \
    488     -prefix          ${qt_dir}                            \
    489     -bindir          ${qt_bins_dir}                       \
    490     -libdir          ${qt_libs_dir}                       \
    491     -docdir          ${qt_docs_dir}                       \
    492     -headerdir       ${qt_includes_dir}                   \
    493     -plugindir       ${qt_plugins_dir}                    \
    494     -importdir       ${qt_imports_dir}                    \
    495     -datadir         ${qt_data_dir}                       \
    496     -translationdir  ${qt_translations_dir}               \
    497     -sysconfdir      ${qt_sysconf_dir}                    \
    498     -examplesdir     ${qt_examples_dir}                   \
    499     -demosdir        ${qt_demos_dir}                      \
    500     -openssl-linked                                       \
    501     -dbus-linked                                          \
    502     -fast                                                 \
    503     -optimized-qmake                                      \
    504     -no-pch                                               \
    505     -framework                                            \
    506     -no-phonon                                            \
    507     -no-phonon-backend
    508 
    509 # Stop configure script from searching for SQL Drivers
    510 #    not available from MacPorts.
    511 
    512 foreach driver {db2 ibase oci tds} {
    513     configure.args-append -no-sql-${driver}
    514 }
    515 
    516 # Disable all remaining SQL Drivers.  These are available via the
    517 # ports qt4-mac-*-plugin.
    518 
    519 foreach driver {mysql odbc psql sqlite sqlite2} {
    520     configure.args-append -no-sql-${driver}
    521 }
    522 
    523 pre-configure {
    524 
    525     # use the corrected CPATH and LIBRARY_PATH for build
    526 
    527     compiler.cpath [join ${header_path} :]
    528     compiler.library_path [join ${library_path} :]
    529 
    530     # for 10.4 or 10.5 32-bit PPC, build as Carbon only, not Cocoa
    531 
    532     if {${MINOR} == 4} {
    533 
    534         configure.args-append -carbon
    535 
    536         # required linking flags?
    537 
    538         configure.ldflags-append -lcrypto -ldbus-1 -ljpeg -llcms \
    539             -lssl -lz
    540 
    541     } elseif {${MINOR} == 5 &&
    542               [llength ${qt_arch_types}] == 1 &&
    543               [lsearch -exact ${qt_arch_types} ppc] == 0} {
    544 
    545         configure.args-append -carbon
    546 
    547     }
    548 
    549     # set the arch type(s) to use, in Qt-speak
    550 
    551     configure.args-append -arch \"${qt_arch_types}\"
    552 
    553     # cannot use pre-compiled headers when compiling with more than 1
    554     # arch type (typically +universal) or for X11
    555 
    556     #if {[llength ${qt_arch_types}] != 1 || [variant_isset x11]}
    557 
    558     # check to see if not compiling for the native machine hardware
    559     # (e.g., compiling for just i386 but CPU is x86_64); optimization
    560     # of QMake does not work in this circumstance.
    561 
    562     if {[lsearch -exact ${qt_arch_types} ${os.arch}] == -1} {
    563 
    564         # not building for native arch: disable optimizing qmake
    565         configure.args-delete -optimized-qmake
    566 
    567     } elseif {${MINOR} == 6 &&
    568               [llength ${qt_arch_types}] == 1 &&
    569               [lsearch -exact ${qt_arch_types} x86] == 0} {
    570 
    571         # disable qmake optimization on 10.6 32-bit
    572         configure.args-delete -optimized-qmake
    573 
    574     }
    575 
    576     # set the SDK, if it was found and exists
    577 
    578     if {[file exists ${SDK}]} {
    579         configure.args-append -sdk ${SDK}
    580     }
    581 
    582     # set which pkg-config to use
    583 
    584     configure.env-append PKG_CONFIG=${prefix}/bin/pkg-config
    585 
    586     # set which stdlib to use; clang only
    587     if {[string match *clang* ${configure.compiler}]} {
    588         configure.env-append QMAKE_STDLIB="-stdlib=${configure.cxx_stdlib}"
    589         configure.ldflags-append -stdlib=${configure.cxx_stdlib}
    590     }
    591 }
    592 
    593 post-configure {
    594 
    595     # Remove any '-I' and '-L' string from the *FLAGS for SQLITE,
    596     # DBUS, ODBC, and OPENSSL, so that what remains are just non-I/L
    597     # flags; these paths are in compiler.cpath and
    598     # compiler.library_path.  The header and library paths for all the
    599     # other variants are not used by 'configure', and are already
    600     # included in the compiler.cpath and compiler.library_path
    601     # . during the 'build' stage, 'make' will rebuild the Makefiles
    602     # that depend on any of these changed files.  These patches are
    603     # sufficient to make sure local (to this build) paths are searched
    604     # first, and then system paths last (via the compiler.X settings).
    605     # Ideally, 'qmake' -- either via its mkspecs files or the
    606     # project's build files -- would distinguish between "local" and
    607     # "system" includes & libraries.
    608 
    609     # SQLITE
    610     reinplace "/SQLITE/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
    611         ${worksrcpath}/.qmake.cache
    612     reinplace "/SQLITE/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
    613         ${worksrcpath}/.qmake.cache
    614     # DBUS
    615     reinplace "/DBUS/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
    616         ${worksrcpath}/.qmake.cache
    617     reinplace "/DBUS/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
    618         ${worksrcpath}/.qmake.cache
    619     # OPENSSL
    620     reinplace "/OPENSSL/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
    621         ${worksrcpath}/.qmake.cache
    622     reinplace "/OPENSSL/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
    623         ${worksrcpath}/.qmake.cache
    624     # ODBC
    625     reinplace "/ODBC/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
    626         ${worksrcpath}/.qmake.cache
    627     reinplace "/ODBC/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
    628         ${worksrcpath}/.qmake.cache
    629 }
    630 
    631 pre-build {
    632     # use the corrected CPATH and LIBRARY_PATH for build
    633     compiler.cpath [join ${header_path} :]
    634     compiler.library_path [join ${library_path} :]
    635 }
    636 
    637 # do not use DESTDIR directly in the destroot command; Qt uses DISTDIR
    638 # internally for other purposes, and instead uses INSTALL_ROOT for the
    639 # additional install root prefix.
    640 
    641 destroot.post_args
    642 
    643 post-destroot {
    644 
    645     set destroot_qt ${destroot}${qt_dir}
    646 
    647     # Fix .pc and .prl files by changing ${worksrcpath}\${prefix} to
    648     # ${qt_dir}\${prefix} ("\" means 'take away').  Cannot use
    649     # "find -E" since it is not necessarily portable.
    650 
    651     regsub ${prefix} ${worksrcpath} "" from_dir
    652     regsub ${prefix} ${qt_dir} "" to_dir
    653     foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
    654         reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
    655     }
    656     foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
    657         reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
    658     }
    659 
    660     # fix .pc files
    661 
    662     foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
    663 
    664         # remove Libs.private; they can mess up linking
    665 
    666         reinplace "/Libs\.private/d" ${fixfile}
    667 
    668         # use ${prefix} correctly
    669 
    670         reinplace "s|${prefix}/|\${prefix}/|g" ${fixfile}
    671 
    672         # fix libdir
    673 
    674         reinplace "/libdir=/s|Library/Frameworks|lib|" ${fixfile}
    675 
    676         # fix Libs: to use -L instead of -F
    677 
    678         reinplace "/Libs:/s|-F|-L|" ${fixfile}
    679 
    680         # fix Libs: to use -lQt* instead of "-framework Qt*"
    681         # depends on whether for release or debug
    682 
    683         set fn [lindex [split ${fixfile} /] end]
    684 
    685         if {[lsearch -regexp ${fn} debug] == 0} {
    686 
    687             # debug; need to add that string to all Qt dependency libraries
    688             reinplace "/Libs:/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|" \
    689                 ${fixfile}
    690 
    691         } else {
    692 
    693             # no debug; just replace
    694             reinplace "/Libs:/s|-framework Qt|-lQt|" ${fixfile}
    695 
    696         }
    697     }
    698 
    699     # move .pc files from ${qt_frameworks_dir}/pkgconfig to
    700     # ${qt_pkg_config_dir}
    701 
    702     file delete -force ${destroot}${qt_pkg_config_dir}
    703     xinstall -m 755 -d ${destroot}${qt_libs_dir}
    704     move ${destroot}${qt_frameworks_dir}/pkgconfig \
    705         ${destroot}${qt_libs_dir}
    706 
    707     # move .la files from ${qt_frameworks_dir} to ${qt_libs_dir}
    708 
    709     foreach laf [glob ${destroot}/${qt_frameworks_dir}/*.la] {
    710         move ${laf} ${destroot}${qt_libs_dir}
    711     }
    712 
    713     # remove -L entries from .prl and .la files
    714 
    715     foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
    716         reinplace "/QMAKE_PRL_LIBS/s|-L\[^ \]*||g" ${fixfile}
    717     }
    718     foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
    719         reinplace "/dependency_libs/s|-L\[^ \]*||g" ${fixfile}
    720     }
    721 
    722     # remove redundant -F entries from .prl and .la files
    723 
    724     foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
    725         reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*|FREPLACEME|1" \
    726             ${fixfile}
    727         reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*||g" ${fixfile}
    728         reinplace "s|FREPLACEME|-F${prefix}/Library/Frameworks|1" \
    729             ${fixfile}
    730     }
    731     foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
    732         reinplace "/dependency_libs/s|-F\[^ \]*|FREPLACEME|1" \
    733             ${fixfile}
    734         reinplace "/dependency_libs/s|-F\[^ \]*||g" ${fixfile}
    735         reinplace "s|FREPLACEME|-F${prefix}/Library/Frameworks|1" \
    736             ${fixfile}
    737     }
    738 
    739     # get Qt's version numbers
    740 
    741     set qt_vers [split ${version} "."]
    742     set qt_major [lindex ${qt_vers} 0]
    743     set qt_minor [lindex ${qt_vers} 1]
    744     set qt_patch [lindex ${qt_vers} 2]
    745 
    746     # link includes and libraries for each actual installed framework
    747 
    748     foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
    749                          -name "*.framework" | \
    750                          sed -e "s@${destroot}@@g"] {
    751 
    752         set tf_full [strsed ${fixfile} {s@\\.framework@@}]
    753         set tf [strsed ${tf_full} {g@.*\/@@}]
    754 
    755         # special for QtWebKit entries
    756 
    757         set t_minor ${qt_minor}
    758         set is_QtWebKit 0
    759         if {[string compare ${tf} QtWebKit] == 0} {
    760             set t_minor 9
    761             set is_QtWebKit 1
    762         }
    763 
    764         # link headers into ${qt_includes_dir}, removing directories
    765         # if they are already there first
    766 
    767         set inc_file ${destroot}${qt_includes_dir}/${tf}
    768         if {[file exists ${inc_file}]} {
    769             file delete -force ${inc_file}
    770         }
    771         ln -s ${tf_full}.framework/Headers ${inc_file}
    772 
    773         # link libraries into ${qt_libs_dir}, all 4 number variants
    774 
    775         set dr_qt_libs_dir ${destroot}${qt_libs_dir}
    776 
    777         ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
    778         ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
    779         ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
    780         ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
    781 
    782         # copy .prl file, then correct it for library usage
    783 
    784         copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
    785 
    786         # fix TARGET in .prl file
    787 
    788         reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
    789 
    790         # fix PRL_LIBS -F -> -L in .prl file
    791 
    792         reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
    793 
    794         # fix "-framework Qt*" -> "-lQt*" in .prl file
    795 
    796         reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
    797             ${dr_qt_libs_dir}/lib${tf}.prl
    798 
    799         # fix up .la files to work with ${prefix}/lib entries
    800 
    801         # rename .la file
    802 
    803         move ${dr_qt_libs_dir}/${tf}.la ${dr_qt_libs_dir}/lib${tf}.la
    804 
    805         # fix "name that we can dlopen" in .la file
    806 
    807         reinplace "s|dlname=''|dlname='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}.la
    808 
    809         # fix "names of this library" in .la file
    810 
    811         reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}.${qt_major}.${t_minor}.dylib lib${tf}.${qt_major}.dylib lib${tf}.dylib'|" \
    812             ${dr_qt_libs_dir}/lib${tf}.la
    813 
    814         # fix "name of the static archive"; there is none in .la file
    815 
    816         reinplace "s|old_library='\[^'\]*'|old_library=''|" \
    817             ${dr_qt_libs_dir}/lib${tf}.la
    818 
    819         # fix "libraries that this one depends upon" in .la file
    820 
    821         reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|"  ${dr_qt_libs_dir}/lib${tf}.la
    822         reinplace "/dependency_libs/s|-framework Qt|-lQt|g" \
    823             ${dr_qt_libs_dir}/lib${tf}.la
    824         reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
    825             ${dr_qt_libs_dir}/lib${tf}.la
    826         reinplace "/dependency_libs/s| -lwebcore||" \
    827             ${dr_qt_libs_dir}/lib${tf}.la
    828         reinplace "/dependency_libs/s| -ljscore||" \
    829             ${dr_qt_libs_dir}/lib${tf}.la
    830 
    831         # fix "directory that this library needs to be installed in" in .la file
    832 
    833         reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
    834             ${dr_qt_libs_dir}/lib${tf}.la
    835 
    836         # deal with debug files
    837 
    838         if {[variant_isset debug]} {
    839 
    840             # but not if QtWebKit and +universal, since that one does
    841             # not exist (the 32-bit version of the debug library is
    842             # larger than fits into the 32-bit filespace).
    843 
    844             if {[variant_isset debug] && ${is_QtWebKit}} {
    845                 continue
    846             }
    847 
    848             # link libraries into ${qt_libs_dir}, all 4 number variants
    849 
    850             ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
    851             ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
    852             ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
    853             ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
    854 
    855             # copy .prl file, then correct it for library usage
    856 
    857             copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
    858 
    859             # fix TARGET in .prl file
    860 
    861             reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
    862 
    863             # fix PRL_LIBS -F -> -L in .prl file
    864 
    865             reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
    866 
    867             # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
    868 
    869             reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
    870 
    871             # fix up .la files to work with ${prefix}/lib entries
    872 
    873             # rename .la file
    874 
    875             move ${dr_qt_libs_dir}/${tf}_debug.la \
    876                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    877 
    878             # fix "name that we can dlopen" in .la file
    879 
    880             reinplace "s|dlname=''|dlname='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}_debug.la
    881 
    882             # fix "names of this library" in .la file
    883 
    884             reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}_debug.${qt_major}.${t_minor}.dylib lib${tf}_debug.${qt_major}.dylib lib${tf}_debug.dylib'|" \
    885                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    886 
    887             # fix "name of the static archive"; there is none in .la file
    888 
    889             reinplace "s|old_library='\[^'\]*'|old_library=''|" \
    890                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    891 
    892             # fix "libraries that this one depends upon" in .la file
    893 
    894             reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.la
    895             reinplace "/dependency_libs/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.la
    896             reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
    897                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    898             reinplace "/dependency_libs/s| -lwebcored||" \
    899                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    900             reinplace "/dependency_libs/s| -ljscored||" \
    901                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    902 
    903             # fix "directory that this library needs to be installed in" in .la file
    904 
    905             reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
    906                 ${dr_qt_libs_dir}/lib${tf}_debug.la
    907 
    908         }
    909     }
    910 
    911     # Install documentation.
    912 
    913     xinstall -m 755 -d ${worksrcpath}/${qt_docs_dir}
    914     xinstall -m 644 -W ${worksrcpath} \
    915         INSTALL LGPL_EXCEPTION.txt LICENSE.FDL \
    916         LICENSE.GPL3 LICENSE.LGPL README \
    917         ${destroot}${qt_docs_dir}
    918 
    919     # Install private headers needed by QtCreator
    920 
    921     foreach {src_dir include_dir} \
    922     {corelib QtCore gui QtGui script QtScript declarative QtDeclarative} {
    923         set dest_dir ${destroot}${qt_frameworks_dir}/${include_dir}.framework/Headers/private
    924         xinstall -m 755 -d ${dest_dir}
    925         set files [exec find ${worksrcpath}/src/${src_dir} -type f -name "*_p.h"]
    926         eval xinstall -m 644 [split ${files}] ${dest_dir}
    927     }
    928 
    929     # Move .apps into the applications_dir, and link each .apps'
    930     # executable back into ${qt_bins_dir}
    931 
    932     set dr_qt_apps_dir ${destroot}${qt_apps_dir}
    933     set dr_qt_bins_dir ${destroot}${qt_bins_dir}
    934 
    935     xinstall -m 755 -d ${dr_qt_apps_dir}
    936     foreach app [glob ${dr_qt_bins_dir}/*.app] {
    937 
    938         # remove the leading stuff
    939 
    940         set app [lindex [split ${app} /] end]
    941 
    942         # move the .app
    943 
    944         move ${dr_qt_bins_dir}/${app} ${dr_qt_apps_dir}
    945 
    946         # link the app's executable back
    947 
    948         set texe [strsed ${app} {g@\.app@@}]
    949         ln -s ${qt_apps_dir}/${app}/Contents/MacOS/${texe} \
    950             ${dr_qt_bins_dir}
    951 
    952     }
    953 
    954     # move tests to ${qt_data_dir}
    955 
    956     xinstall -m 755 -d ${destroot}${qt_data_dir}
    957     move ${destroot_qt}/tests/qt4 ${destroot}${qt_data_dir}/tests
    958 
    959     # install ${qt_includes_dir}/Qt if not already and it exists in
    960     # the build, for support of legacy projects
    961 
    962     if {![file exists ${destroot}${qt_includes_dir}/Qt] &&
    963         [file exists ${worksrcpath}/include/Qt]} {
    964 
    965         # copy the Qt headers directory
    966 
    967         copy ${worksrcpath}/include/Qt ${destroot}${qt_includes_dir}
    968 
    969     }
    970 
    971     # link in Resource to ${qt_libs_dir}
    972 
    973     ln -s ${qt_frameworks_dir}/QtGui.framework/Resources \
    974         ${destroot}${qt_libs_dir}
    975 
    976 }
    977 
    978 variant odbc description {Enable iODBC SQL Driver} {
    979     depends_lib-append port:libiodbc
    980     configure.args-delete -no-sql-odbc
    981     configure.args-append -plugin-sql-odbc
    982 }
    983 
    984 variant raster description {Use raster graphics system by default} {
    985     configure.args-append -graphicssystem raster
    986 }
    987 
    988 variant demos description {Build demos} {}
    989 
    990 if {![variant_isset demos]} {
    991    configure.args-append -nomake demos
    992 }
    993 
    994 variant examples description {Build examples} {}
    995 
    996 if {![variant_isset examples]} {
    997    configure.args-append -nomake examples
    998 }
    999 
    1000 variant debug description {Build both release and debug library} {}
    1001 
    1002 if {[variant_isset debug]} {
    1003     configure.args-append -debug-and-release -declarative-debug
    1004 } else {
    1005     configure.args-append -release -no-declarative-debug
    1006 }
    1007 
    1008 variant openvg description {Build with support for OpenVG} {
    1009 
    1010     depends_lib-append port:mesa
    1011 
    1012     pre-configure {
    1013 
    1014         # set OpenVG arg, for both testing and building
    1015 
    1016         configure.env-append QMAKE_OPENVG_ARG=-lOpenVG
    1017 
    1018     }
    1019 }
    1020 
    1021 variant cxx11 description {Add library support for C++11 (EXPERIMENTAL; does not work with libc++)} {
    1022 
    1023     # Block compilers that do not support C++11. This variant seems to
    1024     # work with MacPorts' clang 3.0 or newer and Apple clang newer
    1025     # than 318.0.58 (but, not that version, which is already blocked).
    1026 
    1027     compiler.blacklist-append \
    1028         apple-gcc-4.2 gcc-4.2 llvm-gcc-4.2
    1029 
    1030     pre-fetch {
    1031 
    1032         # This variant does not work with Clang libc++
    1033 
    1034         if {[info exists configure.cxx_stdlib] &&
    1035             ${configure.cxx_stdlib} eq "libc++" &&
    1036             [string match *clang* ${configure.cxx}]} {
    1037 
    1038             ui_msg "\nERROR: C++11 support for Qt4 is not available when using Clang and libc++.\n"
    1039             error "unsupported platform for C++11 support"
    1040 
    1041         }
    1042     }
    1043 
    1044     pre-extract {
    1045 
    1046         ui_msg "\nWARNING: You have enabled C++11 support for Qt4, which is EXPERIMENTAL.  Qt's libraries and applications (not including QMake) will be compiled using C++11.  That said, C++11 will NOT be enabled by default when using QMake.  You can enable C++11 by specifying, e.g. \'CONFIG += c++11\', in any QMake build file.\n"
    1047 
    1048     }
    1049 
    1050     # patches for C++11 only
    1051 
    1052     patchfiles-append patch-cxx11.diff
    1053 
    1054     # have configure test for C++11; our hooks
    1055     # will error out if C++11 is not found.
    1056 
    1057     configure.args-append -c++11
    1058 
    1059 }
    1060 
    1061 post-activate {
    1062     ui_msg "NOTE: Qt database plugins for mysql55, postgresql91, and sqlite2 are NOT installed by this port\; they are installed by qt4-mac-*-plugin instead."
    1063 }
    1064 
    1065 livecheck.type      regex
    1066 livecheck.url       http://download.qt-project.org/official_releases/qt/${branch}/
    1067 livecheck.regex     >(\[0-9.\]+)/<
  • new file aqua/qt4-mac/Portfile.qt4

    diff --git a/aqua/qt4-mac/Portfile.qt4 b/aqua/qt4-mac/Portfile.qt4
    new file mode 100644
    index 0000000..600f92e
    - +  
     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: Portfile 126922 2014-10-17 18:50:56Z ryandesign@macports.org $
     3
     4# use the qt4 group; set 'building_qt4' so that the portgroup
     5# does not include certain parts
     6set building_qt4    1
     7
     8PortGroup           qt4 1.0
     9if {[variant_isset exclusive] && ![variant_isset libsymlinks]} {
     10        # qt4-mac-devel is "replaced_by" this port,
     11        # so this port cannot conflict with it.
     12        #conflicts           qt3 qt3-mac qt4-mac-devel
     13        conflicts           qt3 qt3-mac qt5-mac
     14}
     15
     16PortGroup           xcodeversion 1.0
     17PortGroup           compiler_blacklist_versions 1.0
     18
     19set branch          [join [lrange [split ${version} .] 0 1] .]
     20
     21categories          aqua
     22platforms           macosx
     23maintainers         michaelld openmaintainer
     24license             {LGPL-2.1 GPL-3}
     25
     26homepage            http://qt-project.org
     27description         Qt Tool Kit
     28long_description    Qt Tool Kit: A cross-platform framework \
     29                    (headers, data, and libraries) for writing \
     30                    cross-platform GUI-based applications. \
     31                    Installs to ${qt_dir}
     32
     33
     34distname            qt-everywhere-opensource-src-${version}
     35
     36master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/
     37
     38checksums           rmd160  0220d4e76ac761c9ecfb8ddab6f2c1dc6ad70c33 \
     39                    sha256  8b14dd91b52862e09b8e6a963507b74bc2580787d171feda197badfa7034032c
     40
     41minimum_xcodeversions   {8 2.5}
     42
     43depends_lib-append  port:zlib path:bin/dbus-daemon:dbus \
     44                    port:openssl port:tiff \
     45                    port:libpng port:libmng port:jpeg
     46
     47# find a way to specify the OS MINOR version.  For OSX 10.X, this
     48# value will be X.  The type is this variable is integer, so we can
     49# use "==" and so forth for comparison.
     50
     51global MINOR
     52set MINOR ""
     53
     54# hopefully the MACOSX_DEPLOYMENT_TARGET exists and is set by now.  if
     55# not, last resort (which is not desirable) is to use the os.version.
     56
     57if {${macosx_deployment_target} ne ""} {
     58    set MINOR [lindex [split ${macosx_deployment_target} "."] 1]
     59} else {
     60    set MINOR [expr [lindex [split ${os.version} "."] 0] - 4]
     61}
     62
     63###############################################
     64# Patches are used to both fix compiling on various OS versions, and
     65# to enhance the functionality of QMake and its build files.  Some of
     66# these patches are 2-stage: use a file here, and the replace an
     67# @VARIABLE@ in post-patch.  There are LOTS of patches, because Qt is
     68# a large, complicated system.
     69
     70# (0) Fix the testing script to properly handle both +universal as
     71# well as the native arch for both CXX and CC compiling; also make
     72# sure it does not create a Mac app bundle.
     73
     74patchfiles-append   patch-config.tests_unix_compile.test.diff
     75
     76# (1) Test for Precompiled-headers support (a) requires a C++
     77# compiler, but configure calls it, by default, with a C compiler;
     78# thus, enable testing using the C compiler. (b) to work with ccache,
     79# if used.
     80
     81patchfiles-append   patch-config.tests_unix_precomp.test.diff
     82
     83# (2) fix 'configure' script: (a) to allow easy replacement of arch
     84# type(s). (b) to find the correct QMAKE CXX compiler by removing
     85# possibilities that include the character "$". (c) to declare, use,
     86# and set QT_INSTALL_FRAMEWORKS and QMAKE_FRAMEWORKDIR_QT, both here
     87# and in the resulting .qmake.cache files. (d) to allow easy
     88# replacement of MACOSX_DEPLOYMENT_TARGET: build for just the user's
     89# current OS. (e) add hooks for C++11 testing.
     90
     91patchfiles-append   patch-configure.diff
     92
     93# (3) (a) Tweak various scripts to allow easy replacement of
     94# MACOSX_DEPLOYMENT_TARGET: build for just the user's current OS.
     95# (b) Assign initial OBJECTIVE_CXXFLAGS.
     96
     97patchfiles-append   patch-mkspecs_common_g++-macx.conf.diff
     98
     99# (4) (a) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build
     100# for just the user's current OS; (b) allow QMake to use 'ccache' via,
     101# e.g., "qmake && make CCACHE=ccache".
     102
     103patchfiles-append   patch-mkspecs_common_mac.conf.diff
     104
     105# (5) Place the -I path for local moc-created headers -before-
     106# all other -I paths.
     107
     108patchfiles-append   patch-mkspecs_features_moc.prf.diff
     109
     110# (6) Remove Qt's LIBDIR and INCDIR from various QMake internal
     111# variables, since they are already included in the user-supplied
     112# LIBS and INCLUDEPATH.
     113
     114patchfiles-append   patch-mkspecs_features_qt.prf.diff
     115
     116# (7) (a) Change placement of Qt's LIBDIR and INCDIR, to always be
     117# after those supplied by the user's QMake (.pro) files.  By the time
     118# QMake gets to the patched function, it is creating the Makefile
     119# parts to find Qt's headers and libraries, so moving these paths to
     120# this location should always work. (b) If the library is QtWebKit,
     121# and the build is library (no-framework), universal, and debug, then
     122# the linkage is just -lQtWebKit, not -lQtWebKit_debug because the
     123# debug library for 32-bit system cannot be created (too large).
     124
     125patchfiles-append   patch-mkspecs_features_qt_functions.prf.diff
     126
     127# (8) (a) Change "gcc" and "g++" to @'s for replacement in
     128# post-patch; (b) add hooks for C++11.
     129
     130patchfiles-append   patch-mkspecs_common_g++-base.conf.diff
     131
     132# (9) Add default QMake variables for Objective C++.
     133
     134patchfiles-append   patch-mkspecs_objective_cxx.diff
     135
     136# (10) Add "absolute_library_soname" to the default CONFIG variables,
     137# so that when a DYLIB is created, if "target.path" is set for it then
     138# that path is prepended to its "install_name".
     139
     140patchfiles-append   patch-mkspecs_macx-g++_qmake.conf.diff
     141
     142# (11) Add QT_INSTALL_FRAMEWORKS and related variables to QMake, to
     143# provide a default variable for the location of QMake installed
     144# frameworks.
     145
     146patchfiles-append   \
     147    patch-qmake_option.h.diff \
     148    patch-qmake_property.cpp.diff \
     149    patch-src_corelib_global_qlibraryinfo.cpp.diff \
     150    patch-src_corelib_global_qlibraryinfo.h.diff
     151
     152# (12) In QMake, disable default MKSPECS and FEATURES path
     153# concatinations if the shell environment variable QMAKE_NO_DEFAULTS
     154# is set (to anything); we use this variable in this portfile to make
     155# sure only internal paths (to the build) are searched by QMake.
     156
     157patchfiles-append   patch-qmake_project.cpp.diff
     158
     159# (13) In QMake: (a) enable correct "-framework foo,bar" parsing as
     160# specified by Apple's LD; (b) disable "/Library/Frameworks" as a
     161# default search path; use "PREFIX/Library/Frameworks" and replace
     162# PREFIX in post-patch.  Also set "PREFIX/lib" as a default library
     163# search path.
     164
     165patchfiles-append   patch-qmake_generators_unix_unixmakke.cpp.diff
     166
     167# (14) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build for
     168# just the user's current OS.
     169
     170patchfiles-append   \
     171    patch-qmake_qmake.pri.diff \
     172    patch-src_tools_bootstrap_bootstrap.pro.diff
     173
     174# (15) fix use of CARBON, found on PPC64; does not hurt others
     175
     176patchfiles-append   \
     177    patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff \
     178    patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
     179
     180# (16) fix the corewlan qmake file to use non-standard Developer SDK
     181# location under 10.6 and newer, e.g., for some developers doing both
     182# iOS and OSX.  This patch does not change behavior for 10.4 or 10.5.
     183# Also include fix to use the correct SDK.
     184
     185patchfiles-append   patch-src_plugins_bearer_corewlan_corewlan.pro.diff
     186
     187# (17) Use the "target.path" for libdir for core libraries instead of
     188# the standard QT_INSTALL_LIBS; allows us to set for library or
     189# framework elsewhere and have the install still work here.
     190
     191patchfiles-append   patch-src_qbase.pri.diff
     192
     193# (18) (a) Disable explicit disabling of framework or static install;
     194# i.e., install as a framework if that mode is selected, and as
     195# library otherwise. (b) If installing as framework, use the new
     196# QT_INSTALL_FRAMEWORKS directory; otherwise, use the old
     197# QT_INSTALL_LIBS; (c) Get PKGCONFIG dependencies correct, hopefully;
     198# (d) create and install .pc, .la, and .prl library description files,
     199# including basic path replacement into DESTDIR; we couple this with a
     200# post-patch to get the correct install location.
     201
     202patchfiles-append   \
     203    patch-src_qt_install.pri.diff \
     204    patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff \
     205    patch-tools_assistant_lib_lib.pro.diff \
     206    patch-tools_designer_src_components_lib_lib.pro.diff \
     207    patch-tools_designer_src_lib_lib.pro.diff \
     208    patch-tools_designer_src_uitools_uitools.pro.diff \
     209    patch-mkspecs_features_uitools.prf.diff
     210
     211# (19) fix 'macdeployqt' to look for the correct plugins location by
     212# default.  This is paired with a "reinplace" in post-patch
     213
     214patchfiles-append   \
     215    patch-tools_macdeployqt_macdeployqt_main.cpp.diff
     216
     217# (20) Under 10.4 only: patch QMake build files using just "-lQtHelp"
     218# to do "-lQtHelp -lQtCLucene -lQtNetwork -lQtWebKit" instead.  For
     219# some reason 10.5+ "knows" that how to do this correctly.
     220
     221platform darwin {
     222    if {${MINOR} == 4} {
     223        patchfiles-append patch-QtHelp_10.4_only.diff
     224    }
     225}
     226
     227# (21) fix the Mac timer's use of "mach_timebase_info"
     228
     229patchfiles-append   \
     230    patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
     231
     232# (22) Under 10.8 and 10.9: Patch to fix corelib linking
     233
     234platform darwin {
     235    if {${MINOR} >= 8} {
     236        patchfiles-append patch-src_corelib_corelib.pro.diff
     237    }
     238}
     239
     240# (23) fix Framework directory in MacDeployQt tool
     241
     242patchfiles-append   \
     243    patch-tools_macdeployqt_shared_shared.cpp.diff
     244
     245# (24) minimum patches required for 10.10; squashed; temporary until 4.8.7.
     246
     247patchfiles-append   \
     248    patch-10.10.diff
     249
     250# (25) avoid leaving zombies when starting an inexisting executable through QProcess
     251patchfiles-append \
     252    qprocess-nozombies.patch
     253
     254# error out if trying to build on a new OSX version (> 10.10).
     255
     256platform darwin {
     257    if {${MINOR} > 10} {
     258        # This project needs to be updated to build with clang++ against libc++
     259        depends_lib
     260        depends_run
     261        pre-fetch {
     262            ui_error "$name does not currently build on OSX later than 10.10 'Yosemite'."
     263            error "unsupported platform"
     264        }
     265    }
     266}
     267
     268###############################################
     269
     270# disable CCACHE for now (ticket #34856)
     271
     272configure.ccache no
     273
     274## The main port that installs Qt4:
     275if {${subport} ne "${name}-transitional"} {
     276
     277    # find a way to specify the SDK to use; Qt will use the 10.4u by
     278    # default which won't work on 10.6 since it is not supported.  Allow
     279    # the user to specify the SDK if desired.
     280
     281    global SDK
     282    set SDK ${configure.sdkroot}
     283    if {${SDK} eq ""} {
     284        # set SDK version depending on OS version
     285        set sdk_version ""
     286        if {${MINOR} == 4} {
     287            # OSX 10.4 requires an additional 'u'
     288            set sdk_version "10.4u"
     289        } else {
     290            set sdk_version "10.${MINOR}"
     291        }
     292        if {[vercmp ${xcodeversion} 4.3] < 0} {
     293            set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
     294        } else {
     295            set SDK ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk_version}.sdk
     296        }
     297    }
     298
     299    post-patch {
     300        # set ARCHES in configure (per the third patchfile above), for
     301        # building QMake.  join any 2 or more arch entries with the GCC
     302        # arch flag (join does not effect a single entry).  first "-arch"
     303        # is already in place in the 'configure' script (since there has
     304        # to be at least 1 arch).
     305
     306        set ARCHES ""
     307        if {[variant_exists universal] && [variant_isset universal]} {
     308            set ARCHES [join ${universal_archs} " -arch "]
     309        } else {
     310            set ARCHES ${build_arch}
     311        }
     312        reinplace "s|@ARCHES@|${ARCHES}|g" ${worksrcpath}/configure
     313
     314        # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
     315        # were all patched in (2) above, and can be easily changed or
     316        # overridden by the user in a project-local qmake .pro script.
     317
     318        set TARGET "10.${MINOR}"
     319        foreach fixfile {configure mkspecs/common/g++-macx.conf \
     320                         mkspecs/common/mac.conf qmake/qmake.pri \
     321                         src/tools/bootstrap/bootstrap.pro } {
     322            reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
     323                ${worksrcpath}/${fixfile}
     324        }
     325
     326        # Fix OS version on Bearer CoreWLAN QMake file
     327
     328        reinplace "s|@MACOSX_VERSION_MINOR@|${MINOR}|g" \
     329            ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
     330
     331        # Ensure that correct C/C++ compilers are used.
     332
     333        reinplace "s|@CXX@|${configure.cxx}|" \
     334            ${worksrcpath}/mkspecs/common/g++-base.conf
     335        reinplace "s|@CC@|${configure.cc}|"  \
     336            ${worksrcpath}/mkspecs/common/g++-base.conf
     337
     338        # fix the corewlan .pro file to use the correct developer SDK
     339
     340        reinplace "s,@DEVELOPER_SDK@,${SDK},g" \
     341            ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
     342
     343        # fix 'macdeployqt' to look for the correct
     344        # plugins location by default.
     345
     346        reinplace "s,@QT_PLUGINS_DIR@,${qt_plugins_dir},g" \
     347            ${worksrcpath}/tools/macdeployqt/macdeployqt/main.cpp
     348
     349        # fix PREFIX in QMake makefile generator
     350
     351        reinplace "s,@PREFIX@,${qt_dir},g" \
     352            ${worksrcpath}/qmake/generators/unix/unixmake.cpp
     353
     354        # if no debug, then do not even build debug code
     355
     356        if {![variant_isset debug]} {
     357            foreach fixfile { src/qbase.pri \
     358                              src/3rdparty/webkit/Source/WebKit.pri \
     359                              src/imports/qimportbase.pri \
     360                              src/plugins/qpluginbase.pri \
     361                              tools/designer/src/components/lib/lib.pro \
     362                              tools/designer/src/lib/lib.pro \
     363                              tools/designer/src/plugins/activeqt/activeqt.pro \
     364                              tools/designer/src/plugins/plugins.pri \
     365                              tools/designer/src/uitools/uitools.pro \
     366                              src/3rdparty/webkit/Source/WebKit/qt/declarative/declarative.pro } {
     367                reinplace "/+=/s@debug_and_release@@g" \
     368                    ${worksrcpath}/${fixfile}
     369            }
     370        }
     371
     372        # copy C++11 files into place, if that variant is set
     373
     374        if {[variant_isset cxx11]} {
     375            copy ${filespath}/c++11.prf ${worksrcpath}/mkspecs/features
     376            copy ${filespath}/c++11 ${worksrcpath}/config.tests/mac
     377        }
     378
     379        # copy Objective C / CXX files into place
     380
     381        copy ${filespath}/objective_cxx.prf \
     382            ${worksrcpath}/mkspecs/features/mac
     383        copy ${filespath}/split_sources.prf \
     384            ${worksrcpath}/mkspecs/features/mac
     385
     386        # copy extra compiler tests into place; these are patched into the
     387        # configure script to the area before qmake is built.  If any
     388        # fail, configure will fail quickly.
     389
     390        copy ${filespath}/fconstant_cfstrings.test \
     391            ${worksrcpath}/config.tests/mac
     392        copy ${filespath}/objc_block \
     393            ${worksrcpath}/config.tests/mac
     394        copy ${filespath}/cpath \
     395            ${worksrcpath}/config.tests/mac
     396        copy ${filespath}/library_path \
     397            ${worksrcpath}/config.tests/mac
     398    }
     399
     400    # Block various compilers:
     401    #
     402    # * The build process requires -Xarch, -fconstant-cfstring, and
     403    # Objective-C(++) blocks (^), which are not supported with vanilla GCC
     404    # as installed by MacPorts but are supported by all versions of CLANG
     405    # (both MacPorts' and Apple's).
     406    #
     407    # * Some older versions of CLANG do not honor the CPATH
     408    # environment variables, which is required for compiling
     409    # this port when using MacPorts.  The versions seem to be: MacPorts
     410    # CLANG 2.9 or earlier, and Apple CLANG 318.0.58 or older.
     411    #
     412    # * Some older versions of CLANG do not honor the LIBRARY_PATH
     413    # environment variables, which is required for compiling
     414    # this port when using MacPorts.  The versions seem to be: MacPorts
     415    # CLANG 3.0 or earlier, and Apple CLANG 318.0.61 or older.
     416    #
     417    # * qt4-creator-mac fails to build with GCC <= 4.0.
     418    #
     419    # See also:
     420    # < http://llvm.org/bugs/show_bug.cgi?id=8971 >,
     421    # < https://trac.macports.org/ticket/30271 >,
     422    # < https://trac.macports.org/ticket/31076 >,
     423    # < https://trac.macports.org/ticket/31638 >,
     424    # < https://trac.macports.org/ticket/37868 >, and
     425    # < https://trac.macports.org/ticket/40422 >.
     426    #
     427    # NOTE: qt4-mac augments the standard Qt4 configure script with
     428    # pre-qmake-build tests for CPATH, LIBRARY_PATH, -Xarch,
     429    # -fconstant-cfstring, Objective-C(++) blocks, and, if requested,
     430    # C++11.  The script will error out quickly if the compiler does not
     431    # seem to provide support for any one of these properties, no matter
     432    # this blacklist.
     433    #
     434
     435    compiler.blacklist-append { clang <= 318.0.61 } \
     436        gcc-3.3 *gcc-4.0 macports-gcc* \
     437        macports-clang-2.9 macports-clang-3.0
     438
     439    # --prefix is not recognized.
     440    configure.pre_args-delete       --prefix=${prefix}
     441
     442    # --disable-dependency-tracking is not recognized.
     443    configure.universal_args-delete --disable-dependency-tracking
     444
     445    # clear all arch-oriented flags since somehow they impact how qmake is
     446    # created, which in turn messes up LDFLAGS in most created Makefiles.
     447
     448    configure.ld_archflags
     449    configure.cc_archflags
     450    configure.cxx_archflags
     451    configure.universal_ldflags
     452    configure.universal_cflags
     453    configure.universal_cxxflags
     454    configure.universal_cppflags
     455    configure.march
     456    configure.mtune
     457
     458    # Use compiler.cpath and compiler.library_path for all -I and -L
     459    # entries, so-as to avoid conflicts with already-installed headers and
     460    # libraries (giving preference to internal-to-this-port first).  CPATH
     461    # is used instead of -I to avoid conflicts with other ports.
     462    #
     463    # See also:
     464    # < https://trac.macports.org/ticket/15219 >,
     465    # < https://trac.macports.org/ticket/18723 >, and
     466    # < https://trac.macports.org/ticket/25321 >.
     467
     468    # set the default paths to include those for SQLITE3 and DBUS-1
     469
     470    set header_path [ list ${prefix}/include/dbus-1.0 \
     471                           ${prefix}/lib/dbus-1.0/include \
     472                           ${prefix}/include ]
     473
     474    set library_path [ list ${prefix}/lib ]
     475
     476    # -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
     477    #     which it is not able to find in ${prefix}.
     478    #
     479    # -openssl-linked ensures that the MacPorts openssl is used.
     480    #
     481    # -framework ensures that this port is installed as frameworks
     482    #     (collections of {library, headers, resources}); in
     483    #     post-destroot, link headers and libraries from the frameworks
     484    #     into non-framework locations as if "-no-framework" were
     485    #     specified.  Some dependent projects will not work properly if Qt
     486    #     is installed as libraries by default, thus make it so #1.
     487    #
     488    # -no-phonon ensures that Qt does not install the 3rd-parth Phonon
     489    #     port or its backend to QuickTime 7; Phonon is now installed via
     490    #     the 'phonon' port, which is more up to date than that provided
     491    #     by Qt.
     492
     493    configure.args                                            \
     494        -v                                                    \
     495        -confirm-license                                      \
     496        -opensource                                           \
     497        -prefix          ${qt_dir}                            \
     498        -bindir          ${qt_bins_dir}                       \
     499        -libdir          ${qt_libs_dir}                       \
     500        -docdir          ${qt_docs_dir}                       \
     501        -headerdir       ${qt_includes_dir}                   \
     502        -plugindir       ${qt_plugins_dir}                    \
     503        -importdir       ${qt_imports_dir}                    \
     504        -datadir         ${qt_data_dir}                       \
     505        -translationdir  ${qt_translations_dir}               \
     506        -sysconfdir      ${qt_sysconf_dir}                    \
     507        -examplesdir     ${qt_examples_dir}                   \
     508        -demosdir        ${qt_demos_dir}                      \
     509        -openssl-linked                                       \
     510        -dbus-linked                                          \
     511        -fast                                                 \
     512        -optimized-qmake                                      \
     513        -no-pch                                               \
     514        -framework                                            \
     515        -no-phonon                                            \
     516        -no-phonon-backend                                    \
     517        -fontconfig -system-freetype
     518
     519    # Stop configure script from searching for SQL Drivers
     520    #    not available from MacPorts.
     521
     522    foreach driver {db2 ibase oci tds} {
     523        configure.args-append -no-sql-${driver}
     524    }
     525
     526    # Disable all remaining SQL Drivers.  These are available via the
     527    # ports qt4-mac-*-plugin.
     528
     529    foreach driver {mysql odbc psql sqlite sqlite2} {
     530        configure.args-append -no-sql-${driver}
     531    }
     532
     533    pre-configure {
     534
     535        # use the corrected CPATH and LIBRARY_PATH for build
     536
     537        compiler.cpath [join ${header_path} :]
     538        compiler.library_path [join ${library_path} :]
     539
     540        # for 10.4 or 10.5 32-bit PPC, build as Carbon only, not Cocoa
     541
     542        if {${MINOR} == 4} {
     543
     544            configure.args-append -carbon
     545
     546            # required linking flags?
     547
     548            configure.ldflags-append -lcrypto -ldbus-1 -ljpeg -llcms \
     549                -lssl -lz
     550
     551        } elseif {${MINOR} == 5 &&
     552                  [llength ${qt_arch_types}] == 1 &&
     553                  [lsearch -exact ${qt_arch_types} ppc] == 0} {
     554
     555            configure.args-append -carbon
     556
     557        }
     558
     559        # set the arch type(s) to use, in Qt-speak
     560
     561        configure.args-append -arch \"${qt_arch_types}\"
     562
     563        # cannot use pre-compiled headers when compiling with more than 1
     564        # arch type (typically +universal) or for X11
     565
     566        #if {[llength ${qt_arch_types}] != 1 || [variant_isset x11]}
     567
     568        # check to see if not compiling for the native machine hardware
     569        # (e.g., compiling for just i386 but CPU is x86_64); optimization
     570        # of QMake does not work in this circumstance.
     571
     572        if {[lsearch -exact ${qt_arch_types} ${os.arch}] == -1} {
     573
     574            # not building for native arch: disable optimizing qmake
     575            configure.args-delete -optimized-qmake
     576
     577        } elseif {${MINOR} == 6 &&
     578                  [llength ${qt_arch_types}] == 1 &&
     579                  [lsearch -exact ${qt_arch_types} x86] == 0} {
     580
     581            # disable qmake optimization on 10.6 32-bit
     582            configure.args-delete -optimized-qmake
     583
     584        }
     585
     586        # set the SDK, if it was found and exists
     587
     588        if {[file exists ${SDK}]} {
     589            configure.args-append -sdk ${SDK}
     590        }
     591
     592        # set which pkg-config to use
     593
     594        configure.env-append PKG_CONFIG=${prefix}/bin/pkg-config
     595
     596        # set which stdlib to use; clang only
     597        if {[string match *clang* ${configure.compiler}]} {
     598            configure.env-append QMAKE_STDLIB="-stdlib=${configure.cxx_stdlib}"
     599            configure.ldflags-append -stdlib=${configure.cxx_stdlib}
     600        }
     601    }
     602
     603    post-configure {
     604
     605        # Remove any '-I' and '-L' string from the *FLAGS for SQLITE,
     606        # DBUS, ODBC, and OPENSSL, so that what remains are just non-I/L
     607        # flags; these paths are in compiler.cpath and
     608        # compiler.library_path.  The header and library paths for all the
     609        # other variants are not used by 'configure', and are already
     610        # included in the compiler.cpath and compiler.library_path
     611        # . during the 'build' stage, 'make' will rebuild the Makefiles
     612        # that depend on any of these changed files.  These patches are
     613        # sufficient to make sure local (to this build) paths are searched
     614        # first, and then system paths last (via the compiler.X settings).
     615        # Ideally, 'qmake' -- either via its mkspecs files or the
     616        # project's build files -- would distinguish between "local" and
     617        # "system" includes & libraries.
     618
     619        # SQLITE
     620        reinplace "/SQLITE/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
     621            ${worksrcpath}/.qmake.cache
     622        reinplace "/SQLITE/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
     623            ${worksrcpath}/.qmake.cache
     624        # DBUS
     625        reinplace "/DBUS/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
     626            ${worksrcpath}/.qmake.cache
     627        reinplace "/DBUS/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
     628            ${worksrcpath}/.qmake.cache
     629        # OPENSSL
     630        reinplace "/OPENSSL/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
     631            ${worksrcpath}/.qmake.cache
     632        reinplace "/OPENSSL/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
     633            ${worksrcpath}/.qmake.cache
     634        # ODBC
     635        reinplace "/ODBC/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
     636            ${worksrcpath}/.qmake.cache
     637        reinplace "/ODBC/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
     638            ${worksrcpath}/.qmake.cache
     639    }
     640
     641    pre-build {
     642        # use the corrected CPATH and LIBRARY_PATH for build
     643        compiler.cpath [join ${header_path} :]
     644        compiler.library_path [join ${library_path} :]
     645    }
     646
     647    # do not use DESTDIR directly in the destroot command; Qt uses DISTDIR
     648    # internally for other purposes, and instead uses INSTALL_ROOT for the
     649    # additional install root prefix.
     650
     651    destroot.post_args
     652
     653    pre-destroot {
     654        # this isn't really nice if the user has 2nd thoughts and wants to install those html files after all
     655        # (and knows how to get port to redo an install without cleaning and rebuilding everything).
     656        # Let's hope that happens rarely enough to prefer speeding up the destroot step for the others
     657        if {![variant_isset htmldocs]} {
     658            if {[file exists ${worksrcpath}/doc/html/images]} {
     659                ui_msg "cleaning out ${worksrcpath}/doc/html per your request"
     660                delete file ${worksrcpath}/doc/html/images ${worksrcpath}/doc/html/scripts ${worksrcpath}/doc/html/style
     661                eval file delete [glob ${worksrcpath}/doc/html/*.html]
     662                eval file delete [glob ${worksrcpath}/doc/html/qt.*]
     663            }
     664        }
     665    }
     666
     667    post-destroot {
     668
     669        set destroot_qt ${destroot}${qt_dir}
     670
     671        # Fix .pc and .prl files by changing ${worksrcpath}\${prefix} to
     672        # ${qt_dir}\${prefix} ("\" means 'take away').  Cannot use
     673        # "find -E" since it is not necessarily portable.
     674
     675        regsub ${prefix} ${worksrcpath} "" from_dir
     676        regsub ${prefix} ${qt_dir} "" to_dir
     677        foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
     678            reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
     679        }
     680        foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
     681            reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
     682        }
     683
     684        # fix .pc files
     685
     686        foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
     687
     688            # remove Libs.private; they can mess up linking
     689
     690            reinplace "/Libs\.private/d" ${fixfile}
     691
     692            # use ${prefix} correctly
     693
     694            # RJVB:
     695            # don't replace ${prefix} (e.g. /opt/local) with \${prefix}
     696            # unless ${qt_dir} == ${prefix} (but I don't see the point at all...)
     697            if {${prefix} eq ${qt_dir}} {
     698                reinplace "s|${prefix}/|\${prefix}/|g" ${fixfile}
     699            }
     700
     701            # fix libdir
     702
     703            reinplace "/libdir=/s|Library/Frameworks|lib|" ${fixfile}
     704
     705            # fix Libs: to use -L instead of -F
     706
     707            reinplace "/Libs:/s|-F|-L|" ${fixfile}
     708
     709            # fix Libs: to use -lQt* instead of "-framework Qt*"
     710            # depends on whether for release or debug
     711
     712            set fn [lindex [split ${fixfile} /] end]
     713
     714            if {[lsearch -regexp ${fn} debug] == 0} {
     715
     716                # debug; need to add that string to all Qt dependency libraries
     717                reinplace "/Libs:/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|" \
     718                    ${fixfile}
     719
     720            } else {
     721
     722                # no debug; just replace
     723                reinplace "/Libs:/s|-framework Qt|-lQt|" ${fixfile}
     724
     725            }
     726        }
     727
     728        # move .pc files from ${qt_frameworks_dir}/pkgconfig to
     729        # ${qt_pkg_config_dir}
     730
     731        file delete -force ${destroot}${qt_pkg_config_dir}
     732        xinstall -m 755 -d ${destroot}${qt_libs_dir}
     733    #    move ${destroot}${qt_frameworks_dir}/pkgconfig \
     734    #        ${destroot}${qt_libs_dir}
     735    # RJVB: ${destroot}${qt_libs_dir} is NOT always equal to ${qt_pkg_config_dir} !!
     736        move ${destroot}${qt_frameworks_dir}/pkgconfig \
     737            ${destroot}${qt_pkg_config_dir}
     738        if {![variant_isset exclusive]} {
     739            # qt_pkg_config_dir==${prefix}/lib/pkgconfig; make a symlink to that place in
     740            # ${qt_libs_dir} so that 3rd party .pc files end up where pkg-config can find them ...
     741            ln -s ${qt_pkg_config_dir} ${destroot}${qt_libs_dir}/pkgconfig
     742        }
     743
     744        # move .la files from ${qt_frameworks_dir} to ${qt_libs_dir}
     745
     746        foreach laf [glob ${destroot}/${qt_frameworks_dir}/*.la] {
     747            move ${laf} ${destroot}${qt_libs_dir}
     748        }
     749
     750        # remove -L entries from .prl and .la files
     751
     752        foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
     753            reinplace "/QMAKE_PRL_LIBS/s|-L\[^ \]*||g" ${fixfile}
     754        }
     755        foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
     756            reinplace "/dependency_libs/s|-L\[^ \]*||g" ${fixfile}
     757        }
     758
     759        # remove redundant -F entries from .prl and .la files
     760
     761        foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
     762            reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*|FREPLACEME|1" \
     763                ${fixfile}
     764            reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*||g" ${fixfile}
     765            reinplace "s|FREPLACEME|-F${prefix}/${qt_frameworks_dir_rel}|1" \
     766                ${fixfile}
     767            # also remove the QMAKE_PRL_BUILD_DIR lines
     768            reinplace "/QMAKE_PRL_BUILD_DIR/d" ${fixfile}
     769        }
     770        foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
     771            reinplace "/dependency_libs/s|-F\[^ \]*|FREPLACEME|1" \
     772                ${fixfile}
     773            reinplace "/dependency_libs/s|-F\[^ \]*||g" ${fixfile}
     774            reinplace "s|FREPLACEME|-F${prefix}/${qt_frameworks_dir_rel}|1" \
     775                ${fixfile}
     776        }
     777
     778        # get Qt's version numbers
     779
     780        set qt_vers [split ${version} "."]
     781        set qt_major [lindex ${qt_vers} 0]
     782        set qt_minor [lindex ${qt_vers} 1]
     783        set qt_patch [lindex ${qt_vers} 2]
     784
     785        # link includes and libraries for each actual installed framework
     786
     787        # make sure that qt_includes_dir exist; apparently it will not have been created at this point,
     788        # despite the -headerdir ${qt_includes_dir} argument to configure. Because of doing a framework build?
     789        exec mkdir -p ${destroot}${qt_includes_dir}
     790        foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
     791                             -name "*.framework" | \
     792                             sed -e "s@${destroot}@@g"] {
     793
     794            set tf_full [strsed ${fixfile} {s@\\.framework@@}]
     795            set tf [strsed ${tf_full} {g@.*\/@@}]
     796
     797            # special for QtWebKit entries
     798
     799            set t_minor ${qt_minor}
     800            set is_QtWebKit 0
     801            if {[string compare ${tf} QtWebKit] == 0} {
     802                set t_minor 9
     803                set is_QtWebKit 1
     804            }
     805
     806            # link headers into ${qt_includes_dir}, removing directories
     807            # if they are already there first
     808
     809            set inc_file ${destroot}${qt_includes_dir}/${tf}
     810            if {[file exists ${inc_file}]} {
     811                file delete -force ${inc_file}
     812            }
     813            ln -s ${tf_full}.framework/Headers ${inc_file}
     814
     815            # link libraries into ${qt_libs_dir}, all 4 number variants
     816
     817            set dr_qt_libs_dir ${destroot}${qt_libs_dir}
     818
     819            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
     820            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
     821            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
     822            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
     823
     824            # copy .prl file, then correct it for library usage
     825
     826            copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
     827
     828            # fix TARGET in .prl file
     829
     830            reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
     831
     832            # fix PRL_LIBS -F -> -L in .prl file
     833
     834            reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
     835
     836            # fix "-framework Qt*" -> "-lQt*" in .prl file
     837
     838            reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
     839                ${dr_qt_libs_dir}/lib${tf}.prl
     840
     841            # fix up .la files to work with ${prefix}/lib entries
     842
     843            # rename .la file
     844
     845            move ${dr_qt_libs_dir}/${tf}.la ${dr_qt_libs_dir}/lib${tf}.la
     846
     847            # fix "name that we can dlopen" in .la file
     848
     849            reinplace "s|dlname=''|dlname='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}.la
     850
     851            # fix "names of this library" in .la file
     852
     853            reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}.${qt_major}.${t_minor}.dylib lib${tf}.${qt_major}.dylib lib${tf}.dylib'|" \
     854                ${dr_qt_libs_dir}/lib${tf}.la
     855
     856            # fix "name of the static archive"; there is none in .la file
     857
     858            reinplace "s|old_library='\[^'\]*'|old_library=''|" \
     859                ${dr_qt_libs_dir}/lib${tf}.la
     860
     861            # fix "libraries that this one depends upon" in .la file
     862
     863            reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|"  ${dr_qt_libs_dir}/lib${tf}.la
     864            reinplace "/dependency_libs/s|-framework Qt|-lQt|g" \
     865                ${dr_qt_libs_dir}/lib${tf}.la
     866            reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
     867                ${dr_qt_libs_dir}/lib${tf}.la
     868            reinplace "/dependency_libs/s| -lwebcore||" \
     869                ${dr_qt_libs_dir}/lib${tf}.la
     870            reinplace "/dependency_libs/s| -ljscore||" \
     871                ${dr_qt_libs_dir}/lib${tf}.la
     872
     873            # fix "directory that this library needs to be installed in" in .la file
     874
     875            reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
     876                ${dr_qt_libs_dir}/lib${tf}.la
     877
     878            # deal with debug files
     879
     880            if {[variant_isset debug]} {
     881
     882                # but not if QtWebKit and +universal, since that one does
     883                # not exist (the 32-bit version of the debug library is
     884                # larger than fits into the 32-bit filespace).
     885
     886                if {[variant_isset debug] && ${is_QtWebKit}} {
     887                    continue
     888                }
     889
     890                # link libraries into ${qt_libs_dir}, all 4 number variants
     891
     892                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
     893                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
     894                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
     895                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
     896
     897                # copy .prl file, then correct it for library usage
     898
     899                copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
     900
     901                # fix TARGET in .prl file
     902
     903                reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     904
     905                # fix PRL_LIBS -F -> -L in .prl file
     906
     907                reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     908
     909                # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
     910
     911                reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     912
     913                # fix up .la files to work with ${prefix}/lib entries
     914
     915                # rename .la file
     916
     917                move ${dr_qt_libs_dir}/${tf}_debug.la \
     918                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     919
     920                # fix "name that we can dlopen" in .la file
     921
     922                reinplace "s|dlname=''|dlname='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}_debug.la
     923
     924                # fix "names of this library" in .la file
     925
     926                reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}_debug.${qt_major}.${t_minor}.dylib lib${tf}_debug.${qt_major}.dylib lib${tf}_debug.dylib'|" \
     927                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     928
     929                # fix "name of the static archive"; there is none in .la file
     930
     931                reinplace "s|old_library='\[^'\]*'|old_library=''|" \
     932                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     933
     934                # fix "libraries that this one depends upon" in .la file
     935
     936                reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.la
     937                reinplace "/dependency_libs/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.la
     938                reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
     939                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     940                reinplace "/dependency_libs/s| -lwebcored||" \
     941                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     942                reinplace "/dependency_libs/s| -ljscored||" \
     943                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     944
     945                # fix "directory that this library needs to be installed in" in .la file
     946
     947                reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
     948                    ${dr_qt_libs_dir}/lib${tf}_debug.la
     949
     950            }
     951        }
     952
     953        # Install documentation.
     954
     955        xinstall -m 755 -d ${worksrcpath}/${qt_docs_dir}
     956        xinstall -m 644 -W ${worksrcpath} \
     957            INSTALL LGPL_EXCEPTION.txt LICENSE.FDL \
     958            LICENSE.GPL3 LICENSE.LGPL README \
     959            ${destroot}${qt_docs_dir}
     960
     961        # Install private headers needed by QtCreator
     962
     963        foreach {src_dir include_dir} \
     964        {corelib QtCore gui QtGui script QtScript declarative QtDeclarative} {
     965            set dest_dir ${destroot}${qt_frameworks_dir}/${include_dir}.framework/Headers/private
     966            xinstall -m 755 -d ${dest_dir}
     967            set files [exec find ${worksrcpath}/src/${src_dir} -type f -name "*_p.h"]
     968            eval xinstall -m 644 [split ${files}] ${dest_dir}
     969        }
     970
     971        # Move .apps into the applications_dir, and link each .apps'
     972        # executable back into ${qt_bins_dir}
     973
     974        set dr_qt_apps_dir ${destroot}${qt_apps_dir}
     975        set dr_qt_bins_dir ${destroot}${qt_bins_dir}
     976
     977        xinstall -m 755 -d ${dr_qt_apps_dir}
     978        foreach app [glob ${dr_qt_bins_dir}/*.app] {
     979
     980            # remove the leading stuff
     981
     982            set app [lindex [split ${app} /] end]
     983
     984            # move the .app
     985
     986            move ${dr_qt_bins_dir}/${app} ${dr_qt_apps_dir}
     987
     988            # link the app's executable back
     989
     990            set texe [strsed ${app} {g@\.app@@}]
     991            ln -s ${qt_apps_dir}/${app}/Contents/MacOS/${texe} \
     992                ${dr_qt_bins_dir}
     993
     994        }
     995
     996        # move tests to ${qt_data_dir}
     997
     998        xinstall -m 755 -d ${destroot}${qt_data_dir}
     999        move ${destroot_qt}/tests/qt4 ${destroot}${qt_data_dir}/tests
     1000
     1001        # install ${qt_includes_dir}/Qt if not already and it exists in
     1002        # the build, for support of legacy projects
     1003
     1004        if {![file exists ${destroot}${qt_includes_dir}/Qt] &&
     1005            [file exists ${worksrcpath}/include/Qt]} {
     1006
     1007            # copy the Qt headers directory
     1008
     1009            copy ${worksrcpath}/include/Qt ${destroot}${qt_includes_dir}
     1010
     1011        }
     1012
     1013        # link in Resource to ${qt_libs_dir}
     1014
     1015        ln -s ${qt_frameworks_dir}/QtGui.framework/Resources \
     1016            ${destroot}${qt_libs_dir}
     1017
     1018        if {![variant_isset exclusive]} {
     1019            ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake${qt_major}.${qt_minor}
     1020            ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc${qt_major}.${qt_minor}
     1021            ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic${qt_major}.${qt_minor}
     1022            ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease${qt_major}.${qt_minor}
     1023        }
     1024        if {[variant_isset KDE]} {
     1025            # expose KDE4 styles to Qt4:
     1026            ln -s ${prefix}/lib/kde4/plugins/styles ${destroot}${qt_plugins_dir}/
     1027        }
     1028        if {[variant_isset noexceptions ]} {
     1029            # building with -no-exceptions will add a section to QtCore/qconfig.h that has to be removed
     1030            # given that we did NOT build QtCore WITHOUT exceptions...
     1031            exec patch -d ${destroot}${qt_frameworks_dir} -Np0 -i ${filespath}/qconfig-remove-EXCEPTIONS.diff
     1032        }
     1033    }
     1034
     1035    variant odbc description {Enable iODBC SQL Driver} {
     1036        depends_lib-append port:libiodbc
     1037        configure.args-delete -no-sql-odbc
     1038        configure.args-append -plugin-sql-odbc
     1039    }
     1040
     1041    variant raster description {Use raster graphics system by default} {
     1042        configure.args-append -graphicssystem raster
     1043    }
     1044
     1045    variant demos description {Build demos} {}
     1046
     1047    if {![variant_isset demos]} {
     1048       configure.args-append -nomake demos
     1049    }
     1050
     1051    variant examples description {Build examples} {}
     1052
     1053    if {![variant_isset examples]} {
     1054       configure.args-append -nomake examples
     1055    }
     1056
     1057    variant debug description {Build both release and debug library} {}
     1058
     1059    if {[variant_isset debug]} {
     1060        configure.args-append -debug-and-release -declarative-debug
     1061    } else {
     1062        configure.args-append -release -no-declarative-debug
     1063    }
     1064
     1065    variant openvg description {Build with *experimental* support for OpenVG} {
     1066
     1067        depends_lib-append port:mesa
     1068
     1069        pre-configure {
     1070
     1071            # set OpenVG arg, for both testing and building
     1072
     1073            configure.env-append QMAKE_OPENVG_ARG=-lOpenVG
     1074
     1075        }
     1076    }
     1077
     1078    variant cxx11 description {Add library support for C++11 (EXPERIMENTAL; does not work with libc++)} {
     1079
     1080        # Block compilers that do not support C++11. This variant seems to
     1081        # work with MacPorts' clang 3.0 or newer and Apple clang newer
     1082        # than 318.0.58 (but, not that version, which is already blocked).
     1083
     1084        compiler.blacklist-append \
     1085            apple-gcc-4.2 gcc-4.2 llvm-gcc-4.2
     1086
     1087        pre-fetch {
     1088
     1089            # This variant does not work with Clang libc++
     1090
     1091            if {[info exists configure.cxx_stdlib] &&
     1092                ${configure.cxx_stdlib} eq "libc++" &&
     1093                [string match *clang* ${configure.cxx}]} {
     1094
     1095                ui_msg "\nERROR: C++11 support for Qt4 is not available when using Clang and libc++.\n"
     1096                error "unsupported platform for C++11 support"
     1097
     1098            }
     1099        }
     1100
     1101        pre-extract {
     1102
     1103            ui_msg "\nWARNING: You have enabled C++11 support for Qt4, which is EXPERIMENTAL.  Qt's libraries and applications (not including QMake) will be compiled using C++11.  That said, C++11 will NOT be enabled by default when using QMake.  You can enable C++11 by specifying, e.g. \'CONFIG += c++11\', in any QMake build file.\n"
     1104
     1105        }
     1106
     1107        # patches for C++11 only
     1108
     1109        patchfiles-append patch-cxx11.diff
     1110
     1111        # have configure test for C++11; our hooks
     1112        # will error out if C++11 is not found.
     1113
     1114        configure.args-append -c++11
     1115
     1116    }
     1117
     1118    variant htmldocs description {Install HTML documentation (>200Mb)} {}
     1119
     1120    post-activate {
     1121        ui_msg "NOTE: Qt database plugins for mysql55, postgresql91, and sqlite2 are NOT installed by this port\; they are installed by qt4-mac-*-plugin instead."
     1122    }
     1123
     1124    variant KDE description {Include RJVB's patches for use with KDE} {
     1125        patchfiles-append  qt4-correct-systraymenu-iconhandling.patch \
     1126                           qt4-deactivate-menurole-heuristics.patch \
     1127                           prevent_addTitleRelated_crash.patch \
     1128                           debug-negative-qtimerint.patch \
     1129                           silence-qfilesystemwatcher.patch \
     1130                           patch-QAction_isEnabled.diff
     1131    }
     1132
     1133    variant noexceptions description {build without using exceptions internally} {
     1134        # (26) don't build with exceptions, which gives a completely ABI-compatible build
     1135        patchfiles-append       disable-exceptions.patch
     1136        configure.args-append   -no-exceptions
     1137    }
     1138
     1139}
     1140
     1141## The convenience subport that installs the symlinks which allow ports built against qt4-mac +exclusive
     1142## to keep functioning after installing qt4-mac in the new concurrent mode, without rebuilding them.
     1143## It can be uninstalled after all Qt4 "client" ports have been rebuilt.
     1144if { ${subport} eq "${name}-transitional" } {
     1145    if {[variant_isset exclusive]} {
     1146            return -code error "\n\nERROR:\n\
     1147    ${name}-transitional is available only when qt4-mac has been installed without +exclusive\n"
     1148    }
     1149    fetch {
     1150        if {![info exists qt4_is_concurrent]} {
     1151            return -code error "\n\nERROR:\n\
     1152    ${name}-transitional is available only when qt4-mac has been installed without +exclusive\n"
     1153        }
     1154    }
     1155    if {[file exists ${prefix}/Library/Frameworks/QtCore.framework/Versions/5/Headers/QtCore]} {
     1156        conflicts-append    qt5-mac
     1157    }
     1158    checksum {}
     1159    extract {}
     1160    patch {}
     1161    post-patch {}
     1162    configure {}
     1163    build {}
     1164    destroot {
     1165        set qt_vers [split ${version} "."]
     1166        set qt_major [lindex ${qt_vers} 0]
     1167        set qt_minor [lindex ${qt_vers} 1]
     1168        set qt_patch [lindex ${qt_vers} 2]
     1169        exec mkdir -p ${destroot}/${prefix}/lib ${destroot}/${prefix}/Library/Frameworks
     1170        foreach fixfile [exec find ${qt_frameworks_dir} \
     1171                             -name "*.framework"] {
     1172
     1173            set tf_full [strsed ${fixfile} {s@\\.framework@@}]
     1174            set tf [strsed ${tf_full} {g@.*\/@@}]
     1175            ln -s ${tf_full}.framework/${tf} ${destroot}/${prefix}/lib/lib${tf}.${qt_major}.dylib
     1176            ln -s ${tf_full}.framework/${tf} ${destroot}/${prefix}/lib/lib${tf}.${qt_major}.${qt_minor}.dylib
     1177            ln -s ${tf_full}.framework/${tf} ${destroot}/${prefix}/lib/lib${tf}.${qt_major}.${qt_minor}.${qt_patch}.dylib
     1178            ln -s ${tf_full}.framework       ${destroot}/${prefix}/Library/Frameworks/${tf}.framework
     1179        }
     1180    }
     1181}
     1182
     1183livecheck.type      regex
     1184livecheck.url       http://download.qt-project.org/official_releases/qt/${branch}/
     1185livecheck.regex     >(\[0-9.\]+)/<
  • new file aqua/qt4-mac/files/debug-negative-qtimerint.patch

    diff --git a/aqua/qt4-mac/files/debug-negative-qtimerint.patch b/aqua/qt4-mac/files/debug-negative-qtimerint.patch
    new file mode 100644
    index 0000000..d2897dd
    - +  
     1--- src/corelib/kernel/orig.qobject.cpp 2014-04-10 20:37:11.000000000 +0200
     2+++ src/corelib/kernel/qobject.cpp      2014-12-09 00:43:41.000000000 +0100
     3@@ -1597,12 +1597,83 @@
     4     \sa timerEvent(), killTimer(), QTimer::singleShot()
     5 */
     6 
     7+#include <unistd.h>
     8+#include <execinfo.h>
     9+#include <cxxabi.h>
     10+
     11+static QString maybeDemangledName(char *name)
     12+{
     13+    const int len = strlen(name);
     14+    QByteArray in = QByteArray::fromRawData(name, len);
     15+#ifdef Q_OS_MAC
     16+    const int mangledNameStart = in.indexOf(" _"), startOffset = 1;
     17+#elif defined(__FreeBSD__)
     18+    const int mangledNameStart = in.indexOf(" <_"), startOffset = 2;
     19+#elif defined(__sun) && defined(__SVR4)
     20+    const int mangledNameStart = in.indexOf("'"), startOffset = 0;
     21+#else
     22+    const int mangledNameStart = in.indexOf("(_"), startOffset = 1;
     23+#endif
     24+    if (mangledNameStart >= 0) {
     25+        int mangledNameEnd = in.indexOf('+', mangledNameStart + 2);
     26+        // check for and suppress trailing whitespace:
     27+        if (mangledNameEnd > 1 && isspace(name[mangledNameEnd-1])) {
     28+            mangledNameEnd -= 1;
     29+            while (mangledNameEnd > 1 && isspace(name[mangledNameEnd-1])) {
     30+                --mangledNameEnd;
     31+            }
     32+        }
     33+        if (mangledNameEnd >= 0) {
     34+            int status;
     35+            // if we forget about this line and the one that undoes its effect we don't change the
     36+            // internal data of the QByteArray::fromRawData() ;)
     37+            const char endChar = name[mangledNameEnd];
     38+            name[mangledNameEnd] = 0;
     39+            char *demangled = abi::__cxa_demangle(name + mangledNameStart + startOffset, 0, 0, &status);
     40+            name[mangledNameEnd] = endChar;
     41+            if (demangled) {
     42+                QString ret = QString::fromLatin1(name, mangledNameStart + startOffset) +
     43+                              QString::fromLatin1(demangled) +
     44+                              QString::fromLatin1(name + mangledNameEnd, len - mangledNameEnd);
     45+                free(demangled);
     46+                return ret;
     47+            }
     48+        }
     49+    }
     50+    return QString::fromLatin1(name);
     51+}
     52+
     53+QString kRealBacktrace(int levels)
     54+{
     55+    QString s;
     56+    void* trace[256];
     57+    int n = backtrace(trace, 256);
     58+    if (!n)
     59+       return s;
     60+    char** strings = backtrace_symbols (trace, n);
     61+
     62+    if ( levels != -1 )
     63+        n = qMin( n, levels );
     64+    s = QLatin1String("[\n");
     65+
     66+    for (int i = 0; i < n; ++i)
     67+        s += QString::number(i) + QLatin1String(": ") +
     68+             maybeDemangledName(strings[i]) + QLatin1Char('\n');
     69+    s += QLatin1String("]\n");
     70+    if (strings)
     71+        free (strings);
     72+    return s;
     73+}
     74+
     75+
     76 int QObject::startTimer(int interval)
     77 {
     78     Q_D(QObject);
     79 
     80     if (interval < 0) {
     81-        qWarning("QObject::startTimer: QTimer cannot have a negative interval");
     82+        //qWarning("QObject::startTimer: QTimer cannot have a negative interval");
     83+        qWarning() << "QObject::startTimer: QTimer" << this << "cannot have a negative interval" << interval << "pid=" << getpid()
     84+               << kRealBacktrace(-1);
     85         return 0;
     86     }
     87 
  • new file aqua/qt4-mac/files/disable-exceptions.patch

    diff --git a/aqua/qt4-mac/files/disable-exceptions.patch b/aqua/qt4-mac/files/disable-exceptions.patch
    new file mode 100644
    index 0000000..569d6d4
    - +  
     1--- orig.configure      2014-12-09 00:30:18.000000000 +0100
     2+++ configure   2014-12-11 21:38:33.000000000 +0100
     3@@ -7881,15 +7881,15 @@
     4     QT_CONFIG="$QT_CONFIG concurrent"
     5 fi
     6 
     7-if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
     8-    echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
     9-    exit 1
     10-fi
     11-if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
     12+#if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
     13+#    echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
     14+#    exit 1
     15+#fi
     16+#if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
     17     CFG_XMLPATTERNS="$canBuildQtXmlPatterns"
     18-elif [ "$CFG_EXCEPTIONS" = "no" ]; then
     19-    CFG_XMLPATTERNS="no"
     20-fi
     21+#elif [ "$CFG_EXCEPTIONS" = "no" ]; then
     22+#    CFG_XMLPATTERNS="no"
     23+#fi
     24 if [ "$CFG_XMLPATTERNS" = "yes" ]; then
     25     QT_CONFIG="$QT_CONFIG xmlpatterns"
     26 else
     27--- src/xmlpatterns/utils/orig.qpatternistlocale_p.h    2014-04-10 20:37:12.000000000 +0200
     28+++ src/xmlpatterns/utils/qpatternistlocale_p.h 2014-12-11 23:58:30.000000000 +0100
     29@@ -274,7 +274,8 @@
     30 #endif
     31 
     32 #ifdef QT_NO_EXCEPTIONS
     33-#error "Patternist uses exceptions and cannot be built without."
     34+// #error "Patternist uses exceptions and cannot be built without."
     35+#warning "Patternist uses exceptions and will ignore the fact QtCore is built without"
     36 #endif
     37 
     38 QT_END_NAMESPACE
     39--- src/xmlpatterns/orig.xmlpatterns.pro        2014-12-16 13:58:27.000000000 +0100
     40+++ src/xmlpatterns/xmlpatterns.pro     2014-12-16 13:59:46.000000000 +0100
     41@@ -2,8 +2,13 @@
     42 QPRO_PWD = $$PWD
     43 QT = core \
     44     network
     45+DEFINES -= QT_NO_EXCEPTIONS
     46 DEFINES += QT_BUILD_XMLPATTERNS_LIB \
     47-    QT_NO_USING_NAMESPACE
     48+    QT_NO_USING_NAMESPACE QT_EXCEPTIONS
     49+QMAKE_CXXFLAGS_EXCEPTIONS_OFF -= -fno-exceptions
     50+QMAKE_CFLAGS -= -fno-exceptions
     51+QMAKE_CXXFLAGS -= -fno-exceptions
     52+QMAKE_LFLAGS -= -fno-exceptions
     53 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
     54 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore \
     55     QtNetwork
     56--- src/corelib/orig.corelib.pro        2014-12-16 13:46:18.000000000 +0100
     57+++ src/corelib/corelib.pro     2014-12-16 13:47:05.000000000 +0100
     58@@ -1,7 +1,12 @@
     59 TARGET    = QtCore
     60 QPRO_PWD   = $$PWD
     61 QT         =
     62-DEFINES   += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE
     63+DEFINES   -= QT_NO_EXCEPTIONS
     64+DEFINES   += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE QT_EXCEPTIONS
     65+QMAKE_CXXFLAGS_EXCEPTIONS_OFF -= -fno-exceptions
     66+QMAKE_CFLAGS -= -fno-exceptions
     67+QMAKE_CXXFLAGS -= -fno-exceptions
     68+QMAKE_LFLAGS -= -fno-exceptions
     69 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
     70 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
     71 
  • new file aqua/qt4-mac/files/patch-QAction_isEnabled.diff

    diff --git a/aqua/qt4-mac/files/patch-QAction_isEnabled.diff b/aqua/qt4-mac/files/patch-QAction_isEnabled.diff
    new file mode 100644
    index 0000000..6a3b353
    - +  
     1--- src/gui/kernel/orig.qaction.cpp     2015-01-06 02:45:31.000000000 +0100
     2+++ src/gui/kernel/qaction.cpp  2015-01-06 02:32:22.000000000 +0100
     3@@ -1127,7 +1127,7 @@
     4 bool QAction::isEnabled() const
     5 {
     6     Q_D(const QAction);
     7-    return d->enabled;
     8+    return d ? d->enabled : false;
     9 }
     10 
     11 /*!
  • new file aqua/qt4-mac/files/prevent_addTitleRelated_crash.patch

    diff --git a/aqua/qt4-mac/files/prevent_addTitleRelated_crash.patch b/aqua/qt4-mac/files/prevent_addTitleRelated_crash.patch
    new file mode 100644
    index 0000000..168eb3d
    - +  
     1--- src/gui/kernel/orig.qwidget_mac.mm  2014-10-03 15:06:54.000000000 +0200
     2+++ src/gui/kernel/qwidget_mac.mm       2014-10-03 15:08:07.000000000 +0200
     3@@ -4619,7 +4619,7 @@
     4 
     5         setWSGeometry(false, oldRect);
     6 
     7-        if (isResize && QApplicationPrivate::graphicsSystem())
     8+        if (isResize && q->parentWidget() && QApplicationPrivate::graphicsSystem())
     9             invalidateBuffer_resizeHelper(oldp, olds);
     10     }
     11 
  • new file aqua/qt4-mac/files/qconfig-remove-EXCEPTIONS.diff

    diff --git a/aqua/qt4-mac/files/qconfig-remove-EXCEPTIONS.diff b/aqua/qt4-mac/files/qconfig-remove-EXCEPTIONS.diff
    new file mode 100644
    index 0000000..03cce47
    - +  
     1--- QtCore.framework/Headers/orig.qconfig.h     2014-12-16 21:48:09.000000000 +0100
     2+++ QtCore.framework/Headers/qconfig.h  2015-01-01 11:36:10.000000000 +0100
     3@@ -74,12 +74,6 @@
     4 # define QT_NO_EGL
     5 #endif
     6 
     7-#if defined(QT_NO_EXCEPTIONS) && defined(QT_EXCEPTIONS)
     8-# undef QT_NO_EXCEPTIONS
     9-#elif !defined(QT_NO_EXCEPTIONS) && !defined(QT_EXCEPTIONS)
     10-# define QT_NO_EXCEPTIONS
     11-#endif
     12-
     13 #if defined(QT_NO_FREETYPE) && defined(QT_FREETYPE)
     14 # undef QT_NO_FREETYPE
     15 #elif !defined(QT_NO_FREETYPE) && !defined(QT_FREETYPE)
  • new file aqua/qt4-mac/files/qprocess-nozombies.patch

    diff --git a/aqua/qt4-mac/files/qprocess-nozombies.patch b/aqua/qt4-mac/files/qprocess-nozombies.patch
    new file mode 100644
    index 0000000..b91a21f
    - +  
     1--- src/corelib/io/orig.qprocess_unix.cpp       2014-04-10 20:37:11.000000000 +0200
     2+++ src/corelib/io/qprocess_unix.cpp    2014-12-11 17:03:26.000000000 +0100
     3@@ -1296,17 +1296,18 @@
     4     processManager()->remove(q);
     5 }
     6 
     7+//https://codereview.qt-project.org/#/c/61294/
     8 bool QProcessPrivate::waitForDeadChild()
     9 {
     10     Q_Q(QProcess);
     11 
     12     // read a byte from the death pipe
     13     char c;
     14-    qt_safe_read(deathPipe[0], &c, 1);
     15+    qint64 readcount = qt_safe_read(deathPipe[0], &c, 1);
     16 
     17     // check if our process is dead
     18     int exitStatus;
     19-    if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
     20+    if (qt_safe_waitpid(pid_t(pid), &exitStatus, readcount > 0 ? WNOHANG : 0) > 0) {
     21         processManager()->remove(q);
     22         crashed = !WIFEXITED(exitStatus);
     23         exitCode = WEXITSTATUS(exitStatus);
  • new file aqua/qt4-mac/files/qt4-correct-systraymenu-iconhandling.patch

    diff --git a/aqua/qt4-mac/files/qt4-correct-systraymenu-iconhandling.patch b/aqua/qt4-mac/files/qt4-correct-systraymenu-iconhandling.patch
    new file mode 100644
    index 0000000..7996304
    - +  
     1--- src/gui/util/orig.qsystemtrayicon_mac.mm    2014-04-10 20:37:12.000000000 +0200
     2+++ src/gui/util/qsystemtrayicon_mac.mm 2014-09-15 19:48:07.000000000 +0200
     3@@ -341,7 +341,7 @@
     4 -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton
     5 {
     6     down = YES;
     7-    int clickCount = [mouseEvent clickCount]; 
     8+    int clickCount = [mouseEvent clickCount];
     9     [self setNeedsDisplay:YES];
     10 
     11 #ifndef QT_MAC_USE_COCOA
     12@@ -532,7 +532,8 @@
     13             [item setState:action->isChecked() ? NSOnState : NSOffState];
     14             [item setToolTip:(NSString*)QCFString::toCFStringRef(action->toolTip())];
     15             const QIcon icon = action->icon();
     16-            if(!icon.isNull()) {
     17+                 // RJVB 20140915: don't forget to check against isIconVisibleInMenu()!
     18+            if(!icon.isNull() && action->isIconVisibleInMenu()) {
     19 #ifndef QT_MAC_USE_COCOA
     20                 const short scale = GetMBarHeight();
     21 #else
  • new file aqua/qt4-mac/files/qt4-deactivate-menurole-heuristics.patch

    diff --git a/aqua/qt4-mac/files/qt4-deactivate-menurole-heuristics.patch b/aqua/qt4-mac/files/qt4-deactivate-menurole-heuristics.patch
    new file mode 100644
    index 0000000..81cc723
    - +  
     1--- src/gui/widgets/orig.qmenu_mac.mm   2014-04-10 20:37:12.000000000 +0200
     2+++ src/gui/widgets/qmenu_mac.mm        2014-09-16 16:25:00.000000000 +0200
     3@@ -638,7 +638,7 @@
     4 
     5 static NSMenuItem *createNSMenuItem(const QString &title)
     6 {
     7-    NSMenuItem *item = [[NSMenuItem alloc]
     8+    NSMenuItem *item = [[NSMenuItem alloc]
     9                          initWithTitle:qt_mac_QStringToNSString(title)
     10                          action:@selector(qtDispatcherToQAction:) keyEquivalent:@""];
     11     [item setTarget:nil];
     12@@ -852,32 +852,7 @@
     13 #endif
     14         break;
     15     case QAction::TextHeuristicRole: {
     16-        QString aboutString = QMenuBar::tr("About").toLower();
     17-        if (t.startsWith(aboutString) || t.endsWith(aboutString)) {
     18-            if (t.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1) {
     19-#ifndef QT_MAC_USE_COCOA
     20-                ret = kHICommandAbout;
     21-#else
     22-                ret = [loader aboutMenuItem];
     23-#endif
     24-            } else {
     25-#ifndef QT_MAC_USE_COCOA
     26-                ret = kHICommandAboutQt;
     27-#else
     28-                ret = [loader aboutQtMenuItem];
     29-#endif
     30-            }
     31-        } else if (t.startsWith(QMenuBar::tr("Config").toLower())
     32-                   || t.startsWith(QMenuBar::tr("Preference").toLower())
     33-                   || t.startsWith(QMenuBar::tr("Options").toLower())
     34-                   || t.startsWith(QMenuBar::tr("Setting").toLower())
     35-                   || t.startsWith(QMenuBar::tr("Setup").toLower())) {
     36-#ifndef QT_MAC_USE_COCOA
     37-            ret = kHICommandPreferences;
     38-#else
     39-            ret = [loader preferencesMenuItem];
     40-#endif
     41-        } else if (t.startsWith(QMenuBar::tr("Quit").toLower())
     42+          if (t.startsWith(QMenuBar::tr("Quit").toLower())
     43                    || t.startsWith(QMenuBar::tr("Exit").toLower())) {
     44 #ifndef QT_MAC_USE_COCOA
     45             ret = kHICommandQuit;
  • new file aqua/qt4-mac/files/silence-qfilesystemwatcher.patch

    diff --git a/aqua/qt4-mac/files/silence-qfilesystemwatcher.patch b/aqua/qt4-mac/files/silence-qfilesystemwatcher.patch
    new file mode 100644
    index 0000000..171ff8d
    - +  
     1--- src/corelib/io/orig.qfilesystemwatcher.cpp  2014-04-10 20:37:11.000000000 +0200
     2+++ src/corelib/io/qfilesystemwatcher.cpp       2014-12-11 13:33:27.000000000 +0100
     3@@ -544,9 +544,9 @@
     4     if(engine)
     5         p = engine->addPaths(p, &d->files, &d->directories);
     6 
     7-    if (!p.isEmpty())
     8-        qWarning("QFileSystemWatcher: failed to add paths: %s",
     9-                 qPrintable(p.join(QLatin1String(", "))));
     10+//     if (!p.isEmpty())
     11+//         qWarning("QFileSystemWatcher: failed to add paths: %s",
     12+//                  qPrintable(p.join(QLatin1String(", "))));
     13 }
     14 
     15 /*!
  • devel/qca-ossl/Portfile

    diff --git a/devel/qca-ossl/Portfile b/devel/qca-ossl/Portfile
    index 84ad599..240d89e 100644
    a b PortGroup qt4 1.0 
    66
    77name                qca-ossl
    88version             2.0.0-beta3
    9 revision            4
     9revision            5
    1010categories          devel crypto security
    1111license             LGPL-2.1+
    1212maintainers         michaelld openmaintainer
    post-patch { 
    6060
    6161post-destroot {
    6262    # fix library path of installed library/ies
    63     foreach fixfile [exec find ${destroot}${qt_dir} -name "*.dylib" | \
     63    foreach fixfile [exec find ${destroot}${qt_plugins_dir} -name "*.dylib" | \
    6464                         sed -e "s@${destroot}@@g"] {
    6565        system "install_name_tool -id ${fixfile} ${destroot}${fixfile}"
    6666    }
  • devel/qca/Portfile

    diff --git a/devel/qca/Portfile b/devel/qca/Portfile
    index c6a1a32..b6663e1 100644
    a b PortGroup qt4 1.0 
    66
    77name                qca
    88version             2.0.3
    9 revision            1
     9revision            2
    1010set branch          [join [lrange [split ${version} .] 0 1] .]
    1111categories          devel crypto security
    1212maintainers         michaelld openmaintainer
    checksums md5 fc15bd4da22b8096c51fcfe52d2fa309 \ 
    2727                     sha1    9c868b05b81dce172c41b813de4de68554154c60 \
    2828                     rmd160  333cfdce91fedfaec09c205528de52d7b569c521
    2929
     30if {[info exists qt4_is_concurrent]} {
     31    variant libsymlinks description {Allows existing Qt4 applications to function without rebuilding} {}
     32}
     33
    3034# (1) correct pkgconfig file for framework install, if selected.
    3135# (2) allow for 'debug' and 'framework' options at the same time.
    3236#     This change is needed to allow for +debug [+framework] --
    configure.pre_args --prefix=${qt_dir} 
    5963# use variants to change everything except framework
    6064configure.args        --verbose         \
    6165                      --qtdir=${qt_dir} \
     66                      --includedir=${qt_includes_dir} \
    6267                      --release         \
    6368                      --no-framework
    6469
    post-destroot { 
    9095    xinstall -d -m 755 ${destroot}${qt_cmake_module_dir}
    9196    xinstall -m 644 -W ${filespath} FindQCA2.cmake \
    9297        ${destroot}${qt_cmake_module_dir}
     98    if {[info exists qt4_is_concurrent]} {
     99        # is there an official way to test if a port has been installed, qt4-mac-transitional in this case?
     100        if {[file exists ${prefix}/lib/libQtCore.4.dylib]} {
     101            ln -s ${qt_libs_dir}/libqca.2.dylib ${destroot}${prefix}/lib
     102        }
     103        move ${destroot}${qt_libs_dir}/pkgconfig/qca2.pc ${destroot}/${qt_pkg_config_dir}
     104    }
    93105}
    94106
    95107variant debug description \