Skip to content

Commit 6a153b4

Browse files
committed
use new fftutorial libs
1 parent 8e60d37 commit 6a153b4

File tree

5 files changed

+224
-174
lines changed

5 files changed

+224
-174
lines changed

install-pre-any.sh

Lines changed: 10 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -14,111 +14,31 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17+
# ./install-pre-any.sh ios
18+
# ./install-pre-any.sh macos
1719
# ./install-pre-any.sh all
18-
# ./install-pre-any.sh ios 'libyuv openssl opus bluray dav1d'
19-
# ./install-pre-any.sh macos 'openssl'
20-
# ./install-pre-any.sh macos 'openssl ffmpeg'
21-
22-
23-
#----------------------------------------------------------
24-
# 当发布新版本库时,修改对应的 TAG 值
25-
#----------------------------------------------------------
26-
LIBYUV_TAG='libyuv-main-231127113441'
27-
OPUS_TAG='opus-1.4-231127183709'
28-
MAC_BLURAY_TAG='bluray-1.3.4-231127183939'
29-
DAV1D_TAG='dav1d-1.3.0-231127183948'
30-
OPENSSL_TAG='openssl-1.1.1w-231127183927'
31-
FFMPEG_TAG='ffmpeg-5.1.4-231128092946'
32-
#----------------------------------------------------------
3320

3421
set -e
3522

36-
PLAT=$1
37-
LIBS=$2
23+
plat=$1
3824

3925
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
4026
cd "$THIS_DIR"
4127

42-
function install_lib ()
43-
{
44-
local plat=$1
45-
46-
if [[ "$plat" == 'ios' || "$plat" == 'macos' ]]; then
47-
./tools/install-pre-lib.sh "$plat" "$TAG"
48-
else
49-
./tools/install-pre-lib.sh 'ios' "$TAG"
50-
./tools/install-pre-lib.sh 'macos' "$TAG"
51-
fi
52-
}
53-
5428
function usage() {
5529
echo "=== useage ===================="
5630
echo "Download pre-compiled libs from github:"
57-
echo " $0 [ios,macos,all] [all|ffmpeg|libyuv|openssl|opus|bluray|dav1d]"
31+
echo " $0 [ios,macos,all]"
5832
exit
5933
}
6034

61-
if [[ -z "$LIBS" || "$LIBS" == "all" ]]; then
62-
if [[ "$PLAT" == 'macos' ]];then
63-
LIBS="bluray dav1d openssl opus ffmpeg"
64-
elif [[ "$PLAT" == 'ios' ]];then
65-
LIBS="dav1d openssl opus ffmpeg"
35+
if [[ "$plat" == 'ios' || "$plat" == 'macos' || "$plat" == 'all' ]]; then
36+
if [[ "$plat" == 'ios' || "$plat" == 'macos' ]]; then
37+
./tools/main.sh "$plat"
6638
else
67-
useage
39+
./tools/main.sh 'ios'
40+
./tools/main.sh 'macos'
6841
fi
69-
fi
70-
71-
if [[ "$PLAT" == 'ios' || "$PLAT" == 'macos' || "$PLAT" == 'all' ]]; then
72-
for lib in $LIBS
73-
do
74-
plat=$PLAT
75-
TAG=
76-
if [[ $lib == 'bluray' ]];then
77-
if [[ $plat == 'macos' || $plat == 'all' ]];then
78-
plat='macos'
79-
else
80-
echo "===[bluray] not support iOS platform, just skip it.===================="
81-
continue
82-
fi
83-
fi
84-
85-
echo "===[install pre-compile $lib]===================="
86-
87-
case $lib in
88-
'ffmpeg')
89-
TAG=$FFMPEG_TAG
90-
;;
91-
'libyuv')
92-
TAG=$LIBYUV_TAG
93-
;;
94-
'openssl')
95-
TAG=$OPENSSL_TAG
96-
;;
97-
'opus')
98-
TAG=$OPUS_TAG
99-
;;
100-
'bluray')
101-
TAG=$MAC_BLURAY_TAG
102-
;;
103-
'dav1d')
104-
TAG=$DAV1D_TAG
105-
;;
106-
*)
107-
echo "wrong lib name:$lib"
108-
usage
109-
;;
110-
esac
111-
112-
if [[ -z "$TAG" ]]; then
113-
echo "== $lib tag is empty,just skip it."
114-
else
115-
echo "== $plat $lib -> $TAG"
116-
install_lib $plat
117-
fi
118-
echo "===================================="
119-
done
120-
121-
echo "[$LIBS] successfully installed!"
12242
else
12343
usage
124-
fi
44+
fi

tools/download-uncompress.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2022 Matt Reach<[email protected]>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
set -e
19+
20+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
21+
cd "$THIS_DIR"
22+
23+
echo "=== [$0] check env begin==="
24+
env_assert "MR_WORKSPACE"
25+
env_assert "MR_DOWNLOAD_URL"
26+
env_assert "MR_DOWNLOAD_ONAME"
27+
env_assert "MR_UNCOMPRESS_DIR"
28+
echo "===check env end==="
29+
30+
function download() {
31+
local dst="$1"
32+
echo "---[download]-----------------"
33+
echo "$MR_DOWNLOAD_URL"
34+
35+
mkdir -p $(dirname "$dst")
36+
local tname="${dst}.tmp"
37+
curl -fL --retry 3 --retry-delay 5 --retry-max-time 30 "$MR_DOWNLOAD_URL" -o "$tname"
38+
39+
if [[ $? -eq 0 ]];then
40+
mv "$tname" "${dst}"
41+
else
42+
rm -f "$tname"
43+
fi
44+
}
45+
46+
function extract(){
47+
local dst="$1"
48+
if [[ -f "$dst" ]];then
49+
mkdir -p "$MR_UNCOMPRESS_DIR"
50+
unzip -oq "$dst" -d "$MR_UNCOMPRESS_DIR"
51+
echo "extract zip file"
52+
else
53+
echo "you need download ${MR_DOWNLOAD_ONAME} firstly."
54+
exit 1
55+
fi
56+
}
57+
58+
function install() {
59+
local dst="${MR_WORKSPACE}/pre/${MR_DOWNLOAD_ONAME}"
60+
if [[ -f "$dst" ]];then
61+
echo "$dst already exist,skip download."
62+
else
63+
download "$dst"
64+
fi
65+
extract "$dst"
66+
}
67+
68+
install

tools/fftutorial.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<[email protected]>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
# brew install nasm
19+
# If you really want to compile without asm, configure with --disable-asm.
20+
21+
export LIB_NAME='fftutorial'
22+
export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample"
23+
export LIB_DEPENDS_BIN="nasm pkg-config"
24+
export GIT_LOCAL_REPO=extra/ffmpeg
25+
export REPO_DIR=ffmpeg
26+
27+
# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror
28+
if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then
29+
export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM"
30+
else
31+
export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git
32+
fi
33+
34+
if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then
35+
export GIT_COMMIT="$GIT_FFMPEG_COMMIT"
36+
export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT"
37+
else
38+
export GIT_COMMIT=n6.1.1 #origin/release/5.1
39+
export GIT_REPO_VERSION=6.1.1
40+
fi
41+
42+
# pre compiled
43+
export PRE_COMPILE_TAG=
44+
export PRE_COMPILE_TAG_TVOS=fftutorial-6.1.1-250413171857
45+
export PRE_COMPILE_TAG_MACOS=fftutorial-6.1.1-250413171857
46+
export PRE_COMPILE_TAG_IOS=fftutorial-6.1.1-250413171857
47+
export PRE_COMPILE_TAG_ANDROID=
48+

tools/install-pre-lib.sh

Lines changed: 17 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -17,99 +17,32 @@
1717

1818
set -e
1919

20-
PLAT=$1
21-
TAG=$2
22-
2320
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2421
cd "$THIS_DIR"
25-
cd ../
26-
27-
function usage() {
28-
echo "=== useage ===================="
29-
echo "Download precompiled libs from github,The usage is as follows:"
30-
echo "$0 [ios|macos|all] [<release tag>]"
31-
}
3222

33-
function download() {
34-
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."
39-
return
40-
fi
41-
42-
local fname="$LIB_NAME-$plat-universal-$VER.zip"
43-
local url="https://github.com/debugly/MRFFToolChainBuildShell/releases/download/$TAG/$fname"
23+
function install_plat() {
24+
local join=""
4425

45-
echo "---[download $fname]-----------------"
46-
echo "$url"
47-
mkdir -p build/pre
48-
local tname="build/pre/${TAG}.tmp"
49-
curl --connect-timeout 120 --max-time 3600 --retry 3 -L "$url" -o "$tname"
50-
if [[ $? -eq 0 ]];then
51-
mv "$tname" "$oname"
26+
if [[ "$1" ]];then
27+
join="-$1"
5228
fi
53-
}
54-
55-
function extract(){
56-
local plat=$1
57-
local oname="build/pre/${TAG}-$plat.zip"
5829

59-
if [[ -f "$oname" ]];then
60-
mkdir -p build/product/$plat/universal
61-
unzip -oq "$oname" -d build/product/$plat/universal
62-
echo "extract zip file"
63-
if command -v tree >/dev/null 2>&1; then
64-
tree -L 2 build/product/$plat/universal
65-
fi
30+
# you can export MR_DOWNLOAD_WEBSERVER use your mirror
31+
if [[ "$MR_DOWNLOAD_BASEURL" != "" ]] ;then
32+
base_url="$MR_DOWNLOAD_BASEURL"
6633
else
67-
echo "you need download ${oname} firstly."
68-
exit 1
34+
base_url=https://github.com/debugly/MRFFToolChainBuildShell/releases/download/
6935
fi
70-
}
71-
72-
function fix_prefix(){
73-
local plat=$1
74-
local UNI_PC_DIR="build/product/$plat/universal/$LIB_NAME/lib/pkgconfig"
36+
export MR_DOWNLOAD_ONAME="$TAG/$LIB_NAME-$MR_PLAT-universal${join}-$VER.zip"
37+
export MR_DOWNLOAD_URL="${base_url}${MR_DOWNLOAD_ONAME}"
38+
export MR_UNCOMPRESS_DIR="$MR_WORKSPACE/product/$MR_PLAT/universal${join}"
7539

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-
fi
82-
}
83-
84-
function install(){
85-
download "$*"
86-
extract "$*"
87-
fix_prefix "$*"
40+
./download-uncompress.sh
8841
}
8942

90-
if [[ "$PLAT" != 'ios' && "$PLAT" != 'macos' && "$PLAT" != 'all' ]]; then
91-
echo 'plat must use ios or macos'
92-
usage
93-
exit
94-
fi
95-
96-
if test -z $TAG ;then
97-
echo "tag can't be nil"
98-
usage
99-
exit
100-
fi
101-
102-
# opus-1.3.1-231124151836
103-
LIB_NAME=$(echo $TAG | awk -F - '{print $1}')
104-
VER=$(echo $TAG | awk -F - '{print $2}')
105-
106-
if [[ "$PLAT" == 'ios' || "$PLAT" == 'macos' ]]; then
107-
install $PLAT
108-
elif [[ "$PLAT" == 'all' ]]; then
109-
plats="ios macos"
110-
for plat in $plats; do
111-
install $plat
112-
done
43+
if [[ "$MR_PLAT" == 'ios' || "$MR_PLAT" == 'tvos' ]];then
44+
install_plat
45+
install_plat "simulator"
11346
else
114-
usage
115-
fi
47+
install_plat
48+
fi

0 commit comments

Comments
 (0)