#!/bin/bash # Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -eu # TODO: Remove this once all build environments are setting SDKROOT for us. global WRAPPER_SDKROOT := $(SDKROOT:-) if [[ -z "${WRAPPER_SDKROOT:-}" ]] { global WRAPPER_SDK := 'iphonesimulator' for ARG in [@Argv] { matchstr $(ARG) { armv6|armv7|armv7s|arm64 { global WRAPPER_SDK := 'iphoneos' } i386|x86_64 { global WRAPPER_SDK := 'iphonesimulator' } } } global WRAPPER_SDKROOT := $[/usr/bin/xcrun --show-sdk-path --sdk $(WRAPPER_SDK)] } echo $(WRAPPER_SDKROOT) (CommandList children: [ (C {(set)} {(-eu)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WRAPPER_SDKROOT) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [54 57] ) ) } spids: [52] ) ] spids: [52] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [67 70] ) ) } ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WRAPPER_SDK) op: Equal rhs: {(iphonesimulator)} spids: [80] ) ] spids: [80] ) (ForEach iter_name: ARG iter_words: [{(DQ ($ VSub_At "$@"))}] do_arg_iter: False body: (DoGroup children: [ (Case to_match: {(DQ (${ VSub_Name ARG))} arms: [ (case_arm pat_list: [{(armv6)} {(armv7)} {(armv7s)} {(arm64)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WRAPPER_SDK) op: Equal rhs: {(iphoneos)} spids: [120] ) ] spids: [120] ) ] spids: [110 117 124 -1] ) (case_arm pat_list: [{(i386)} {(x86_64)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WRAPPER_SDK) op: Equal rhs: {(iphonesimulator)} spids: [133] ) ] spids: [133] ) ] spids: [127 130 137 -1] ) ] spids: [99 107 140] ) ] spids: [96 143] ) spids: [89 94] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WRAPPER_SDKROOT) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(/usr/bin/xcrun)} {(--show-sdk-path)} {(--sdk)} {(${ VSub_Name WRAPPER_SDK)} ) ] ) left_token: spids: [148 158] ) ) } spids: [146] ) ] spids: [146] ) ] spids: [-1 77] ) ] spids: [-1 161] ) (C {(echo)} {(DQ (${ VSub_Name WRAPPER_SDKROOT))}) ] )