forked from acoustid/ffmpeg-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-linux.sh
executable file
·84 lines (71 loc) · 1.97 KB
/
build-linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
set -eu
cd $(dirname $0)
BASE_DIR=$(pwd)
source common.sh
if [ ! -e $FFMPEG_TARBALL ]
then
curl -s -L -O $FFMPEG_TARBALL_URL
fi
: ${ARCH?}
OUTPUT_DIR=artifacts/ffmpeg-$FFMPEG_VERSION-audio-$ARCH-linux-gnu
case $ARCH in
x86_64)
;;
i686)
FFMPEG_CONFIGURE_FLAGS+=(--cc="gcc -m32")
;;
arm64)
FFMPEG_CONFIGURE_FLAGS+=(
--enable-cross-compile
--cross-prefix=aarch64-linux-gnu-
--target-os=linux
--arch=aarch64
)
;;
arm*)
FFMPEG_CONFIGURE_FLAGS+=(
--enable-cross-compile
--cross-prefix=arm-linux-gnueabihf-
--target-os=linux
--arch=arm
)
case $ARCH in
armv7-a)
FFMPEG_CONFIGURE_FLAGS+=(
--cpu=armv7-a
)
;;
armv8-a)
FFMPEG_CONFIGURE_FLAGS+=(
--cpu=armv8-a
)
;;
armhf-rpi2)
FFMPEG_CONFIGURE_FLAGS+=(
--cpu=cortex-a7
--extra-cflags='-fPIC -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad'
)
;;
armhf-rpi3)
FFMPEG_CONFIGURE_FLAGS+=(
--cpu=cortex-a53
--extra-cflags='-fPIC -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad'
)
;;
esac
;;
*)
echo "Unknown architecture: $ARCH"
exit 1
;;
esac
BUILD_DIR=$(mktemp -d -p $(pwd) build.XXXXXXXX)
trap 'rm -rf $BUILD_DIR' EXIT
cd $BUILD_DIR
tar --strip-components=1 -xf $BASE_DIR/$FFMPEG_TARBALL
FFMPEG_CONFIGURE_FLAGS+=(--prefix=$BASE_DIR/$OUTPUT_DIR)
./configure "${FFMPEG_CONFIGURE_FLAGS[@]}" || (cat ffbuild/config.log && exit 1)
make
make install
chown $(stat -c '%u:%g' $BASE_DIR) -R $BASE_DIR/$OUTPUT_DIR