Ticket #27343: qt4-mac-Portfile.diff

File qt4-mac-Portfile.diff, 3.7 KB (added by michaelld (Michael Dickens), 14 years ago)

"svn diff" of 'qt4-mac' Portile, hopefully allowing the user to set TARGET and SDK

  • Portfile

     
    7474# only; this patch requires that (2) already be in place.
    7575patchfiles-append   patch-mkspecs_common_mac.conf.diff
    7676
     77global TARGET
     78set TARGET ""
     79
    7780post-patch {
    7881    # set ARCHES in configure (per the third patchfile above), for
    7982    # building QMake.  join any 2 or more arch entries with the GCC
     
    9194    # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
    9295    # were all patched in (2) above, and can be easily changed or
    9396    # overridden by the user in a project-local qmake .pro script.
    94     set minor [expr [lindex [split ${os.version} "."] 0] - 4]
    95     set MACOSX_DEPLOYMENT_TARGET "10.${minor}"
     97    # find a way to specify the TARGET to use
     98    set TARGET ""
     99    if {[variant_isset universal]} {
     100        if {[info exists universal_target]} {
     101            set TARGET ${universal_target}
     102            ui_msg "Using 'universal_target' to get TARGET: '${TARGET}'"
     103        }
     104    }
     105    if {${TARGET} == ""} {
     106        if {[info exists macosx_deployment_target]} {
     107            set TARGET ${macosx_deployment_target}
     108            ui_msg "Using 'macosx_deployment_target' to get TARGET: '${TARGET}'"
     109        }
     110    }
     111    # hopefully the TARGET exists and is set by now.
     112    # last resort: use os.version to get target (bad)
     113    if {${TARGET} == ""} {
     114        set minor [expr [lindex [split ${os.version} "."] 0] - 4]
     115        set TARGET "10.${minor}"
     116        ui_msg "Using 'os.version' to get TARGET: '${TARGET}'"
     117    }
     118    ui_msg "TARGET is '${TARGET}'"
    96119    foreach fixfile {configure mkspecs/common/mac-g++.conf \
    97120                     mkspecs/common/mac.conf qmake/qmake.pri \
    98121                     src/tools/bootstrap/bootstrap.pro } {
    99         reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${MACOSX_DEPLOYMENT_TARGET}|g" \
     122        reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
    100123            ${worksrcpath}/${fixfile}
    101124    }
    102125
     
    275298
    276299        # find a way to specify the SDK to use
    277300        set SDK ""
    278         if {[variant_exists universal] && [variant_isset universal]} {
     301        if {[variant_isset universal]} {
    279302            if {[info exists universal_sysroot]} {
    280303                set SDK ${universal_sysroot}
    281             }
     304                ui_msg "Using 'universal_sysroot' for SDK: '${SDK}'"
     305             }
    282306        }
    283307        if {${SDK} == ""} {
    284             # else use the one for this OS version, if installed
    285             set minor [expr [lindex [split ${os.version} "."] 0] - 4]
     308            if {[info exists configure.sdkroot]} {
     309                set SDK ${configure.sdkroot}
     310                ui_msg "Using 'configure.sdkroot' for SDK: '${SDK}'"
     311             }
     312        }
     313        if {${SDK} == ""} {
     314            # find a way to specify the SDK to use, based on the TARGET
     315            # hopefully the TARGET exists and is set by now.
     316            # last resort: use os.version to get target (bad)
     317            set minor ""
     318            global TARGET
     319            if {${TARGET} == ""} {
     320                set minor [expr [lindex [split ${os.version} "."] 0] - 4]
     321            } else {
     322                set minor [lindex [split ${TARGET} "."] 1]
     323            }
     324            ui_msg "minor is '${minor}'"
    286325            # set SDK version depending on OS version
    287326            set sdk_version ""
    288327            if {${minor} == "4"} {
     
    292331                set sdk_version "10.${minor}"
    293332            }
    294333            set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
     334            ui_msg "Using 'os.version' for SDK: '${SDK}'"
    295335        }
    296336        if {[file exists ${SDK}]} {
    297337            configure.args-append -sdk ${SDK}