Skip to content

Commit 055038a

Browse files
committed
add fftutorial
1 parent 4984f98 commit 055038a

File tree

4 files changed

+171
-0
lines changed

4 files changed

+171
-0
lines changed

.github/workflows/apple-android-common.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ on:
4646
- dvdread
4747
- ffmpeg
4848
- ijkffmpeg
49+
- fftutorial
4950
- harfbuzz
5051
- fontconfig
5152
- freetype

.github/workflows/install-dependencies.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ case $LIB_NAME in
6767
./main.sh install -l 'openssl' -p $PLAT
6868
fi
6969
;;
70+
fftutorial)
71+
if [[ $PLAT == all ]];then
72+
./main.sh install -l 'openssl' -p ios
73+
./main.sh install -l 'openssl' -p tvos
74+
./main.sh install -l 'openssl' -p macos
75+
./main.sh install -l 'openssl' -p android
76+
elif [[ $PLAT == apple ]];then
77+
./main.sh install -l 'openssl' -p ios
78+
./main.sh install -l 'openssl' -p tvos
79+
./main.sh install -l 'openssl' -p macos
80+
else
81+
./main.sh install -l 'openssl' -p $PLAT
82+
fi
83+
;;
7084
harfbuzz)
7185
if [[ $PLAT == all ]];then
7286
./main.sh install -l 'freetype' -p ios

configs/libs/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<qianlongxu@gmail.com>
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=
45+
export PRE_COMPILE_TAG_MACOS=
46+
export PRE_COMPILE_TAG_IOS=
47+
export PRE_COMPILE_TAG_ANDROID=
48+

do-compile/apple/fftutorial.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
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+
# This script is based on projects below
19+
# https://github.com/bilibili/ijkplayer
20+
21+
set -e
22+
23+
error_handler() {
24+
echo "An error occurred!"
25+
tail -n20 ${MR_BUILD_SOURCE}/ffbuild/config.log
26+
}
27+
28+
trap 'error_handler' ERR
29+
30+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
31+
cd "$THIS_DIR"
32+
33+
# ffmpeg config options
34+
source $MR_SHELL_CONFIGS_DIR/ffconfig/module.sh
35+
source $MR_SHELL_CONFIGS_DIR/ffconfig/auto-detect-third-libs.sh
36+
37+
CFG_FLAGS=
38+
CFG_FLAGS="$CFG_FLAGS $COMMON_FF_CFG_FLAGS"
39+
CFG_FLAGS="$CFG_FLAGS $THIRD_CFG_FLAGS"
40+
CFG_FLAGS="$CFG_FLAGS --disable-avfilter"
41+
CFG_FLAGS="$CFG_FLAGS --disable-avdevice"
42+
43+
C_FLAGS="$MR_DEFAULT_CFLAGS"
44+
EXTRA_LDFLAGS=
45+
LDFLAGS="$C_FLAGS $EXTRA_LDFLAGS"
46+
# C_FLAGS="$C_FLAGS -I/Users/matt/GitWorkspace/MoltenVK/Package/Release/MoltenVK/include"
47+
# use system xml2 lib
48+
# C_FLAGS="$C_FLAGS $(xml2-config --prefix=${MR_SYS_ROOT}/usr --cflags)"
49+
# LDFLAGS="$C_FLAGS $(xml2-config --prefix=${MR_SYS_ROOT}/usr --libs)"
50+
51+
# LDFLAGS="$LDFLAGS -framework IOKit -framework Metal -framework IOSurface -framework CoreGraphics -framework QuartzCore -framework AppKit -framework Foundation -lc++ /Users/matt/GitWorkspace/MoltenVK/Package/Release/MoltenVK/static/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a"
52+
echo "----------------------"
53+
echo "[*] configure"
54+
55+
if [[ ! -d $MR_BUILD_SOURCE ]]; then
56+
echo ""
57+
echo "!! ERROR"
58+
echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME"
59+
echo "!! Run 'init-*.sh' first"
60+
echo ""
61+
exit 1
62+
fi
63+
64+
cd $MR_BUILD_SOURCE
65+
if [[ -f "./config.h" ]]; then
66+
echo 'reuse configure'
67+
else
68+
echo
69+
echo "CC: $MR_CC"
70+
echo "CFLAGS: $C_FLAGS"
71+
echo "LDFLAG:$LDFLAGS"
72+
echo "FF_CFG_FLAGS: $CFG_FLAGS"
73+
echo
74+
./configure \
75+
$CFG_FLAGS \
76+
--cc="$MR_CC" \
77+
--as="perl ${MR_GAS_PERL} -arch ${MR_ARCH} -- $MR_CC" \
78+
--extra-cflags="$C_FLAGS" \
79+
--extra-cxxflags="$C_FLAGS" \
80+
--extra-ldflags="$LDFLAGS"
81+
fi
82+
83+
#----------------------
84+
echo "----------------------"
85+
echo "[*] compile"
86+
87+
make -j$MR_HOST_NPROC >/dev/null
88+
89+
cp config.* $MR_BUILD_PREFIX
90+
make install >/dev/null
91+
mkdir -p $MR_BUILD_PREFIX/include/libffmpeg
92+
cp -f config.h $MR_BUILD_PREFIX/include/libffmpeg/
93+
[ -e config_components.h ] && cp -f config_components.h $MR_BUILD_PREFIX/include/libffmpeg/
94+
# copy private header for ffmpeg-kit.
95+
[ -e $MR_BUILD_SOURCE/libavutil/getenv_utf8.h ] && cp -f $MR_BUILD_SOURCE/libavutil/getenv_utf8.h $MR_BUILD_PREFIX/include/libavutil/
96+
cp -f $MR_BUILD_SOURCE/libavutil/internal.h $MR_BUILD_PREFIX/include/libavutil/
97+
cp -f $MR_BUILD_SOURCE/libavutil/libm.h $MR_BUILD_PREFIX/include/libavutil/
98+
[ -e $MR_BUILD_SOURCE/libavutil/attributes_internal.h ] && cp -f $MR_BUILD_SOURCE/libavutil/attributes_internal.h $MR_BUILD_PREFIX/include/libavutil/
99+
cp -f $MR_BUILD_SOURCE/libavcodec/mathops.h $MR_BUILD_PREFIX/include/libavcodec/
100+
101+
mkdir -p $MR_BUILD_PREFIX/include/libavcodec/x86/
102+
cp -f $MR_BUILD_SOURCE/libavcodec/x86/mathops.h $MR_BUILD_PREFIX/include/libavcodec/x86/
103+
mkdir -p $MR_BUILD_PREFIX/include/libavutil/x86/
104+
cp -f $MR_BUILD_SOURCE/libavutil/x86/asm.h $MR_BUILD_PREFIX/include/libavutil/x86/
105+
#copy private header for hls.c
106+
cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/
107+
cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/
108+
cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/

0 commit comments

Comments
 (0)