This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildMobileVLCKit.sh
executable file
·1150 lines (1024 loc) · 30.2 KB
/
buildMobileVLCKit.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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# Copyright (C) Pierre d'Herbemont, 2010
# Copyright (C) Felix Paul Kühne, 2012-2017
set -e
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_STATIC_FRAMEWORK=no
SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
SDK_MIN=10.0
VERBOSE=no
DEBUG=no
CONFIGURATION="Release"
NONETWORK=no
SKIPLIBVLCCOMPILATION=no
SCARY=yes
TVOS=no
MACOS=no
BITCODE=yes
OSVERSIONMINCFLAG=miphoneos-version-min
OSVERSIONMINLDFLAG=ios_version_min
ROOT_DIR=empty
FARCH="all"
TESTEDHASH="origin/custom"
if [ -z "$MAKE_JOBS" ]; then
CORE_COUNT=`sysctl -n machdep.cpu.core_count`
let MAKE_JOBS=$CORE_COUNT+1
fi
usage()
{
cat << EOF
usage: $0 [-s] [-v] [-k sdk]
OPTIONS
-k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
-v Be more verbose
-s Build for simulator
-f Build framework for device and simulator
-d Enable Debug
-n Skip script steps requiring network interaction
-l Skip libvlc compilation
-t Build for tvOS
-x Build for macOS / Mac OS X
-w Build a limited stack of non-scary libraries only
-y Build universal static libraries
-a Build framework for specific arch (all|x86_64|aarch64)
EOF
}
while getopts "hvwsfbdxntlk:a:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
v)
VERBOSE=yes
;;
s)
BUILD_DEVICE=no
BUILD_SIMULATOR=yes
BUILD_STATIC_FRAMEWORK=no
;;
f)
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_STATIC_FRAMEWORK=yes
;;
d) CONFIGURATION="Debug"
DEBUG=yes
;;
w) SCARY="no"
;;
n)
NONETWORK=yes
;;
l)
SKIPLIBVLCCOMPILATION=yes
;;
k)
SDK=$OPTARG
;;
a)
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_STATIC_FRAMEWORK=yes
FARCH=$OPTARG
;;
t)
TVOS=yes
BITCODE=yes
SDK_VERSION=`xcrun --sdk appletvos --show-sdk-version`
SDK_MIN=10.0
OSVERSIONMINCFLAG=mtvos-version-min
OSVERSIONMINLDFLAG=tvos_version_min
;;
x)
MACOS=yes
BITCODE=no
SDK_VERSION=`xcrun --sdk macosx --show-sdk-version`
SDK_MIN=10.12
OSVERSIONMINCFLAG=mmacosx-version-min
OSVERSIONMINLDFLAG=macosx_version_min
BUILD_DEVICE=yes
FARCH=x86_64
BUILD_STATIC_FRAMEWORK=no
;;
?)
usage
exit 1
;;
esac
done
shift $(($OPTIND - 1))
out="/dev/null"
if [ "$VERBOSE" = "yes" ]; then
out="/dev/stdout"
fi
if [ "x$1" != "x" ]; then
usage
exit 1
fi
get_actual_arch() {
if [ "$1" = "aarch64" ]; then
echo "arm64"
else
echo "$1"
fi
}
get_arch() {
if [ "$1" = "arm64" ]; then
echo "aarch64"
else
echo "$1"
fi
}
is_simulator_arch() {
if [ "$1" = "x86_64" ];then
return 0
else
return 1
fi
}
spushd()
{
pushd "$1" 2>&1> /dev/null
}
spopd()
{
popd 2>&1> /dev/null
}
info()
{
local green="\033[1;32m"
local normal="\033[0m"
echo "[${green}info${normal}] $1"
}
buildxcodeproj()
{
local target="$2"
local PLATFORM="$3"
info "Building $1 ($target, ${CONFIGURATION}, $PLATFORM)"
local architectures=""
if [ "$FARCH" = "all" ];then
if [ "$TVOS" != "yes" ]; then
if [ "$PLATFORM" = "iphonesimulator" ]; then
architectures="x86_64"
else
architectures="arm64"
fi
else
if [ "$PLATFORM" = "appletvsimulator" ]; then
architectures="x86_64"
else
architectures="arm64"
fi
fi
else
architectures=`get_actual_arch $FARCH`
fi
local bitcodeflag=""
if [ "$BITCODE" = "yes" ]; then
bitcodeflag="BITCODE_GENERATION_MODE=bitcode"
fi
local defs="$GCC_PREPROCESSOR_DEFINITIONS"
if [ "$SCARY" = "no" ]; then
defs="$defs NOSCARYCODECS"
fi
xcodebuild -project "$1.xcodeproj" \
-target "$target" \
-sdk $PLATFORM$SDK \
-configuration ${CONFIGURATION} \
ARCHS="${architectures}" \
IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} \
GCC_PREPROCESSOR_DEFINITIONS="$defs" \
${bitcodeflag} \
> ${out}
}
# Get root dir
spushd .
ROOT_DIR=`pwd`
spopd
VLCROOT=${ROOT_DIR}/libvlc/vlc
export PATH="/usr/local/opt/m4/bin:/usr/local/opt/bison/bin/:/usr/local/bin:${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
info "Preparing build dirs"
mkdir -p libvlc
spushd libvlc
echo `pwd`
if [ "$NONETWORK" != "yes" ]; then
if ! [ -e vlc ]; then
git clone -b custom --depth=1 https://github.com/Harekaze/vlc.git vlc
info "Applying patches to vlc.git"
cd vlc
git checkout -B localBranch ${TESTEDHASH}
git branch --set-upstream-to=origin/custom localBranch
git am ${ROOT_DIR}/Resources/MobileVLCKit/patches/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
else
cd vlc
git pull --rebase
git reset --hard ${TESTEDHASH}
git am ${ROOT_DIR}/Resources/MobileVLCKit/patches/*.patch
cd ..
fi
fi
spopd
#
# Build time
#
out="/dev/null"
if [ "$VERBOSE" = "yes" ]; then
out="/dev/stdout"
fi
if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
info "Building tools"
mkdir -p ${VLCROOT}/extras/tools/build/bin
which glibtool > /dev/null
if [ "$?" -eq 0 ]; then
ln -s $(which glibtool) ${VLCROOT}/extras/tools/build/bin/libtool
ln -s $(which glibtoolize) ${VLCROOT}/extras/tools/build/bin/libtoolize
fi
spushd ${ROOT_DIR}/libvlc/vlc/extras/tools
./bootstrap
make
make .gas
spopd #libvlc/vlc/extras/tools
fi
buildLibVLC() {
VERBOSE="$1"
DEBUG="$2"
SCARY="$3"
BITCODE="$4"
ARCH="$5"
TVOS="$6"
MACOS="$7"
SDK_VERSION="$8"
PLATFORM="$9"
OSSTYLE=iPhone
if [ "$DEBUG" = "yes" ]; then
OPTIM="-O0 -g"
else
OPTIM="-O3 -g"
fi
if [ "$TVOS" = "yes" ]; then
OSSTYLE=AppleTV
fi
if [ "$MACOS" = "yes" ]; then
OSSTYLE=MacOSX
PLATFORM=
fi
ACTUAL_ARCH=`get_actual_arch $ARCH`
info "Compiling ${ARCH} with SDK version ${SDK_VERSION}, platform ${PLATFORM}"
SDKROOT=`xcode-select -print-path`/Platforms/${OSSTYLE}${PLATFORM}.platform/Developer/SDKs/${OSSTYLE}${PLATFORM}${SDK_VERSION}.sdk
if [ ! -d "${SDKROOT}" ]
then
echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
exit 1
fi
BUILDDIR="${VLCROOT}/build-${OSSTYLE}${PLATFORM}/${ACTUAL_ARCH}"
PREFIX="${VLCROOT}/install-${OSSTYLE}${PLATFORM}/${ACTUAL_ARCH}"
TARGET="${ARCH}-apple-darwin14"
# clean the environment
export CFLAGS=""
export CPPFLAGS=""
export CXXFLAGS=""
export OBJCFLAGS=""
export LDFLAGS=""
export PLATFORM=$PLATFORM
export SDK_VERSION=$SDK_VERSION
export VLCSDKROOT=$SDKROOT
CFLAGS="-isysroot ${SDKROOT} -arch ${ACTUAL_ARCH} ${OPTIM}"
OBJCFLAGS="${OPTIM}"
if [ "$PLATFORM" = "OS" ]; then
if [ "$ARCH" != "aarch64" ]; then
CFLAGS+=" -mcpu=cortex-a8 -${OSVERSIONMINCFLAG}=${SDK_MIN}"
else
CFLAGS+=" -${OSVERSIONMINCFLAG}=${SDK_MIN}"
fi
else
CFLAGS+=" -${OSVERSIONMINCFLAG}=${SDK_MIN}"
fi
if [ "$BITCODE" = "yes" ]; then
CFLAGS+=" -fembed-bitcode"
fi
export CFLAGS="${CFLAGS}"
export CXXFLAGS="${CFLAGS}"
export CPPFLAGS="${CFLAGS}"
export OBJCFLAGS="${OBJCFLAGS}"
if [ "$PLATFORM" = "Simulator" ]; then
# Use the new ABI on simulator, else we can't build
export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
fi
export LDFLAGS="-arch ${ACTUAL_ARCH}"
if [ "$PLATFORM" = "OS" ]; then
EXTRA_CFLAGS="-arch ${ACTUAL_ARCH}"
EXTRA_LDFLAGS="-arch ${ACTUAL_ARCH}"
if [ "$ARCH" != "aarch64" ]; then
EXTRA_CFLAGS+=" -mcpu=cortex-a8"
EXTRA_CFLAGS+=" -${OSVERSIONMINCFLAG}=${SDK_MIN}"
EXTRA_LDFLAGS+=" -Wl,-${OSVERSIONMINLDFLAG},${SDK_MIN}"
export LDFLAGS="${LDFLAGS} -Wl,-${OSVERSIONMINLDFLAG},${SDK_MIN}"
else
EXTRA_CFLAGS+=" -${OSVERSIONMINCFLAG}=${SDK_MIN}"
EXTRA_LDFLAGS+=" -Wl,-${OSVERSIONMINLDFLAG},${SDK_MIN}"
export LDFLAGS="${LDFLAGS} -Wl,-${OSVERSIONMINLDFLAG},${SDK_MIN}"
fi
else
EXTRA_CFLAGS="-arch ${ARCH}"
EXTRA_CFLAGS+=" -${OSVERSIONMINCFLAG}=${SDK_MIN}"
EXTRA_LDFLAGS=" -Wl,-${OSVERSIONMINLDFLAG},${SDK_MIN}"
export LDFLAGS="${LDFLAGS} -v -Wl,-${OSVERSIONMINLDFLAG},${SDK_MIN}"
fi
spushd ${VLCROOT}/contrib
info "Compiling third-party libraries"
mkdir -p "${VLCROOT}/contrib/${OSSTYLE}${PLATFORM}-${ARCH}"
cd "${VLCROOT}/contrib/${OSSTYLE}${PLATFORM}-${ARCH}"
if [ "$PLATFORM" = "OS" ]; then
export AS="gas-preprocessor.pl ${CC}"
export ASCPP="gas-preprocessor.pl ${CC}"
export CCAS="gas-preprocessor.pl ${CC}"
if [ "$ARCH" = "aarch64" ]; then
export GASPP_FIX_XCODE5=1
fi
else
export ASCPP="xcrun as"
fi
CUSTOMOSOPTIONS="--disable-libarchive --disable-fontconfig --disable-bghudappkit --disable-twolame --disable-microdns --disable-SDL --disable-SDL_image --disable-cddb --disable-bluray"
if [ "${TARGET}" = "x86_64-apple-darwin14" ];then
BUILD=""
else
BUILD="--build=x86_64-apple-darwin14"
fi
if [ "$MACOS" = "yes" ]; then
# The following symbols do not exist on the minimal macOS version (10.7), so they are disabled
# here. This allows compilation also with newer macOS SDKs.
# Added symbols in 10.13
export ac_cv_func_open_wmemstream=no
export ac_cv_func_fmemopen=no
export ac_cv_func_open_memstream=no
export ac_cv_func_futimens=no
export ac_cv_func_utimensat=no
# Added symbols between 10.11 and 10.12
export ac_cv_func_basename_r=no
export ac_cv_func_clock_getres=no
export ac_cv_func_clock_gettime=no
export ac_cv_func_clock_settime=no
export ac_cv_func_dirname_r=no
export ac_cv_func_getentropy=no
export ac_cv_func_mkostemp=no
export ac_cv_func_mkostemps=no
# Added symbols between 10.7 and 10.11
export ac_cv_func_ffsll=no
export ac_cv_func_flsll=no
export ac_cv_func_fdopendir=no
export ac_cv_func_openat=no
export ac_cv_func_fstatat=no
export ac_cv_func_readlinkat=no
else
# The following symbols do not exist on the minimal iOS version (7.0), so they are disabled
# here. This allows compilation also with newer iOS SDKs
# Added symbols between 7.x and 10.x
export ac_cv_func_basename_r=no
export ac_cv_func_clock_getres=no
export ac_cv_func_clock_gettime=no
export ac_cv_func_clock_settime=no
export ac_cv_func_dirname_r=no
export ac_cv_func_getentropy=no
export ac_cv_func_mkostemp=no
export ac_cv_func_mkostemps=no
export ac_cv_func_open_memstream=no
export ac_cv_func_futimens=no
fi
export USE_FFMPEG=1
../bootstrap ${BUILD} --host=${TARGET} --prefix=${VLCROOT}/contrib/${OSSTYLE}-${TARGET}-${ARCH} --disable-gpl \
--enable-ad-clauses \
--disable-disc --disable-sout \
--disable-sdl \
--disable-SDL_image \
--disable-iconv \
--disable-zvbi \
--disable-kate \
--disable-caca \
--disable-gettext \
--disable-mpcdec \
--disable-upnp \
--disable-gme \
--disable-srt \
--disable-tremor \
--disable-vorbis \
--disable-sidplay2 \
--disable-samplerate \
--disable-goom \
--disable-vncserver \
--disable-orc \
--disable-schroedinger \
--disable-libmpeg2 \
--disable-chromaprint \
--disable-mad \
--disable-live555 \
--disable-fribidi \
--disable-libxml2 \
--enable-freetype2 \
--disable-ass \
--disable-fontconfig \
--disable-gpg-error \
--disable-vncclient \
--disable-gnutls \
--disable-lua \
--disable-luac \
--disable-protobuf \
--enable-aribb24 \
--disable-aribb25 \
--disable-archive \
--disable-vpx \
--disable-libdsm \
--disable-libplacebo \
--disable-sparkle \
--disable-growl \
--disable-breakpad \
--disable-ncurses \
--disable-asdcplib \
${CUSTOMOSOPTIONS} \
--disable-a52 \
--disable-aom \
--disable-bpg \
--disable-crystalhd \
--disable-d3d11 \
--disable-d3d9 \
--disable-daala \
--disable-dca \
--disable-directx \
--disable-dshow \
--disable-dvdcss \
--disable-dvdnav \
--disable-dvdread \
--disable-ebml \
--disable-faad2 \
--disable-ffi \
--disable-flac \
--disable-fluid \
--disable-fluidlite \
--disable-gcrypt \
--disable-glew \
--disable-glib \
--disable-gmp \
--disable-gsm \
--disable-harfbuzz \
--disable-jack \
--disable-jpeg \
--disable-lame \
--disable-libtasn1 \
--disable-matroska \
--disable-mfx \
--disable-modplug \
--disable-mpg123 \
--disable-mysofa \
--disable-nettle \
--disable-nfs \
--disable-ogg \
--disable-openjpeg \
--disable-opus \
--disable-png \
--disable-postproc \
--disable-projectM \
--disable-pthreads \
--disable-qt \
--disable-qtsvg \
--disable-regex \
--disable-shout \
--disable-soxr \
--disable-spatialaudio \
--disable-speex \
--disable-speexdsp \
--disable-sqlite \
--disable-ssh2 \
--disable-theora \
--disable-tiff \
--disable-tiger \
--disable-x264 \
--disable-x265 \
--disable-xau \
--disable-xcb-proto \
--disable-xcb \
--disable-xorg-macros \
--disable-xproto \
--disable-taglib > ${out} 2> ${out}
echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
make fetch -j$MAKE_JOBS
make -j$MAKE_JOBS > ${out}
spopd # ${VLCROOT}/contrib
if ! [ -e ${VLCROOT}/configure ]; then
info "Bootstraping vlc"
${VLCROOT}/bootstrap > ${out}
fi
mkdir -p ${BUILDDIR}
spushd ${BUILDDIR}
if [ "$DEBUG" = "yes" ]; then
DEBUGFLAG="--enable-debug"
else
export CFLAGS="${CFLAGS} -DNDEBUG"
fi
if [ "$SCARY" = "yes" ]; then
SCARYFLAG="--enable-dvbpsi --enable-avcodec --disable-vpx"
else
SCARYFLAG="--disable-dca --disable-dvbpsi --disable-avcodec --disable-avformat --disable-zvbi --disable-vpx"
fi
export ac_cv_arm_neon=no
# Available but not authorized
export ac_cv_func_daemon=no
export ac_cv_func_fork=no
if [ "${VLCROOT}/configure" -nt config.log -o \
"${THIS_SCRIPT_PATH}" -nt config.log ]; then
info "Configuring vlc"
${VLCROOT}/configure \
--prefix="${PREFIX}" \
--host="${TARGET}" \
--with-contrib="${VLCROOT}/contrib/${OSSTYLE}-${TARGET}-${ARCH}" \
--enable-static \
${DEBUGFLAG} \
${SCARYFLAG} \
--disable-macosx \
--disable-macosx-qtkit \
--disable-macosx-avfoundation \
--disable-shared \
--disable-archive \
--disable-opus \
--disable-faad \
--disable-lua \
--disable-a52 \
--disable-fribidi \
--disable-qt --disable-skins2 \
--disable-vcd \
--disable-vlc \
--disable-vlm \
--disable-httpd \
--disable-nls \
--disable-sse \
--disable-notify \
--disable-live555 \
--disable-realrtsp \
--enable-swscale \
--disable-projectm \
--disable-libass \
--enable-aribsub \
--disable-libxml2 \
--disable-goom \
--disable-dvdread \
--disable-dvdnav \
--disable-bluray \
--disable-linsys \
--disable-libva \
--disable-libcddb \
--disable-gme \
--disable-tremor \
--disable-vorbis \
--disable-fluidsynth \
--disable-jack \
--disable-pulse \
--disable-mtp \
--disable-ogg \
--disable-speex \
--disable-theora \
--disable-flac \
--disable-screen \
--enable-freetype \
--disable-taglib \
--disable-mmx \
--disable-sparkle \
--disable-addonmanagermodules \
--disable-mad > ${out}
fi
info "Building libvlc"
make -j$MAKE_JOBS > ${out}
info "Installing libvlc"
make install > ${out}
find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
rm -rf "${PREFIX}/contribs"
cp -R "${VLCROOT}/contrib/${OSSTYLE}-${TARGET}-${ARCH}" "${PREFIX}/contribs"
info "Removing unneeded modules"
blacklist="
stats
access_bd
shm
access_imem
oldrc
real
hotkeys
gestures
dynamicoverlay
rss
ball
marq
magnify
audiobargraph_
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
logger
visual
fb
aout_file
dummy
invert
sepia
wave
hqdn3d
headphone_channel_mixer
gaussianblur
gradfun
extract
colorthres
antiflicker
anaglyph
remap
oldmovie
vhs
demuxdump
fingerprinter
output_udp
output_http
output_livehttp
libmux
stream_out
"
if [ "$SCARY" = "no" ]; then
blacklist="${blacklist}
dts
dvbsub
svcd
hevc
packetizer_mlp
a52
vc1
uleaddvaudio
librar
libvoc
avio
chorus_flanger
smooth
cvdsub
libmod
libdash
libmpgv
dolby_surround
mpegaudio"
fi
echo ${blacklist}
for i in ${blacklist}
do
find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;
done
spopd
}
buildMobileKit() {
PLATFORM="$1"
if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
if [ "$TVOS" = "yes" ]; then
# this variable is read by libvlc's contrib build script
# to create the required build environment
# for historical raisons, tvOS is a special flavor of iOS
# so we need to export both variables
export BUILDFORIOS="yes"
export BUILDFORTVOS="yes"
info "Building libvlc for tvOS"
else
if [ "$MACOS" = "yes" ]; then
# macOS is the default build environment for libvlc's contrib
# build scripts, so we don't need to export anything
info "Building libvlc for macOS"
else
# this variable is read by libvlc's contrib build script
# to create the required build environment
export BUILDFORIOS="yes"
info "Building libvlc for iOS"
fi
fi
export AR=`xcrun -f ar`
export RANLIB=`xcrun -f ranlib`
export CC=`xcrun -f clang`
export OBJC=`xcrun -f clang`
export CXX=`xcrun -f clang++`
export LD=`xcrun -f ld`
export STRIP=`xcrun -f strip`
export CPPFLAGS=-E
export CXXCPPFLAGS=-E
unset AS
unset CCAS
if [ "$FARCH" = "all" ];then
if [ "$TVOS" = "yes" ]; then
if [ "$PLATFORM" = "iphonesimulator" ]; then
buildLibVLC $VERBOSE $DEBUG $SCARY $BITCODE "x86_64" $TVOS $MACOS $SDK_VERSION "Simulator"
else
buildLibVLC $VERBOSE $DEBUG $SCARY $BITCODE "aarch64" $TVOS $MACOS $SDK_VERSION "OS"
fi
else
if [ "$MACOS" = "yes" ]; then
buildLibVLC $VERBOSE $DEBUG $SCARY $BITCODE "x86_64" $TVOS $MACOS $SDK_VERSION "OS"
else
if [ "$PLATFORM" = "iphonesimulator" ]; then
buildLibVLC $VERBOSE $DEBUG $SCARY $BITCODE "x86_64" $TVOS $MACOS $SDK_VERSION "Simulator"
else
buildLibVLC $VERBOSE $DEBUG $SCARY $BITCODE "aarch64" $TVOS $MACOS $SDK_VERSION "OS"
fi
fi
fi
else
if [ "$FARCH" != "x86_64" -a "$FARCH" != "aarch64" ];then
echo "*** Framework ARCH: ${FARCH} is invalid ***"
exit 1
fi
local buildPlatform=""
if [ "$PLATFORM" = "iphonesimulator" ]; then
if [ "$FARCH" == "x86_64" ];then
buildPlatform="Simulator"
fi
else
if [ "$FARCH" == "aarch64" ];then
buildPlatform="OS"
fi
fi
if [ ! -z "$buildPlatform" ];then
buildLibVLC $VERBOSE $DEBUG $SCARY $BITCODE $FARCH $TVOS $MACOS $SDK_VERSION $buildPlatform
fi
fi
fi
}
if [ "$BUILD_DEVICE" != "no" ]; then
buildMobileKit iphoneos
fi
if [ "$BUILD_SIMULATOR" != "no" ]; then
buildMobileKit iphonesimulator
fi
DEVICEARCHS=""
SIMULATORARCHS=""
doVLCLipo() {
FILEPATH="$1"
FILE="$2"
PLUGIN="$3"
OSSTYLE="$4"
files=""
info "...$FILEPATH$FILE"
for i in $DEVICEARCHS
do
actual_arch=`get_actual_arch $i`
files="install-"$OSSTYLE"OS/$actual_arch/lib/$FILEPATH$FILE $files"
done
for i in $SIMULATORARCHS
do
actual_arch=`get_actual_arch $i`
files="install-"$OSSTYLE"Simulator/$actual_arch/lib/$FILEPATH$FILE $files"
done
if [ "$PLUGIN" != "no" ]; then
lipo $files -create -output install-$OSSTYLE/plugins/$FILE
else
lipo $files -create -output install-$OSSTYLE/core/$FILE
fi
}
doContribLipo() {
LIBNAME="$1"
OSSTYLE="$2"
files=""
info "...$LIBNAME"
for i in $DEVICEARCHS $SIMULATORARCHS
do
files="contrib/$OSSTYLE-$i-apple-darwin14-$i/lib/$LIBNAME $files"
done
lipo $files -create -output install-$OSSTYLE/contrib/$LIBNAME
}
get_symbol()
{
echo "$1" | grep vlc_entry_$2|cut -d" " -f 3|sed 's/_vlc/vlc/'
}
build_universal_static_lib() {
PROJECT_DIR=`pwd`
OSSTYLE="$1"
info "building universal static libs for OS style $OSSTYLE"
# remove old module list
rm -f $PROJECT_DIR/Resources/MobileVLCKit/vlc-plugins-$OSSTYLE.h
rm -f $PROJECT_DIR/Resources/MobileVLCKit/vlc-plugins-$OSSTYLE.xcconfig
touch $PROJECT_DIR/Resources/MobileVLCKit/vlc-plugins-$OSSTYLE.h
touch $PROJECT_DIR/Resources/MobileVLCKit/vlc-plugins-$OSSTYLE.xcconfig
if [ "$OSSTYLE" != "MacOSX" ]; then
spushd libvlc/vlc
rm -rf install-$OSSTYLE
mkdir install-$OSSTYLE
mkdir install-$OSSTYLE/core
mkdir install-$OSSTYLE/contrib
mkdir install-$OSSTYLE/plugins
spopd # vlc
else
spushd libvlc/vlc/install-$OSSTYLE
rm -rf core
rm -rf contrib
rm -rf plugins
ln -s x86_64/lib core
ln -s x86_64/contribs/lib contrib
ln -s x86_64/lib/vlc/plugins plugins
spopd # vlc
fi
VLCMODULES=""
SIMULATORARCHS=""
CONTRIBLIBS=""
DEVICEARCHS=""
# arm64 got the lowest number of modules
arch="aarch64"
if [ "$FARCH" != "all" ];then
arch="$FARCH"
fi
actual_arch=`get_actual_arch $arch`
if [ -d libvlc/vlc/install-"$OSSTYLE"OS ];then
spushd libvlc/vlc/install-"$OSSTYLE"OS
for i in `ls .`
do
local iarch="`get_arch $i`"
if [ "$FARCH" == "all" -o "$FARCH" = "$iarch" ];then
DEVICEARCHS="$DEVICEARCHS $iarch"
fi
done
if (! is_simulator_arch $arch);then
echo "IPHONE OS: $arch"
spushd $actual_arch/lib/vlc/plugins
for i in `ls *.a`
do
VLCMODULES="$i $VLCMODULES"
done
spopd # $actual_arch/lib/vlc/plugins
fi
spopd # vlc-install-"$OSSTYLE"OS
fi
if [ -d libvlc/vlc/install-"$OSSTYLE"Simulator ];then
spushd libvlc/vlc/install-"$OSSTYLE"Simulator
if (is_simulator_arch $arch);then
echo "SIMU OS: $arch"
spushd $actual_arch/lib/vlc/plugins
for i in `ls *.a`
do
VLCMODULES="$i $VLCMODULES"
done
spopd # $actual_arch/lib/vlc/plugins
fi
for i in `ls .`
do
local iarch="`get_arch $i`"
if [ "$FARCH" == "all" -o "$FARCH" = "$iarch" ];then
SIMULATORARCHS="$SIMULATORARCHS $iarch"