@@ -34,10 +34,10 @@ echo "===check env end==="
3434PLAT=$2
3535ARCH=$3
3636
37- if [[ " $ARCH " == ' all' || " x$ARCH " == ' x' ]]; then
37+ if [[ " $ARCH " == ' all' || " x$ARCH " == ' x' ]]; then
3838 iOS_ARCHS=" x86_64 arm64"
3939 macOS_ARCHS=" x86_64 arm64"
40- elif [[ " $ARCH " == ' x86_64' || " $ARCH " == ' arm64' ]]; then
40+ elif [[ " $ARCH " == ' x86_64' || " $ARCH " == ' arm64' ]]; then
4141 iOS_ARCHS=" $ARCH "
4242 macOS_ARCHS=" $ARCH "
4343else
4747
4848function pull_common() {
4949 echo " == pull $REPO_DIR base =="
50- if [[ -d " $GIT_LOCAL_REPO " ]]; then
50+ if [[ -d " $GIT_LOCAL_REPO " ]]; then
5151 cd " $GIT_LOCAL_REPO "
5252 [[ -d .git/rebase-apply ]] && git am --skip
5353 git reset --hard
54-
54+
5555 local origin=$( git remote get-url origin)
5656 if [[ " $origin " != " $GIT_UPSTREAM " ]]; then
5757 git remote remove origin
5858 git remote add origin " $GIT_UPSTREAM "
5959 echo " force update origin to: $GIT_UPSTREAM "
6060 fi
61- if [[ " $SKIP_PULL_BASE " ]]; then
61+ if [[ " $SKIP_PULL_BASE " ]]; then
6262 echo " skip pull $REPO_DIR because you set SKIP_PULL_BASE env."
6363 else
6464 git fetch --all --tags
6565 fi
6666 else
67- if [[ " $SKIP_PULL_BASE " ]]; then
67+ if [[ " $SKIP_PULL_BASE " ]]; then
6868 echo " == local repo $REPO_DIR not exist,must clone by net firstly. =="
6969 echo " try:unset SKIP_PULL_BASE"
7070 exit -1
@@ -73,29 +73,28 @@ function pull_common() {
7373 cd " $GIT_LOCAL_REPO "
7474 fi
7575 fi
76-
76+
7777 # fix fatal: 'stable' is not a commit and a branch 'localBranch' cannot be created from it
78- git checkout ${GIT_COMMIT} -B localBranch
79- cd - > /dev/null
78+ git checkout ${GIT_COMMIT} -B localBranch
79+ cd - > /dev/null
8080}
8181
82- function apply_patches()
83- {
84- if [[ " $SKIP_FFMPEG_PATHCHES " && $REPO_DIR == ' ffmpeg' ]]; then
82+ function apply_patches() {
83+ if [[ " $SKIP_FFMPEG_PATHCHES " && $REPO_DIR == ' ffmpeg' ]]; then
8584 echo " skip apply $REPO_DIR patches,because you set SKIP_FFMPEG_PATHCHES env."
86- return
85+ return
8786 fi
8887
8988 local plat=" $1 "
9089 local patch_dir=" ${TOOLS} /../extra/patches/$REPO_DIR "
9190
92- if [[ -d " ${patch_dir} _${plat} " ]]; then
91+ if [[ -d " ${patch_dir} _${plat} " ]]; then
9392 patch_dir=" ${patch_dir} _${plat} "
9493 fi
95- if [[ -d " $patch_dir " ]]; then
94+ if [[ -d " $patch_dir " ]]; then
9695 echo
9796 echo " == Applying patches: $( basename $patch_dir ) → $( basename $PWD ) =="
98- git am $patch_dir /* .patch
97+ git am --keep $patch_dir /* .patch
9998 if [[ $? -ne 0 ]]; then
10099 echo ' Apply patches failed!'
101100 git am --skip
@@ -110,12 +109,16 @@ function make_arch_repo() {
110109 echo " == copy $REPO_DIR → $dest_repo =="
111110 $TOOLS /copy-local-repo.sh $GIT_LOCAL_REPO $dest_repo
112111 cd $dest_repo
113- if [[ " $GIT_WITH_SUBMODULE " ]]; then
112+ if [[ " $GIT_WITH_SUBMODULE " ]]; then
114113 git submodule update --init --depth=1
115114 fi
116115 echo " last commit:" $( git log -1 --pretty=format:" [%h] %s:%ce %cd" )
116+ if [[ -n " $IJK_VERSION " ]]; then
117+ git tag " ff${GIT_COMMIT##*/ } -ijk$IJK_VERSION "
118+ fi
117119 apply_patches $1
118- cd - > /dev/null
120+ echo " tag:$( git describe --tags) "
121+ cd - > /dev/null
119122}
120123
121124function usage() {
@@ -125,55 +128,51 @@ function usage() {
125128
126129function main() {
127130 case " $1 " in
128- iOS|ios)
129- pull_common
130- found=0
131- for arch in $iOS_ARCHS
132- do
133- if [[ " $2 " == " $arch " || " x$2 " == " x" || " $2 " == " all" ]]; then
134- found=1
135- make_arch_repo ' ios' $arch
136- fi
137- done
138-
139- if [[ found -eq 0 ]]; then
140- echo " unknown arch:$2 for $1 "
131+ iOS | ios)
132+ pull_common
133+ found=0
134+ for arch in $iOS_ARCHS ; do
135+ if [[ " $2 " == " $arch " || " x$2 " == " x" || " $2 " == " all" ]]; then
136+ found=1
137+ make_arch_repo ' ios' $arch
141138 fi
139+ done
140+
141+ if [[ found -eq 0 ]]; then
142+ echo " unknown arch:$2 for $1 "
143+ fi
142144 ;;
143-
144- macOS|macos)
145-
146- pull_common
147- found=0
148- for arch in $macOS_ARCHS
149- do
150- if [[ " $2 " == " $arch " || " x$2 " == " x" || " $2 " == " all" ]]; then
151- found=1
152- make_arch_repo ' macos' $arch
153- fi
154- done
155-
156- if [[ found -eq 0 ]]; then
157- echo " unknown arch:$2 for $1 "
145+
146+ macOS | macos)
147+
148+ pull_common
149+ found=0
150+ for arch in $macOS_ARCHS ; do
151+ if [[ " $2 " == " $arch " || " x$2 " == " x" || " $2 " == " all" ]]; then
152+ found=1
153+ make_arch_repo ' macos' $arch
158154 fi
155+ done
156+
157+ if [[ found -eq 0 ]]; then
158+ echo " unknown arch:$2 for $1 "
159+ fi
159160 ;;
160-
161- all)
162- pull_common
163- for arch in $iOS_ARCHS
164- do
165- make_arch_repo ' ios' $arch
166- done
167-
168- for arch in $macOS_ARCHS
169- do
170- make_arch_repo ' macos' $arch
171- done
161+
162+ all)
163+ pull_common
164+ for arch in $iOS_ARCHS ; do
165+ make_arch_repo ' ios' $arch
166+ done
167+
168+ for arch in $macOS_ARCHS ; do
169+ make_arch_repo ' macos' $arch
170+ done
172171 ;;
173-
174- * )
175- usage
176- exit 1
172+
173+ * )
174+ usage
175+ exit 1
177176 ;;
178177 esac
179178}
0 commit comments