Ignore:
Timestamp:
Mar 9, 2015, 5:42:13 AM (4 years ago)
Author:
ryandesign@…
Message:

xcode-1.0.tcl: support schemes; use eq/ne for string comparisons instead of ==/!=; use curly braces for some variables that weren't using them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/xcode-1.0.tcl

    r121266 r133698  
    5858#   xcode.configuration      xcode buildstyle/configuration. Default is Deployment.
    5959#   xcode.target             if present, overrides build.target and destroot.target
     60#   xcode.scheme             if present, supersedes target
    6061#   xcode.build.settings     additional settings passed to $xcodebuildcmd (in
    6162#                            the X=Y form)
     
    102103options xcode.target
    103104default xcode.target ""
     105options xcode.scheme
     106default xcode.scheme ""
    104107options xcode.configuration
    105108default xcode.configuration Deployment
     
    119122proc xcode::get_project_path {} {
    120123    global xcode.project worksrcpath
    121     if {${xcode.project} == ""} {
     124    if {${xcode.project} eq ""} {
    122125        set suffix ""
    123126    } else {
     
    147150proc xcode::get_configuration_arg { style } {
    148151    global xcodeversion
    149     if {$style != ""} {
    150         if {[vercmp $xcodeversion 2.1] >= 0} {
    151             return "-configuration $style"
    152         } else {
    153             return "-buildstyle $style"
     152    if {${style} ne ""} {
     153        if {[vercmp ${xcodeversion} 2.1] >= 0} {
     154            return "-configuration ${style}"
     155        } else {
     156            return "-buildstyle ${style}"
    154157        }
    155158    } else {
     
    160163# get the project argument.
    161164proc xcode::get_project_arg { project } {
    162     if {$project != ""} {
    163         return "-project \"[join $project]\""
     165    if {${project} ne ""} {
     166        return "-project \"[join ${project}]\""
    164167    } else {
    165168        return ""
     
    171174proc xcode::get_install_path_setting { path type } {
    172175    global applications_dir frameworks_dir
    173     if {$path == ""} {
    174         if {$type == "application"} {
     176    if {${path} eq ""} {
     177        if {${type} eq "application"} {
    175178            return "INSTALL_PATH=${applications_dir}"
    176         } elseif {$type == "framework"} {
     179        } elseif {${type} eq "framework"} {
    177180            return "INSTALL_PATH=${frameworks_dir}"
    178181        } else {
     
    190193
    191194    # Check that xcode is installed.
    192     if {[set ${command}.cmd] == "none"} {
     195    if {[set ${command}.cmd] eq "none"} {
    193196        return -code error "This port requires 'xcodebuild', which \
    194197    couldn't be found (not Mac OS X?)"
     
    252255    set xcode_build_args "OBJROOT=build/ SYMROOT=build/"
    253256
    254     # MACOSX_DEPLOYMENT_TARGET
    255257    append xcode_build_args " MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}"
    256258
     
    283285}
    284286
    285 # build procedure.
    286287build {
    287     # determine the targets.
    288     if {${xcode.target} != ""} {
    289         set xcode_targets ${xcode.target}
    290     } else {
    291         set xcode_targets ${build.target}
    292     }
    293 
    294     # set some arguments.
    295288    set xcode_configuration_arg [xcode::get_configuration_arg ${xcode.configuration}]
    296289    set xcode_project_arg [xcode::get_project_arg ${xcode.project}]
    297290    set xcode_build_args [xcode::get_build_args]
    298291
    299     # iterate on targets if there is any, do -alltargets otherwise.
    300     if {"$xcode_targets" == ""} {
     292    if {${xcode.scheme} ne ""} {
    301293        xcode::build_one_target \
    302             "$xcode_project_arg -alltargets $xcode_configuration_arg" \
    303             "$xcode_build_args ${xcode.build.settings}"
    304     } else {
    305         foreach target $xcode_targets {
     294            "${xcode_project_arg} -scheme \"${xcode.scheme}\" ${xcode_configuration_arg}" \
     295            "${xcode_build_args} ${xcode.build.settings}"
     296    } else {
     297        if {${xcode.target} ne ""} {
     298            set xcode_targets ${xcode.target}
     299        } else {
     300            set xcode_targets ${build.target}
     301        }
     302        if {${xcode_targets} eq ""} {
    306303            xcode::build_one_target \
    307                 "$xcode_project_arg -target \"$target\" $xcode_configuration_arg" \
    308                 "$xcode_build_args ${xcode.build.settings}"
    309         }
    310     }
    311 }
    312 
    313 # destroot procedure.
     304                "${xcode_project_arg} -alltargets ${xcode_configuration_arg}" \
     305                "${xcode_build_args} ${xcode.build.settings}"
     306        } else {
     307            foreach target ${xcode_targets} {
     308                xcode::build_one_target \
     309                    "${xcode_project_arg} -target \"${target}\" ${xcode_configuration_arg}" \
     310                    "${xcode_build_args} ${xcode.build.settings}"
     311            }
     312        }
     313    }
     314}
     315
    314316destroot {
    315317    # let Xcode 2.1+ find resources.
    316318    xcode::fix_resource_dependencies
    317319
    318     # determine the targets.
    319     if {${xcode.target} != ""} {
    320         set xcode_targets ${xcode.target}
    321     } else {
    322         set xcode_targets ${destroot.target}
    323     }
    324 
    325     # set some arguments.
    326320    set xcode_configuration_arg [xcode::get_configuration_arg ${xcode.configuration}]
    327321    set xcode_project_arg [xcode::get_project_arg ${xcode.project}]
     
    330324    set xcode_build_args [xcode::get_build_args]
    331325
    332     # iterate on targets if there is any, do -alltargets otherwise.
    333     if {"$xcode_targets" == ""} {
     326    if {${xcode.scheme} ne ""} {
    334327        xcode::destroot_one_target \
    335             "$xcode_project_arg -alltargets $xcode_configuration_arg" \
    336             "$xcode_install_path_setting $xcode_build_args ${xcode.destroot.settings}"
    337     } else {
    338         foreach target $xcode_targets {
     328            "${xcode_project_arg} -scheme \"${xcode.scheme}\" ${xcode_configuration_arg}" \
     329            "${xcode_install_path_setting} ${xcode_build_args} ${xcode.destroot.settings}"
     330    } else {
     331        if {${xcode.target} ne ""} {
     332            set xcode_targets ${xcode.target}
     333        } else {
     334            set xcode_targets ${destroot.target}
     335        }
     336        if {${xcode_targets} eq ""} {
    339337            xcode::destroot_one_target \
    340                 "$xcode_project_arg -target \"$target\" $xcode_configuration_arg" \
    341                 "$xcode_install_path_setting $xcode_build_args ${xcode.destroot.settings}"
    342         }
    343     }
    344 }
     338                "${xcode_project_arg} -alltargets ${xcode_configuration_arg}" \
     339                "${xcode_install_path_setting} ${xcode_build_args} ${xcode.destroot.settings}"
     340        } else {
     341            foreach target ${xcode_targets} {
     342                xcode::destroot_one_target \
     343                    "${xcode_project_arg} -target \"${target}\" ${xcode_configuration_arg}" \
     344                    "${xcode_install_path_setting} ${xcode_build_args} ${xcode.destroot.settings}"
     345            }
     346        }
     347    }
     348}
Note: See TracChangeset for help on using the changeset viewer.