blob: 953e6b692f52cd2b593e0a59af81d43bf5f9e70b (
plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#!/bin/bash
[[ -f buildhelpers.sh ]] &&
source buildhelpers.sh
FFMPEG_CONFIG_FILE=/xbmc/tools/buildsteps/windows/ffmpeg_options.txt
FFMPEG_VERSION_FILE=/xbmc/tools/depends/target/ffmpeg/FFMPEG-VERSION
FFMPEG_BASE_OPTS="--disable-debug --disable-doc --enable-gpl --enable-w32threads"
FFMPEG_DEFAULT_OPTS=""
FFMPEG_TARGET_OS=mingw32
do_loaddeps $FFMPEG_VERSION_FILE
FFMPEGDESTDIR=$PREFIX
do_getFFmpegConfig() {
if [[ -f "$FFMPEG_CONFIG_FILE" ]]; then
FFMPEG_OPTS_SHARED="$FFMPEG_BASE_OPTS $(cat "$FFMPEG_CONFIG_FILE" | sed -e 's:\\::g' -e 's/#.*//')"
else
FFMPEG_OPTS_SHARED="$FFMPEG_BASE_OPTS $FFMPEG_DEFAULT_OPTS"
fi
if [ "$ARCH" == "x86_64" ]; then
FFMPEG_TARGET_OS=mingw64
elif [ "$ARCH" == "x86" ]; then
FFMPEG_TARGET_OS=mingw32
do_addOption "--cpu=i686"
elif [ "$ARCH" == "arm" ]; then
FFMPEG_TARGET_OS=mingw32
do_addOption "--cpu=armv7"
fi
# add options for static modplug
if do_checkForOptions "--enable-libmodplug"; then
do_addOption "--extra-cflags=-DMODPLUG_STATIC"
fi
# handle gplv3 libs
if do_checkForOptions "--enable-libopencore-amrwb --enable-libopencore-amrnb \
--enable-libvo-aacenc --enable-libvo-amrwbenc"; then
do_addOption "--enable-version3"
fi
do_removeOption "--enable-nonfree"
do_removeOption "--enable-libfdk-aac"
do_removeOption "--enable-nvenc"
do_removeOption "--enable-libfaac"
# remove libs that don't work with shared
do_removeOption "--enable-decklink"
do_removeOption "--enable-libutvideo"
do_removeOption "--enable-libgme"
}
do_checkForOptions() {
local isPresent=1
for option in "$@"; do
for option2 in $option; do
if echo "$FFMPEG_OPTS_SHARED" | grep -q -E -e "$option2"; then
isPresent=0
fi
done
done
return $isPresent
}
do_addOption() {
local option=${1%% *}
local shared=$2
if ! do_checkForOptions "$option"; then
FFMPEG_OPTS_SHARED="$FFMPEG_OPTS_SHARED $option"
fi
}
do_removeOption() {
local option=${1%% *}
FFMPEG_OPTS_SHARED=$(echo "$FFMPEG_OPTS_SHARED" | sed "s/ *$option//g")
}
do_getFFmpegConfig
do_removeOption "--enable-gnutls"
do_removeOption "--enable-openssl"
do_addOption "--disable-gnutls"
do_addOption "--disable-openssl"
do_addOption "--toolchain=msvc"
if [ "$ARCH" == "x86_64" ]; then
FFMPEG_TARGET_OS=win64
elif [ "$ARCH" = "x86" ]; then
FFMPEG_TARGET_OS=win32
elif [ "$ARCH" = "arm" ]; then
FFMPEG_TARGET_OS=win32
fi
export CFLAGS=""
export CXXFLAGS=""
export LDFLAGS=""
extra_cflags="-I$LOCALDESTDIR/include -I/depends/$TRIPLET/include"
extra_ldflags="-LIBPATH:\"$LOCALDESTDIR/lib\" -LIBPATH:\"$MINGW_PREFIX/lib\" -LIBPATH:\"/depends/$TRIPLET/lib\""
if [ $win10 == "yes" ]; then
# enable OpenSSL on UWP, because schannel isn't available
do_removeOption "--disable-openssl"
do_addOption "--enable-openssl"
do_addOption "--enable-nonfree"
do_addOption "--enable-cross-compile"
extra_cflags=$extra_cflags" -MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00"
extra_ldflags=$extra_ldflags" -APPCONTAINER WindowsApp.lib"
fi
# compile ffmpeg with debug symbols
if do_checkForOptions "--enable-debug"; then
extra_cflags=$extra_cflags" -MDd"
extra_ldflags=$extra_ldflags" -NODEFAULTLIB:libcmt"
fi
cd $LOCALBUILDDIR
do_clean_get $1
[ -f config.mak ] && make distclean
do_print_status "$LIBNAME-$VERSION (${TRIPLET})" "$blue_color" "Configuring"
[[ -z "$extra_cflags" ]] && extra_cflags=-DPTW32_STATIC_LIB
[[ -z "$extra_ldflags" ]] && extra_ldflags=-static-libgcc
$LOCALSRCDIR/configure --target-os=$FFMPEG_TARGET_OS --prefix=$FFMPEGDESTDIR --arch=$ARCH \
--disable-static --enable-shared $FFMPEG_OPTS_SHARED \
--extra-cflags="$extra_cflags" --extra-ldflags="$extra_ldflags"
do_makelib
exit $?
|