-
Notifications
You must be signed in to change notification settings - Fork 3
/
ff.sh
executable file
·207 lines (171 loc) · 4.28 KB
/
ff.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/bin/bash
# MPlayer/FFmpeg MinGW-w64 Cross Build Environment
# Copyright (c) 2013-2022 Gianluigi Tiesi <[email protected]>
# See LICENSE for licensing informations
. ../config.sh
. ../nameterm.sh
export PATH=${CROSS_ROOT}/bin:${PATH}
say()
{
nameTerminal "$*"
echo $*
}
product=$(basename $(pwd))
version=$(./ffbuild/version.sh)
CONFIGURE_OPTS=""
add_opt()
{
CONFIGURE_OPTS="${CONFIGURE_OPTS} $1"
}
enable()
{
add_opt --enable-$1
}
disable()
{
add_opt --disable-$1
}
NAME="FFmpeg"
PROGRAM="ffmpeg"
PROGRAMS="ffprobe ffplay"
packagedir="${PKGDIR}/${NAME}/git-$version"
packagename="${NAME}-${ARCH}-$version"
package="${packagedir}/${packagename}.7z"
source="${packagedir}/$product-$version-src.tar.xz"
configure()
{
add_opt --prefix=${PREFIX}
add_opt --cross-prefix=${CROSS_PREFIX}
add_opt --extra-ldflags=-static
add_opt --arch=${ARCH}
add_opt --target-os=mingw32
add_opt --extra-version=sherpya
add_opt --pkg-config-flags="--static"
disable outdevs
disable w32threads
disable bcrypt
# maybe with mold, someday
#enable lto
enable gpl
enable version3
enable cross-compile
enable runtime-cpudetect
enable hardcoded-tables
enable pthreads
enable avfilter
enable postproc
enable libaribb24
enable avisynth
config bzlib
enable frei0r
config frei0r
enable mbedtls
config iconv
enable libass
disable libbluray
enable libbs2b
disable libcaca
enable libcdio
config libcdio
have cdio_paranoia_paranoia_h
enable libcodec2
enable libfdk-aac
enable fontconfig
enable libfreetype
enable libfribidi
enable libgme
enable libgsm
enable libilbc
enable libkvazaar
enable libmodplug
enable libmp3lame
enable libopencore-amrnb
enable libopencore-amrwb
enable libopenh264
enable libopenjpeg
enable libopenmpt
# The CELT codec has been merged into the IETF Opus codec
enable libopus
enable libshine
enable libsoxr
enable libspeex
enable libtheora
enable libtwolame
enable libvidstab
enable libvo-amrwbenc
enable libvorbis
enable libvpx
enable libwebp
enable libx264
enable libx265
enable libxavs
enable libxvid
# enables dash muxer/demuxer
enable libxml2
enable libzimg
enable ffnvcodec
config zlib
enable libaom
./configure ${CONFIGURE_OPTS} $* || return 1
check_components || return 1
}
make_dist()
{
say "Building dist...${package}"
TMPDIR=$(mktemp -d /tmp/$product-build-XXXX)
DISTDIR=${TMPDIR}/${packagename}
mkdir ${DISTDIR}
for program in ${PROGRAM} ${PROGRAMS}; do
install -m755 ${program}.exe ${DISTDIR}/${program}.exe
${CROSS_PREFIX}strip ${DISTDIR}/${program}.exe
done
mkdir ${DISTDIR}/doc
install -m644 COPYING.GPLv3 ${DISTDIR}/doc/
for doc in COPYING.GPLv3 doc/faq.html doc/general.html doc/*-all.html; do
install -m644 $doc ${DISTDIR}/doc/
done
unix2dos > ${DISTDIR}/README-win32.txt << EOF
${NAME} Win32 binary Builds by Gianluigi Tiesi <[email protected]>
This binary build license is GPLv3.
Modified windows icons are made by using Lila SVG Icon and Theme Artwork:
https://sourceforge.net/projects/lila-theme/
Copyright 2004-2006 Lila Community
available under the GNU General Public License
-- Report bugs to [email protected]
EOF
mkdir -p "${packagedir}"
pkgtemp=$(mktemp -u /tmp/$product-dist-XXXX.7z)
( cd ${TMPDIR} && ${SEVENZIP} a -mx=9 ${pkgtemp} ${packagename} )
mv -f ${pkgtemp} "${package}"
rm -fr ${TMPDIR}
echo "Done with $package"
}
build_binary()
{
if [ -e $package ]; then
echo "$package uptodate"
return
fi
echo "Building $package"
echo -n "Cleaning..."
make distclean >/dev/null 2>&1
echo "done"
say "Configuring ${NAME} ${ARCH}..."
configure || return 1
say "Make ${NAME} ${ARCH}..."
make -j8 || return 1
make_dist
}
build_source()
{
if [ -e $source ]; then
echo "$source uptodate"
return
fi
say "Generating $source"
srctemp=$(mktemp -u /tmp/$product-src-XXXX.tar.xz)
git archive --prefix="$product-$version-src/" --format=tar HEAD | xz -c > ${srctemp}
mv -f ${srctemp} "${source}"
echo "Done with $source"
}
eval $*