Skip to content

Commit b9f72b0

Browse files
committed
update install pre lib shell
1 parent 69e9dac commit b9f72b0

File tree

2 files changed

+46
-30
lines changed

2 files changed

+46
-30
lines changed

install-pre-any.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DAV1D_TAG='dav1d-1.3.0-231127183948'
3030
OPENSSL_TAG='openssl-1.1.1w-231127183927'
3131
DVDREAD_TAG='dvdread-6.1.3-240108102425'
3232
FREETYPE_TAG='freetype-2.13.2-240320173506'
33-
UNIBREAK_TAG='unibreak-5.1-240604135117'
33+
UNIBREAK_TAG='unibreak-5.1-240604145913'
3434
FRIBIDI_TAG='fribidi-1.0.13-240320172504'
3535
HARFBUZZ_TAG='harfbuzz-8.3.0-240320182151'
3636
ASS_TAG='ass-0.17.1-240320183602'

tools/install-pre-lib.sh

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,61 +30,77 @@ function usage() {
3030
echo "$0 [ios|macos|all] [<release tag>]"
3131
}
3232

33-
function download() {
33+
function download_arch() {
3434
local plat=$1
35-
36-
local oname="build/pre/${TAG}-$plat.zip"
37-
if [[ -f "$oname" ]];then
38-
echo "$oname already exist,no need download."
35+
local join=$2
36+
37+
if [[ "$join" ]];then
38+
join="-$join"
39+
else
40+
join=""
41+
fi
42+
43+
JOIN="$join"
44+
ONAME="build/pre/${TAG}-${plat}${join}.zip"
45+
if [[ -f "$ONAME" ]];then
46+
echo "$ONAME already exist,no need download."
3947
return
4048
fi
4149

42-
local fname="$LIB_NAME-$plat-universal-$VER.zip"
50+
local fname="$LIB_NAME-$plat-universal${join}-$VER.zip"
4351
local url="https://github.com/debugly/MRFFToolChainBuildShell/releases/download/$TAG/$fname"
4452

4553
echo "---[download $fname]-----------------"
4654
echo "$url"
4755
mkdir -p build/pre
48-
local tname="build/pre/${TAG}.tmp"
56+
local tname="build/pre/${TAG}${join}.tmp"
4957
curl -L "$url" -o "$tname"
5058
if [[ $? -eq 0 ]];then
51-
mv "$tname" "$oname"
59+
mv "$tname" "$ONAME"
5260
fi
5361
}
5462

5563
function extract(){
5664
local plat=$1
57-
local oname="build/pre/${TAG}-$plat.zip"
58-
59-
if [[ -f "$oname" ]];then
60-
mkdir -p build/product/$plat/universal
61-
unzip -oq "$oname" -d build/product/$plat/universal
65+
if [[ -f "$ONAME" ]];then
66+
PRODUCT_DIR="build/product/$plat/universal${JOIN}"
67+
mkdir -p "$PRODUCT_DIR"
68+
unzip -oq "$ONAME" -d "$PRODUCT_DIR"
6269
echo "extract zip file"
6370
if command -v tree >/dev/null 2>&1; then
64-
tree -L 2 build/product/$plat/universal
71+
tree -L 2 "$PRODUCT_DIR"
6572
fi
6673
else
67-
echo "you need download ${oname} firstly."
74+
echo "you need download ${ONAME} firstly."
6875
exit 1
6976
fi
7077
}
7178

7279
function fix_prefix(){
7380
local plat=$1
74-
local UNI_PC_DIR="build/product/$plat/universal/$LIB_NAME/lib/pkgconfig"
75-
76-
if ls ${UNI_PC_DIR}/*.pc >/dev/null 2>&1;then
77-
echo "fix $plat $LIB_NAME pc file prefix"
78-
p=$(cd "build/product/$plat/universal/$LIB_NAME";pwd)
79-
escaped_p=$(echo $p | sed 's/\//\\\//g')
80-
sed -i "" "s/^prefix=.*/prefix=$escaped_p/" "$UNI_PC_DIR/"*.pc
81+
local pc_dir="$PRODUCT_DIR/$LIB_NAME/lib/pkgconfig"
82+
if [[ -d "$pc_dir" ]];then
83+
if ls ${pc_dir}/*.pc >/dev/null 2>&1;then
84+
echo "fix $plat $LIB_NAME pc file prefix"
85+
p=$(cd "$PRODUCT_DIR/$LIB_NAME";pwd)
86+
escaped_p=$(echo $p | sed 's/\//\\\//g')
87+
sed -i "" "s/^prefix=.*/prefix=$escaped_p/" "$pc_dir/"*.pc
88+
fi
8189
fi
8290
}
8391

84-
function install(){
85-
download "$*"
86-
extract "$*"
87-
fix_prefix "$*"
92+
function install() {
93+
local plat=$1
94+
if [[ "$plat" == 'ios' || "$plat" == 'tvos' ]];then
95+
download_arch "$plat"
96+
extract "$plat"
97+
fix_prefix "$plat"
98+
download_arch "$plat" "simulator"
99+
extract "$plat"
100+
fix_prefix "$plat"
101+
else
102+
download_arch "$plat"
103+
fi
88104
}
89105

90106
if [[ "$PLAT" != 'ios' && "$PLAT" != 'macos' && "$PLAT" != 'all' ]]; then
@@ -103,10 +119,10 @@ fi
103119
LIB_NAME=$(echo $TAG | awk -F - '{print $1}')
104120
VER=$(echo $TAG | awk -F - '{print $2}')
105121

106-
if [[ "$PLAT" == 'ios' || "$PLAT" == 'macos' ]]; then
122+
if [[ "$PLAT" == 'ios' || "$PLAT" == 'macos' || "$PLAT" == 'tvos' ]]; then
107123
install $PLAT
108-
elif [[ "$PLAT" == 'all' ]]; then
109-
plats="ios macos"
124+
elif [[ "$PLAT" == 'all' ]]; then
125+
plats="ios macos tvos"
110126
for plat in $plats; do
111127
install $plat
112128
done

0 commit comments

Comments
 (0)