77set -e
88set -o pipefail
99
10- export LIB_NAME =$1
10+ export CONFIG_NAME =$1
1111export PLAT=$2
12+ export MR_PLAT=$PLAT
1213
1314if [[ -n $3 && " $3 " == ' true' ]]; then
1415 export DRYRUN=1
2425
2526export HOMEBREW_NO_AUTO_UPDATE=1
2627export RELEASE_DATE=$( TZ=UTC-8 date +' %y%m%d%H%M%S' )
27- export RELEASE_VERSION=$( grep GIT_REPO_VERSION= ./configs/libs/${LIB_NAME} .sh | tail -n 1 | awk -F = ' {printf "%s",$2}' )
28- export REPO_DIR=$( grep REPO_DIR= ./configs/libs/${LIB_NAME} .sh | tail -n 1 | awk -F = ' {printf "%s",$2}' | tr -d " '\" " )
28+
29+ source ./configs/libs/${CONFIG_NAME} .sh
30+ export RELEASE_VERSION=$GIT_REPO_VERSION
2931export TAG=${LIB_NAME} -${RELEASE_VERSION} -${RELEASE_DATE}
30- export TITLE=" 👏👏${LIB_NAME} -${PLAT} -${RELEASE_VERSION} "
32+
33+ export TITLE=" 👏👏${CONFIG_NAME} -${PLAT} -${RELEASE_VERSION} "
3134
3235ROOT_DIR=$PWD
3336DIST_DIR=$ROOT_DIR /build/dist
@@ -37,7 +40,7 @@ function init_platform
3740{
3841 local plat=$1
3942 echo " ---init $plat src--------------------------------------"
40- ./main.sh init -p $plat -l ${LIB_NAME }
43+ ./main.sh init -p $plat -l ${CONFIG_NAME }
4144
4245 echo " ---generate src log--------------------------------------"
4346 cd build/src/$plat
@@ -52,9 +55,9 @@ function compile_ios_platform
5255 local log_file=" $DIST_DIR /ios-compile-log-$RELEASE_VERSION .md"
5356
5457 if [[ $VERBOSE ]]; then
55- ./main.sh compile -p ios -c build -l ${LIB_NAME } 2>&1 | tee -a " $log_file "
58+ ./main.sh compile -p ios -c build -l ${CONFIG_NAME } 2>&1 | tee -a " $log_file "
5659 else
57- ./main.sh compile -p ios -c build -l ${LIB_NAME } >> " $log_file " 2>&1
60+ ./main.sh compile -p ios -c build -l ${CONFIG_NAME } >> " $log_file " 2>&1
5861 fi
5962
6063 cd build/product/ios/universal
@@ -74,41 +77,36 @@ function compile_macos_platform
7477 local extra_args=" "
7578
7679 if [[ $VERBOSE ]]; then
77- ./main.sh compile -p macos -c build -l ${LIB_NAME } $extra_args 2>&1 | tee -a " $log_file "
80+ ./main.sh compile -p macos -c build -l ${CONFIG_NAME } $extra_args 2>&1 | tee -a " $log_file "
7881 else
79- ./main.sh compile -p macos -c build -l ${LIB_NAME } $extra_args >> " $log_file " 2>&1
82+ ./main.sh compile -p macos -c build -l ${CONFIG_NAME } $extra_args >> " $log_file " 2>&1
8083 fi
8184
82- # Copy the architecture-specific binaries to universal/bin before zipping if they were compiled
83- if [[ " $REPO_DIR " == " ffmpeg8 " ]]; then
84- mkdir -p build/product/macos/universal/bin
85+ # Copy the architecture-specific binaries if they were compiled
86+ if [[ " $ENABLE_BIN " == " 1 " ]]; then
87+ mkdir -p build/product/macos/universal/${LIB_NAME} / bin
8588 for arch in arm64 x86_64; do
86- for bin in ffmpeg ffplay ffprobe; do
87- local bin_file=" build/product/macos/${LIB_NAME} -${arch} /bin/$bin "
88- if [ -f " $bin_file " ]; then
89- cp " $bin_file " " build/product/macos/universal/bin/$bin -macos-${arch} "
90- echo " Copied $bin_file to build/product/macos/universal/bin/$bin -macos-${arch} "
91- fi
92- done
89+ local bin_dir=" build/product/macos/${LIB_NAME} -${arch} /bin"
90+ if [ -d " $bin_dir " ]; then
91+ for bin_path in " $bin_dir " /* ; do
92+ if [ -f " $bin_path " ]; then
93+ local bin=$( basename " $bin_path " )
94+ # 1. Copy to universal folder before zipping
95+ cp " $bin_path " " build/product/macos/universal/${LIB_NAME} /bin/$bin -macos-${arch} "
96+ echo " Copied $bin_path to build/product/macos/universal/${LIB_NAME} /bin/$bin -macos-${arch} "
97+
98+ # 2. Copy to release assets directory
99+ cp " $bin_path " " $DIST_DIR /$bin -macos-${arch} "
100+ echo " Copied $bin_path to $DIST_DIR /$bin -macos-${arch} "
101+ fi
102+ done
103+ fi
93104 done
94105 fi
95106
96107 cd build/product/macos/universal
97108 zip -ryq $DIST_DIR /${LIB_NAME} -macos-universal-${RELEASE_VERSION} .zip ./*
98109 cd $ROOT_DIR
99-
100- # Copy the architecture-specific binaries to release assets if they were compiled
101- if [[ " $REPO_DIR " == " ffmpeg8" ]]; then
102- for arch in arm64 x86_64; do
103- for bin in ffmpeg ffplay ffprobe; do
104- local bin_file=" build/product/macos/${LIB_NAME} -${arch} /bin/$bin "
105- if [ -f " $bin_file " ]; then
106- cp " $bin_file " " $DIST_DIR /$bin -macos-${arch} "
107- echo " Copied $bin_file to $DIST_DIR /$bin -macos-${arch} "
108- fi
109- done
110- done
111- fi
112110}
113111
114112function compile_tvos_platform
@@ -118,9 +116,9 @@ function compile_tvos_platform
118116 local log_file=" $DIST_DIR /android-compile-log-$RELEASE_VERSION .md"
119117
120118 if [[ $VERBOSE ]]; then
121- ./main.sh compile -p tvos -c build -l ${LIB_NAME } 2>&1 | tee -a " $log_file "
119+ ./main.sh compile -p tvos -c build -l ${CONFIG_NAME } 2>&1 | tee -a " $log_file "
122120 else
123- ./main.sh compile -p tvos -c build -l ${LIB_NAME } >> " $log_file " 2>&1
121+ ./main.sh compile -p tvos -c build -l ${CONFIG_NAME } >> " $log_file " 2>&1
124122 fi
125123
126124 cd build/product/tvos/universal
@@ -137,11 +135,11 @@ function compile_android_platform
137135 echo " ---do compile android libs--------------------------------------"
138136
139137 local log_file=" $DIST_DIR /android-compile-log-$RELEASE_VERSION .md"
140-
138+
141139 if [[ $VERBOSE ]]; then
142- ./main.sh compile -p android -c build -l ${LIB_NAME } 2>&1 | tee -a " $log_file "
140+ ./main.sh compile -p android -c build -l ${CONFIG_NAME } 2>&1 | tee -a " $log_file "
143141 else
144- ./main.sh compile -p android -c build -l ${LIB_NAME } >> " $log_file " 2>&1
142+ ./main.sh compile -p android -c build -l ${CONFIG_NAME } >> " $log_file " 2>&1
145143 fi
146144
147145 cd build/product/android/universal
@@ -176,7 +174,7 @@ function replace_tag()
176174
177175function upgrade()
178176{
179- local file=" configs/libs/${LIB_NAME } .sh"
177+ local file=" configs/libs/${CONFIG_NAME } .sh"
180178 case $PLAT in
181179 ios)
182180 replace_tag $file PRE_COMPILE_TAG_IOS
@@ -204,7 +202,7 @@ function upgrade()
204202 esac
205203
206204 git add $file
207- git commit -m " upgrade $LIB_NAME to $TAG for $PLAT by cd"
205+ git commit -m " upgrade $CONFIG_NAME to $TAG for $PLAT by cd"
208206 git pull --rebase
209207 git push origin
210208}
@@ -273,9 +271,4 @@ function main()
273271 esac
274272}
275273
276- if [[ $LIB_NAME == ' test' ]]; then
277- echo " test" > $DIST_DIR /test.md
278- publish
279- else
280- main
281- fi
274+ main
0 commit comments