-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildvlc.sh
executable file
·453 lines (398 loc) · 10.7 KB
/
buildvlc.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
#!/bin/bash
VLC_TESTED_HASH=4e0fa1b
SCRIPT=$(readlink -f "$0")
PROJECTPATH=$(dirname "$SCRIPT")
if [ "$BUILDCOMMONDONE" != 1 ]; then
source ${PROJECTPATH}/buildcommon
fi
# atomics are broken for x86 on 2.3, dirty hacks since it's used only from emulator
if [ "${TIZEN_SDK_VERSION}" = "2.3.1" -a "${TIZEN_ABI}" = "x86" ];then
VLC_INCLUDE_HACKS=" -I${PROJECTPATH}/hacks/vlc/2.3-x86-include"
else
VLC_INCLUDE_HACKS=""
fi
#####################
# FETCH VLC SOURCES #
#####################
if [ ! -d "${PROJECTPATH}/vlc" ]; then
echo -e "\e[1m\e[32mVLC source not found, cloning\e[0m"
git clone git://git.videolan.org/vlc.git "${PROJECTPATH}/vlc"
checkfail "vlc source: git clone failed"
else
echo -e "\e[1m\e[32mVLC source found\e[0m"
cd "${PROJECTPATH}/vlc"
if ! git cat-file -e ${VLC_TESTED_HASH}; then
cat << EOF
***
*** Error: Your vlc checkout does not contain the latest tested commit: ${VLC_TESTED_HASH}
***
EOF
exit 1
fi
cd ..
fi
###########################
# VLC BOOTSTRAP ARGUMENTS #
###########################
VLC_BOOTSTRAP_ARGS="\
--disable-disc \
--disable-sout \
--enable-dvdread \
--enable-dvdnav \
--disable-dca \
--disable-goom \
--disable-chromaprint \
--disable-lua \
--disable-schroedinger \
--disable-sdl \
--disable-SDL_image \
--disable-fontconfig \
--enable-zvbi \
--disable-kate \
--disable-caca \
--disable-gettext \
--disable-mpcdec \
--enable-upnp \
--disable-gme \
--disable-tremor \
--enable-vorbis \
--disable-sidplay2 \
--disable-samplerate \
--disable-faad2 \
--enable-harfbuzz \
--enable-iconv \
--disable-aribb24 \
--disable-aribb25 \
--disable-mpg123 \
--disable-libdsm \
--enable-libarchive \
--enable-libtasn1 \
--disable-nfs
"
###########################
# VLC CONFIGURE ARGUMENTS #
###########################
VLC_CONFIGURE_ARGS="\
--disable-nls \
--enable-live555 --enable-realrtsp \
--enable-avformat \
--enable-swscale \
--enable-avcodec \
--enable-opus \
--enable-opensles \
--enable-mkv \
--enable-taglib \
--enable-dvbpsi \
--disable-vlc \
--disable-shared \
--disable-update-check \
--disable-vlm \
--disable-dbus \
--disable-lua \
--disable-vcd \
--disable-v4l2 \
--disable-gnomevfs \
--enable-dvdread \
--enable-dvdnav \
--disable-bluray \
--disable-linsys \
--disable-decklink \
--disable-libva \
--disable-dv1394 \
--enable-mod \
--disable-sid \
--disable-gme \
--disable-tremor \
--disable-mad \
--disable-dca \
--disable-sdl-image \
--enable-zvbi \
--disable-fluidsynth \
--disable-jack \
--disable-pulse \
--disable-alsa \
--disable-samplerate \
--disable-sdl \
--disable-xcb \
--disable-atmo \
--disable-qt \
--disable-skins2 \
--disable-mtp \
--disable-notify \
--enable-libass \
--disable-svg \
--disable-udev \
--enable-libxml2 \
--disable-caca \
--disable-glx \
--disable-egl \
--disable-gles2 \
--disable-goom \
--disable-projectm \
--disable-sout \
--enable-vorbis \
--disable-faad \
--disable-x264 \
--disable-schroedinger \
--enable-evas \
"
########################
# VLC MODULE BLACKLIST #
########################
VLC_MODULE_BLACKLIST="
addons.*
stats
access_(bd|shm|imem)
oldrc
real
hotkeys
gestures
sap
dynamicoverlay
rss
ball
audiobargraph_[av]
clone
mosaic
osdmenu
puzzle
mediadirs
t140
ripple
motion
sharpen
grain
posterize
mirror
wall
scene
blendbench
psychedelic
alphamask
netsync
audioscrobbler
motiondetect
motionblur
export
smf
podcast
bluescreen
erase
stream_filter_record
speex_resampler
remoteosd
magnify
gradient
dtstofloat32
logger
visual
fb
aout_file
yuv
.dummy
"
# Release or not?
if [ "$RELEASE" = 1 ]; then
OPTS=""
else
OPTS="--enable-debug"
fi
cd ${PROJECTPATH}/vlc
###########################
# Build buildsystem tools #
###########################
export PATH=${PROJECTPATH}/vlc/extras/tools/build/bin:$PATH
echo -e "\e[1m\e[32mBuilding tools\e[0m"
cd extras/tools
./bootstrap
checkfail "buildsystem tools: bootstrap failed"
make $MAKEFLAGS
checkfail "buildsystem tools: make"
cd ../..
#############
# BOOTSTRAP #
#############
if [ ! -f configure ]; then
echo -e "\e[1m\e[32mBootstraping\e[0m"
./bootstrap
checkfail "vlc: bootstrap failed"
fi
############
# Contribs #
############
echo -e "\e[1m\e[32mBuilding the contribs\e[0m"
CONTRIB_BUILD_DIR=contrib/contrib-tizen-${TARGET_TUPLE}
mkdir -p ${CONTRIB_BUILD_DIR}
gen_pc_file() {
echo "Generating $1 pkg-config file"
echo "Name: $1
Description: $1
Version: $2
Libs: -l$1
Cflags:" > contrib/${TARGET_TUPLE}/lib/pkgconfig/`echo $1|tr 'A-Z' 'a-z'`.pc
}
mkdir -p contrib/${TARGET_TUPLE}/lib/pkgconfig
gen_pc_file EGL 1.1
gen_pc_file GLESv2 2
cd ${CONTRIB_BUILD_DIR}
TIZEN_ABI=${TIZEN_ABI} TIZEN_API=${TIZEN_API} \
../bootstrap --host=${TARGET_TUPLE} --build=x86_64-linux-gnu ${VLC_BOOTSTRAP_ARGS}
checkfail "contribs: bootstrap failed"
# TODO: mpeg2, theora
# Some libraries have arm assembly which won't build in thumb mode
# We append -marm to the CFLAGS of these libs to disable thumb mode
[ ${TIZEN_ABI} = "armv7l" ] && echo "NOTHUMB := -marm" >> config.mak
echo "EXTRA_CFLAGS= -g ${EXTRA_CFLAGS}" >> config.mak
echo "EXTRA_LDFLAGS= ${EXTRA_LDFLAGS}" >> config.mak
make fetch
checkfail "contribs: make fetch failed"
# gettext
which autopoint >/dev/null || make $MAKEFLAGS .gettext
# export the PATH
export PATH="$PATH:$PWD/../$TARGET_TUPLE/bin"
# Make
make $MAKEFLAGS
checkfail "contribs: make failed"
cd ../../
###################
# BUILD DIRECTORY #
###################
mkdir -p $VLC_BUILD_DIR && cd $VLC_BUILD_DIR
#############
# CONFIGURE #
#############
if [ ! -e ./config.h -o "$RELEASE" = 1 ]; then
CPPFLAGS="$CPPFLAGS" \
CFLAGS="$CFLAGS ${EXTRA_CFLAGS}" \
CXXFLAGS="$CFLAGS ${EXTRA_CXXFLAGS}" \
LDFLAGS="$LDFLAGS" \
CC="${CROSS_COMPILE}gcc -fPIC --sysroot=${SYSROOT}${VLC_INCLUDE_HACKS}" \
CXX="${CROSS_COMPILE}g++ -fPIC --sysroot=${SYSROOT} -D__cpp_static_assert=200410" \
NM="${CROSS_COMPILE}nm" \
STRIP="${CROSS_COMPILE}strip" \
RANLIB="${CROSS_COMPILE}ranlib" \
AR="${CROSS_COMPILE}ar" \
PKG_CONFIG_LIBDIR=../contrib/$TARGET_TUPLE/lib/pkgconfig \
EVAS_CFLAGS="-I${TIZEN_INCLUDES} -I${TIZEN_INCLUDES}/evas-1 \
-I${TIZEN_INCLUDES}/ecore-1 -I${TIZEN_INCLUDES}/efl-1 \
-I${TIZEN_INCLUDES}/eina-1 -I${TIZEN_INCLUDES}/eina-1/eina \
-I${TIZEN_INCLUDES}/eo-1" \
EVAS_LIBS="-L${TIZEN_LIBS}" \
sh ../configure --host=$TARGET_TUPLE --build=x86_64-unknown-linux \
${EXTRA_PARAMS} ${VLC_CONFIGURE_ARGS} ${OPTS}
checkfail "vlc: configure failed"
fi
############
# BUILDING #
############
echo -e "\e[1m\e[32mBuilding libvlc\e[0m"
make $MAKEFLAGS
checkfail "vlc: make failed"
cd ../../
##################
# libVLC modules #
##################
REDEFINED_VLC_MODULES_DIR=${PROJECTPATH}/vlc/.modules/${VLC_BUILD_DIR}
rm -rf ${REDEFINED_VLC_MODULES_DIR}
mkdir -p ${REDEFINED_VLC_MODULES_DIR}
echo -e "\e[1m\e[32mGenerating static module list\e[0m"
blacklist_regexp=
for i in ${VLC_MODULE_BLACKLIST}
do
if [ -z "${blacklist_regexp}" ]
then
blacklist_regexp="${i}"
else
blacklist_regexp="${blacklist_regexp}|${i}"
fi
done
find_modules()
{
echo "`find $1 -name 'lib*plugin.a' | grep -vE "lib(${blacklist_regexp})_plugin.a" | tr '\n' ' '`"
}
get_symbol()
{
echo "$1" | grep vlc_entry_$2|cut -d" " -f 3
}
VLC_MODULES=$(find_modules vlc/$VLC_BUILD_DIR/modules)
DEFINITION="";
BUILTINS="const void *vlc_static_modules[] = {\n";
for file in $VLC_MODULES; do
outfile=${REDEFINED_VLC_MODULES_DIR}/`basename $file`
name=`echo $file | sed 's/.*\.libs\/lib//' | sed 's/_plugin\.a//'`;
symbols=$("${CROSS_COMPILE}nm" -g $file)
# assure that all modules have differents symbol names
entry=$(get_symbol "$symbols" _)
copyright=$(get_symbol "$symbols" copyright)
license=$(get_symbol "$symbols" license)
cat <<EOF > ${REDEFINED_VLC_MODULES_DIR}/syms
AccessOpen AccessOpen__$name
AccessClose AccessClose__$name
StreamOpen StreamOpen__$name
StreamClose StreamClose__$name
DemuxOpen DemuxOpen__$name
DemuxClose DemuxClose__$name
OpenFilter OpenFilter__$name
CloseFilter CloseFilter__$name
Open Open__$name
Close Close__$name
$entry vlc_entry__$name
$copyright vlc_entry_copyright__$name
$license vlc_entry_license__$name
EOF
${CROSS_COMPILE}objcopy --redefine-syms ${REDEFINED_VLC_MODULES_DIR}/syms $file $outfile
checkfail "objcopy failed"
DEFINITION=$DEFINITION"int vlc_entry__$name (int (*)(void *, void *, int, ...), void *);\n";
BUILTINS="$BUILTINS vlc_entry__$name,\n";
done;
BUILTINS="$BUILTINS 0\n};\n"; \
printf "/* Autogenerated from the list of modules */\n$DEFINITION\n$BUILTINS\n" > ${PROJECTPATH}/vlc/.modules/libvlc-modules.c
rm ${REDEFINED_VLC_MODULES_DIR}/syms
# Generating the .ver file like libvlc.so upstream
VER_FILE="vlc/$VLC_BUILD_DIR/lib/.libs/libvlc.ver"
echo "{ global:" > $VER_FILE
cat vlc/lib/libvlc.sym | sed -e "s/\(.*\)/\1;/" >> $VER_FILE
echo "local: *; };" >> $VER_FILE
##################
# Linking VLC #
##################
echo -e "\e[1m\e[32mLinking\e[0m"
${CC} -fPIC -rdynamic -shared \
-Lvlc/contrib/${TARGET_TUPLE}/lib \
-Wl,-soname -Wl,libvlc.so -Wl,-version-script \
-Wl,${PROJECTPATH}/$VER_FILE \
-o ${PROJECTPATH}/lib/libvlc.so \
${PROJECTPATH}/vlc/.modules/libvlc-modules.c \
-Wl,--whole-archive \
${PROJECTPATH}/vlc/${VLC_BUILD_DIR}/lib/.libs/libvlc.a \
-Wl,--no-whole-archive \
${PROJECTPATH}/vlc/.modules/${VLC_BUILD_DIR}/*.a \
${PROJECTPATH}/vlc/${VLC_BUILD_DIR}/src/.libs/libvlccore.a \
${PROJECTPATH}/vlc/${VLC_BUILD_DIR}/compat/.libs/libcompat.a \
-Wl,--whole-archive \
${PROJECTPATH}/vlc/contrib/${TARGET_TUPLE}/lib/libiconv.a \
-Wl,--no-whole-archive \
-ldl -lz -lm \
-ldvbpsi -lmatroska -lebml -ltag \
-logg -lFLAC -ltheora -lvorbis \
-lmpeg2 -la52 \
-lavformat -lavcodec -lswscale -lavutil -lpostproc -lgsm -lopenjpeg \
-lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
-lspeex -lspeexdsp \
-lxml2 -lpng -lgnutls -lgcrypt -lgpg-error \
-lnettle -lhogweed -lgmp \
-lfreetype -liconv -lass -lfribidi -lopus -lharfbuzz \
-ljpeg \
-ldvdnav -ldvdread -ldvdcss \
-ltasn1 \
-lzvbi \
-lssh2 \
-lmodplug \
-lupnp -lthreadutil -lixml \
-larchive \
-levas -lecore \
${EXTRA_LDFLAGS}
# Missing:f
# -lEGL -lGLESv2 -ldsm
checkfail "linker: libvlc.so"
#cd ${PROJECTPATH}/lib/ && ln -sf libvlc.so.5 libvlc.so && cd -