-
Notifications
You must be signed in to change notification settings - Fork 3
/
mp.sh
executable file
·209 lines (168 loc) · 4.05 KB
/
mp.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
208
209
#!/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 $*
}
version=$(LC_ALL=C git svn info 2> /dev/null | grep Revision | cut -d' ' -f2)
ff_revision=$(( cd ../ffmpeg && LC_ALL=C git rev-parse --short upstream/master )2> /dev/null)
version=r${version}+g${ff_revision}
packagedir="${PKGDIR}/MPlayer and MEncoder/${version}"
source="${packagedir}/mplayer-$version-src.tar.xz"
have yasm
have pthreads
config iconv
config caca
config png
config jpeg
config gif
config sdl
config dvdread
config libcdio
config freetype
config fontconfig
config fribidi
config enca
config zlib
config bzlib
config libaom
config liblzo
config libmad
config twolame
config oggvorbis
config speex
config libgsm
config oggtheora
config libdca
config libilbc
config libopus
config libbs2b
config libopencore_amrnb
config libopencore_amrwb
config libmodplug
config libopenjpeg
config libxvid
config libx264
config mp3lame
config mpg123
config dvdnav
config vcd
config dash_muxer
config dash_demuxer
CONFIGURE_OPTS=""
add_opt()
{
CONFIGURE_OPTS="${CONFIGURE_OPTS} $1"
}
enable()
{
add_opt --enable-$1
}
disable()
{
add_opt --disable-$1
}
configure()
{
add_opt --prefix=/invalid
add_opt --host-cc=gcc
add_opt --cc=${CROSS_PREFIX}gcc
add_opt --as=${CROSS_PREFIX}as
add_opt --ar=${CROSS_PREFIX}ar
add_opt --nm=${CROSS_PREFIX}nm
add_opt --ranlib=${CROSS_PREFIX}ranlib
add_opt --windres=${CROSS_PREFIX}windres
enable cross-compile
enable runtime-cpudetection
enable static
enable postproc
disable vidix
disable inet6
enable mbedtls
enable dvdnav
enable dvdread
disable bluray
enable menu
enable libfdk-aac-lavc
disable ass-internal
echo configure ${CONFIGURE_OPTS} $*
./configure ${CONFIGURE_OPTS} $* || return 1
check_components || return 1
}
make_dist()
{
say "Building dist...${package}"
TMPDIR=$(mktemp -d /tmp/mpbuild-XXXX)
DISTDIR=${TMPDIR}/MPlayer-$cpu-$version
mkdir ${DISTDIR}
for exe in mplayer.exe mencoder.exe; do
install -m755 -D $exe ${DISTDIR}/$exe
${CROSS_PREFIX}strip ${DISTDIR}/${exe}
done
make html-single && install -m644 -D DOCS/HTML/en/MPlayer.html ${DISTDIR}/MPlayer.html
groff -mman -Thtml DOCS/man/en/mplayer.1 > ${DISTDIR}/MPlayer.man.html
unix2dos -n LICENSE ${DISTDIR}/LICENSE.txt
DATADIR=../dist/MPlayer
copy_data ${DATADIR}/common ${DISTDIR}
copy_data ${DATADIR}/${ARCH} ${DISTDIR}
mkdir -p "${packagedir}"
pkgtemp=$(mktemp -u /tmp/mp-dist-XXXX.7z)
( cd ${TMPDIR} && ${SEVENZIP} a -mx=9 ${pkgtemp} MPlayer-$cpu-$version )
mv -f ${pkgtemp} "${package}"
rm -fr ${TMPDIR}
echo "Done with $package"
}
distclean()
{
echo -n "Cleaning..."
make distclean >/dev/null 2>&1
echo "done"
}
build_binary()
{
cpu=$1
package="${packagedir}/MPlayer-$cpu-$version.7z"
if [ -e "$package" ]; then
echo "$package uptodate"
return
fi
echo "Building $package"
if [ "$cpu" = "generic" ]; then
opts="--with-arch=i486 --with-tune=generic --disable-fast-clz"
elif [ "$cpu" = "x86_64" ]; then
opts="--with-arch=x86-64 --with-tune=generic"
else
opts="--with-arch=$cpu --with-tune=$cpu"
fi
distclean
say "Configuring MPlayer ${cpu}..."
configure $opts || return 1
say "Make MPlayer ${cpu}..."
make -j8 || return 1
make_dist
}
build_source()
{
if [ -e "$source" ]; then
echo "$source uptodate"
return
fi
say "Generating $source"
distclean
( cd ffmpeg && git pull --rebase --ff-only )
echo -n "Building $source ..."
echo sherpya-$version > VERSION
mkdir -p "${packagedir}"
srctemp=$(mktemp -u /tmp/mp-src-XXXX.tar.xz)
( cd .. && tar --exclude-vcs -cJf ${srctemp} mplayer )
mv -f ${srctemp} "${source}"
rm -f VERSION
echo "Done with $source"
}
eval $*