Skip to content

Commit f0ac638

Browse files
committed
init any arch use _simulator
1 parent 3e4cf43 commit f0ac638

3 files changed

Lines changed: 54 additions & 70 deletions

File tree

apple/init-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function init_arch_env () {
115115

116116
if [[ "$XC_PLAT" == 'ios' ]]; then
117117
case $_XC_ARCH in
118-
'x86_64' | x86_64_simulator)
118+
'x86_64_simulator')
119119
export XCRUN_PLATFORM='iPhoneSimulator'
120120
export XC_DEPLOYMENT_TARGET='-mios-simulator-version-min=11.0'
121121
export XC_IS_SIMULATOR=1

install-pre-any.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ FFMPEG_TAG='ffmpeg-5.1.4-240529153208'
3939

4040
set -e
4141

42-
PLAT=$1
42+
PLAT=`echo $1 | tr '[:upper:]' '[:lower:]'`
4343
LIBS=$2
4444

4545
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)

tools/init-repo.sh

Lines changed: 52 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,60 @@ set -e
2020

2121
source $1
2222

23+
iOS_ARCHS="arm64 x86_64_simulator"
24+
macOS_ARCHS="x86_64 arm64"
25+
tvOS_ARCHS="arm64 arm64_simulator"
26+
2327
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2428
source ${THIS_DIR}/env_assert.sh
2529

30+
PLAT=`echo $2 | tr '[:upper:]' '[:lower:]'`
31+
ARCH=$3
32+
33+
if [[ "$ARCH" == 'all' ]]; then
34+
ARCH=
35+
fi
36+
2637
echo "===check env begin==="
27-
echo "argv:[$*]"
28-
env_assert "GIT_UPSTREAM"
29-
env_assert "GIT_LOCAL_REPO"
30-
env_assert "GIT_COMMIT"
3138
env_assert "REPO_DIR"
39+
env_assert "GIT_COMMIT"
40+
env_assert "GIT_LOCAL_REPO"
41+
env_assert "GIT_UPSTREAM"
3242
echo "===check env end==="
3343

34-
PLAT=$2
35-
ARCH=$3
3644

37-
if [[ "$ARCH" == 'all' || "x$ARCH" == 'x' ]]; then
38-
iOS_ARCHS="x86_64 arm64"
39-
macOS_ARCHS="x86_64 arm64"
40-
tvOS_ARCHS="arm64 arm64_simulator"
41-
elif [[ "$ARCH" == 'x86_64' ]]; then
42-
iOS_ARCHS="$ARCH"
43-
macOS_ARCHS="$ARCH"
44-
elif [["$ARCH" == 'arm64' ]]; then
45-
iOS_ARCHS="$ARCH"
46-
macOS_ARCHS="$ARCH"
47-
tvOS_ARCHS="$ARCH"
48-
elif [["$ARCH" == 'arm64_simulator' ]]; then
49-
tvOS_ARCHS="$ARCH"
50-
else
51-
echo "wrong arch:[$ARCH], can't init repo."
52-
exit -1
53-
fi
45+
function init_arch_for_plat()
46+
{
47+
if [[ "$PLAT" == 'ios' ]]; then
48+
ALL_ARCHS="$iOS_ARCHS"
49+
elif [[ "$PLAT" == 'macos' ]]; then
50+
ALL_ARCHS="$macOS_ARCHS"
51+
elif [[ "$PLAT" == 'tvos' ]]; then
52+
ALL_ARCHS="$tvOS_ARCHS"
53+
else
54+
echo "wrong plat:$PLAT"
55+
exit 1
56+
fi
57+
58+
if [[ ! -z "$ARCH" ]];then
59+
60+
for arch in $ARCH
61+
do
62+
validate=0
63+
for arch2 in $ALL_ARCHS
64+
do
65+
if [[ $arch == $arch2 ]];then
66+
validate=1
67+
fi
68+
done
69+
if [[ $validate -eq 0 ]];then
70+
echo "the $arch is not validate on ${PLAT},you can use [$ALL_ARCHS]"
71+
exit 1
72+
fi
73+
done
74+
ALL_ARCHS="$ARCH"
75+
fi
76+
}
5477

5578
function pull_common() {
5679
echo "== pull $REPO_DIR base =="
@@ -135,53 +158,14 @@ function usage() {
135158
}
136159

137160
function main() {
138-
case "$1" in
139-
iOS | ios)
161+
case "$PLAT" in
162+
ios | macos | tvos)
163+
init_arch_for_plat
140164
pull_common
141-
found=0
142-
for arch in $iOS_ARCHS; do
143-
if [[ "$2" == "$arch" || "x$2" == "x" || "$2" == "all" ]]; then
144-
found=1
145-
make_arch_repo 'ios' $arch
146-
fi
147-
done
148-
149-
if [[ found -eq 0 ]]; then
150-
echo "unknown arch:$2 for $1"
151-
fi
152-
;;
153-
154-
macOS | macos)
155-
156-
pull_common
157-
found=0
158-
for arch in $macOS_ARCHS; do
159-
if [[ "$2" == "$arch" || "x$2" == "x" || "$2" == "all" ]]; then
160-
found=1
161-
make_arch_repo 'macos' $arch
162-
fi
163-
done
164-
165-
if [[ found -eq 0 ]]; then
166-
echo "unknown arch:$2 for $1"
167-
fi
168-
;;
169-
170-
tvOS | tvos)
171-
pull_common
172-
found=0
173-
for arch in $tvOS_ARCHS; do
174-
if [[ "$2" == "$arch" || "x$2" == "x" || "$2" == "all" ]]; then
175-
found=1
176-
make_arch_repo 'tvos' $arch
177-
fi
165+
for arch in $ALL_ARCHS; do
166+
make_arch_repo 'ios' $arch
178167
done
179-
180-
if [[ found -eq 0 ]]; then
181-
echo "unknown arch:$2 for $1"
182-
fi
183168
;;
184-
185169
all)
186170
pull_common
187171
for arch in $iOS_ARCHS; do
@@ -204,4 +188,4 @@ function main() {
204188
esac
205189
}
206190

207-
main $PLAT $ARCH
191+
main

0 commit comments

Comments
 (0)