-
Notifications
You must be signed in to change notification settings - Fork 137
/
compileAndBuildVLCKit.sh
executable file
·751 lines (672 loc) · 21.4 KB
/
compileAndBuildVLCKit.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
#!/bin/sh
# Copyright (C) Pierre d'Herbemont, 2010
# Copyright (C) Felix Paul Kühne, 2012-2024
set -e
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_FRAMEWORK=no
SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
SDK_MIN=9.0
VERBOSE=no
DISABLEDEBUG=no
CONFIGURATION="Debug"
NONETWORK=no
SKIPLIBVLCCOMPILATION=no
TVOS=no
MACOS=no
IOS=yes
XROS=no
WATCHOS=no
BITCODE=no
INCLUDE_ARMV7=no
OSVERSIONMINCFLAG=iphoneos
OSVERSIONMINLDFLAG=ios
ROOT_DIR=empty
FARCH="all"
if [ -z "$MAKEFLAGS" ]; then
MAKEFLAGS="-j$(sysctl -n machdep.cpu.core_count || nproc)";
fi
TESTEDHASH="2f08e3cc" # libvlc hash that this version of VLCKit is build on
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
-r Disable Debug for Release
-n Skip script steps requiring network interaction
-l Skip libvlc compilation
-t Build for tvOS
-x Build for macOS / Mac OS X
-i Build for xrOS / visionOS
-w Build for watchOS
-b Enable bitcode
-a Build framework for specific arch (all|x86_64|armv7|aarch64)
-e External VLC source path
-7 Include optional ARMv7 slice (iOS only)
EOF
}
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 PLATFORM="$2"
local PLATFORMNAME="$3"
info "Building $1 (${CONFIGURATION}, $PLATFORM)"
local architectures=""
if [ "$FARCH" = "all" ];then
if [ "$TVOS" = "yes" ]; then
if [ "$PLATFORM" = "appletvsimulator" ]; then
architectures="x86_64 arm64"
else
architectures="arm64"
fi
fi
if [ "$IOS" = "yes" ]; then
if [ "$PLATFORM" = "iphonesimulator" ]; then
architectures="x86_64 arm64"
else
if [ "$INCLUDE_ARMV7" = "yes" ]; then
architectures="armv7 arm64"
else
architectures="arm64"
fi
fi
fi
if [ "$MACOS" = "yes" ]; then
architectures="arm64 x86_64"
fi
if [ "$XROS" = "yes" ]; then
architectures="arm64"
fi
if [ "$WATCHOS" = "yes" ]; then
if [ "$PLATFORM" = "watchsimulator" ]; then
architectures="x86_64 arm64"
else
architectures="arm64_32"
fi
fi
else
architectures=`get_actual_arch $FARCH`
fi
local bitcodeflag=""
if [ "$IOS" = "yes" ]; then
if [ "$BITCODE" = "yes" ]; then
info "Bitcode enabled"
bitcodeflag="BITCODE_GENERATION_MODE=bitcode"
else
info "Bitcode disabled"
bitcodeflag="BITCODE_GENERATION_MODE=none ENABLE_BITCODE=no"
fi
fi
if [ "$TVOS" = "yes" ]; then
if [ "$BITCODE" = "yes" ]; then
bitcodeflag="BITCODE_GENERATION_MODE=bitcode"
fi
fi
local verboseflag=""
if [ "$VERBOSE" = "yes" ]; then
verboseflag="-verbose"
fi
local deploymentTargetFlag=""
if [ "$XROS" != "yes" ]; then
deploymentTargetFlag="IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN}"
fi
local defs="$GCC_PREPROCESSOR_DEFINITIONS"
xcodebuild archive \
-project "$1.xcodeproj" \
-sdk $PLATFORM$SDK \
-configuration ${CONFIGURATION} \
-scheme "VLCKit" \
-destination "generic/platform=${PLATFORMNAME}" \
-archivePath build/VLCKit-$PLATFORM$SDK.xcarchive \
ARCHS="${architectures}" \
${deploymentTargetFlag} \
${bitcodeflag} \
${verboseflag} \
SKIP_INSTALL=no \
ONLY_ACTIVE_ARCH=NO \
> ${out}
}
buildLibVLC() {
ARCH="$1"
PLATFORM="$2"
if [ "$DISABLEDEBUG" = "yes" ]; then
DEBUGFLAG="--disable-debug"
else
DEBUGFLAG=""
fi
if [ "$VERBOSE" = "yes" ]; then
VERBOSEFLAG="--verbose"
else
VERBOSEFLAG=""
fi
if [ "$BITCODE" = "yes" ]; then
if [[ "$PLATFORM" == *"os"* ]]; then
BITCODEFLAG="--enable-bitcode"
else
BITCODEFLAG=""
fi
else
BITCODEFLAG=""
fi
info "Compiling ${ARCH} with SDK version ${SDK_VERSION}, platform ${PLATFORM}"
ACTUAL_ARCH=`get_actual_arch $ARCH`
BUILDDIR="${VLCROOT}/build-${PLATFORM}-${ACTUAL_ARCH}"
mkdir -p ${BUILDDIR}
spushd ${BUILDDIR}
../extras/package/apple/build.sh --arch=$ARCH --sdk=${PLATFORM}${SDK_VERSION} ${DEBUGFLAG} ${VERBOSEFLAG} ${BITCODEFLAG} ${MAKEFLAGS}
spopd # builddir
info "Finished compiling libvlc for ${ARCH} with SDK version ${SDK_VERSION}, platform ${PLATFORM}"
}
buildMobileKit() {
PLATFORM="$1"
if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
if [ "$FARCH" = "all" ];then
if [ "$TVOS" = "yes" ]; then
if [ "$PLATFORM" = "iphonesimulator" ]; then
buildLibVLC "x86_64" "appletvsimulator"
buildLibVLC "aarch64" "appletvsimulator"
else
buildLibVLC "aarch64" "appletvos"
fi
fi
if [ "$MACOS" = "yes" ]; then
buildLibVLC "aarch64" "macosx"
buildLibVLC "x86_64" "macosx"
fi
if [ "$XROS" = "yes" ]; then
info "building for xrOS"
buildLibVLC "aarch64" "xros"
buildLibVLC "aarch64" "xrsimulator"
# there is no xrSimulator for the Intel platform
fi
if [ "$WATCHOS" = "yes" ]; then
info "building for watchOS"
buildLibVLC "arm64_32" "watchos"
buildLibVLC "x86_64" "watchsimulator"
buildLibVLC "aarch64" "watchsimulator"
fi
if [ "$IOS" = "yes" ]; then
if [ "$PLATFORM" = "iphonesimulator" ]; then
buildLibVLC "x86_64" $PLATFORM
buildLibVLC "aarch64" $PLATFORM
else
if [ "$INCLUDE_ARMV7" = "yes" ]; then
buildLibVLC "armv7" $PLATFORM
fi
buildLibVLC "aarch64" $PLATFORM
fi
fi
else
if [ "$FARCH" != "x86_64" -a "$FARCH" != "aarch64" -a "$FARCH" != "armv7" ];then
echo "*** Framework ARCH: ${FARCH} is invalid ***"
exit 1
fi
if (is_simulator_arch $FARCH);then
if [ "$TVOS" = "yes" ]; then
PLATFORM="appletvsimulator"
fi
if [ "$IOS" = "yes" ]; then
PLATFORM="iphonesimulator"
fi
if [ "$MACOS" = "yes" ]; then
PLATFORM="macosx"
fi
if [ "$XROS" = "yes" ]; then
PLATFORM="xrsimulator"
fi
if [ "$WATCHOS" = "yes" ]; then
PLATFORM="watchsimulator"
fi
else
if [ "$TVOS" = "yes" ]; then
PLATFORM="appletvos"
fi
if [ "$IOS" = "yes" ]; then
PLATFORM="iphoneos"
fi
if [ "$MACOS" = "yes" ]; then
PLATFORM="macosx"
fi
if [ "$XROS" = "yes" ]; then
PLATFORM="xros"
fi
if [ "$WATCHOS" = "yes" ]; then
PLATFORM="watchos"
fi
fi
buildLibVLC $FARCH "$PLATFORM"
fi
fi
}
get_symbol()
{
echo "$1" | grep vlc_entry_$2|cut -d" " -f 3|sed 's/_vlc/vlc/'
}
function check_lipo {
os_style="$1"
os_arch="$2"
header=""
if [ -z "${os_style%%*simulator}" ]; then
header=vlc-plugins-${os_style%simulator}-simulator-${os_arch}.h
else
header=vlc-plugins-${os_style%os}-device-${os_arch}.h
fi
build_dir="${VLCROOT}/build-${os_style}-${os_arch}"
if [ -d "${build_dir}" ]; then
VLCSTATICLIBS+=" ${build_dir}/${VLCSTATICLIBRARYNAME}"
VLCSTATICMODULELIST="${build_dir}/static-lib/static-module-list.c"
cp $VLCSTATICMODULELIST $PROJECT_DIR/Headers/Internal/${header}
else
echo "Directory ${build_dir} doesn't exist"
fi
}
build_simulator_static_lib() {
PROJECT_DIR=`pwd`
OSSTYLE="$1"
info "building simulator static lib for $OSSTYLE"
# remove old module list
rm -f $PROJECT_DIR/Headers/Internal/vlc-plugins-$OSSTYLE-simulator.h
touch $PROJECT_DIR/Headers/Internal/vlc-plugins-$OSSTYLE-simulator.h
spushd ${VLCROOT}
rm -rf install-$OSSTYLE-simulator
mkdir install-$OSSTYLE-simulator
spopd # vlc
VLCSTATICLIBS=""
VLCSTATICLIBRARYNAME="static-lib/libvlc-full-static.a"
VLCSTATICMODULELIST=""
# brute-force test the available architectures we could lipo
check_lipo "${OSSTYLE}simulator" x86_64
check_lipo "${OSSTYLE}simulator" arm64
# watch and XR is not -simulator suffixed in the script unfortunately.
check_lipo "${OSSTYLE}" arm64
check_lipo "${OSSTYLE}" x86_64
if [ ! -z "${VLCSTATICLIBS}" ]; then
spushd ${VLCROOT}
lipo $VLCSTATICLIBS -create -output install-$OSSTYLE-simulator/libvlc-simulator-static.a
spopd # VLCROOT
fi
}
build_device_static_lib() {
PROJECT_DIR=`pwd`
OSSTYLE="$1"
info "building device static lib for $OSSTYLE"
# remove old module list
rm -f $PROJECT_DIR/Headers/Internal/vlc-plugins-$OSSTYLE-device*
spushd ${VLCROOT}
rm -rf install-$OSSTYLE-device
mkdir install-$OSSTYLE-device
spopd # vlc
VLCSTATICLIBS=""
VLCSTATICLIBRARYNAME="static-lib/libvlc-full-static.a"
VLCSTATICMODULELIST=""
# brute-force test the available architectures we could lipo
check_lipo "${OSSTYLE}os" arm64
if [ "$IOS" = "yes" ]; then
check_lipo "${OSSTYLE}os" armv7
fi
if [ "$WATCHOS" = "yes" ]; then
check_lipo "${OSSTYLE}" arm64_32
fi
# macosx and XR are not -os or -simulator suffixed in the script unfortunately.
check_lipo "${OSSTYLE}" x86_64
check_lipo "${OSSTYLE}" arm64
if [ ! -z "${VLCSTATICLIBS}" ]; then
spushd ${VLCROOT}
lipo $VLCSTATICLIBS -create -output install-$OSSTYLE-device/libvlc-device-static.a
spopd # VLCROOT
fi
}
while getopts "hvsfbrxiwntl7k:a:e:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
v)
VERBOSE=yes
;;
s)
BUILD_DEVICE=no
BUILD_SIMULATOR=yes
BUILD_FRAMEWORK=no
;;
f)
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_FRAMEWORK=yes
;;
r) CONFIGURATION="Release"
DISABLEDEBUG=yes
;;
n)
NONETWORK=yes
;;
l)
SKIPLIBVLCCOMPILATION=yes
;;
k)
SDK=$OPTARG
;;
a)
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_FRAMEWORK=yes
FARCH=$OPTARG
;;
b)
BITCODE=yes
;;
t)
TVOS=yes
IOS=no
SDK_VERSION=`xcrun --sdk appletvos --show-sdk-version`
SDK_MIN=10.2
OSVERSIONMINCFLAG=tvos
OSVERSIONMINLDFLAG=tvos
;;
x)
MACOS=yes
IOS=no
BITCODE=no
SDK_VERSION=`xcrun --sdk macosx --show-sdk-version`
SDK_MIN=10.11
OSVERSIONMINCFLAG=macosx
OSVERSIONMINLDFLAG=macosx
BUILD_DEVICE=yes
BUILD_FRAMEWORK=yes
;;
i)
XROS=yes
IOS=no
BITCODE=no
SDK_VERSION=`xcrun --sdk xros --show-sdk-version`
SDK_MIN=1.0
OSVERSIONMINCFLAG=xros
OSVERSIONMINLDFLAG=xros
BUILD_DEVICE=yes
BUILD_FRAMEWORK=yes
;;
w)
WATCHOS=yes
IOS=no
BITCODE=no
SDK_VERSION=`xcrun --sdk watchos --show-sdk-version`
SDK_MIN=7.4
OSVERSIONMINCFLAG=watchos
OSVERSIONMINLDFLAG=watchos
BUILD_DEVICE=yes
BUILD_FRAMEWORK=yes
;;
e)
VLCROOT=$OPTARG
;;
7)
INCLUDE_ARMV7=yes
;;
?)
usage
exit 1
;;
esac
done
shift $(($OPTIND - 1))
out="/dev/null"
if [ "$VERBOSE" = "yes" ]; then
out="/dev/stdout"
fi
if [ "$1" != "" ]; then
usage
exit 1
fi
# Get root dir
spushd .
ROOT_DIR=`pwd`
spopd
if [ "$VLCROOT" = "" ]; then
VLCROOT=${ROOT_DIR}/libvlc/vlc
info "Preparing build dirs"
mkdir -p libvlc
spushd libvlc
if [ "$NONETWORK" != "yes" ]; then
if ! [ -e vlc ]; then
git clone https://code.videolan.org/videolan/vlc.git --branch master --single-branch vlc
info "Applying patches to vlc.git"
cd vlc
git checkout -B localBranch ${TESTEDHASH}
git branch --set-upstream-to=origin/master localBranch
git am ${ROOT_DIR}/libvlc/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 fetch --all
git reset --hard ${TESTEDHASH}
git am ${ROOT_DIR}/libvlc/patches/*.patch
cd ..
fi
fi
spopd
fi
fetch_python3_path() {
PYTHON3_PATH=$(echo /Library/Frameworks/Python.framework/Versions/3.*/bin | awk '{print $1;}')
if [ ! -d "${PYTHON3_PATH}" ]; then
PYTHON3_PATH=""
fi
}
#
# Build time
#
out="/dev/null"
if [ "$VERBOSE" = "yes" ]; then
out="/dev/stdout"
fi
if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
info "Building tools"
fetch_python3_path
export PATH="${PYTHON3_PATH}:${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:$VLC_PATH:/usr/bin:/bin:/usr/sbin:/sbin"
spushd ${VLCROOT}/extras/tools
./bootstrap
make
spopd #${VLCROOT}/extras/tools
fi
if [ "$BUILD_DEVICE" != "no" ]; then
buildMobileKit iphoneos
fi
if [ "$BUILD_SIMULATOR" != "no" ]; then
buildMobileKit iphonesimulator
fi
DEVICEARCHS=""
SIMULATORARCHS=""
if [ "$TVOS" = "yes" ]; then
build_simulator_static_lib "appletv"
build_device_static_lib "appletv"
fi
if [ "$XROS" = "yes" ]; then
build_simulator_static_lib "xros"
build_device_static_lib "xros"
fi
if [ "$WATCHOS" = "yes" ]; then
build_simulator_static_lib "watch"
build_device_static_lib "watchos"
fi
if [ "$MACOS" = "yes" ]; then
build_device_static_lib "macosx"
fi
if [ "$IOS" = "yes" ]; then
build_simulator_static_lib "iphone"
build_device_static_lib "iphone"
fi
info "all done"
if [ "$BUILD_FRAMEWORK" = "no" ]; then
exit 0
fi
if [ "$TVOS" = "yes" ]; then
info "Building VLCKit.xcframework for tvOS"
frameworks=""
platform=""
if [ "$FARCH" = "all" ] || (! is_simulator_arch $FARCH);then
platform="appletvos"
buildxcodeproj VLCKit ${platform} tvOS
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
bcsymbolmapfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/BCSymbolMaps
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
if [ -d ${bcsymbolmapfolder} ];then
info "Bitcode support found"
spushd $bcsymbolmapfolder
for i in `ls *.bcsymbolmap`
do
frameworks+=" -debug-symbols $bcsymbolmapfolder/$i"
done
spopd
fi
fi
if [ "$FARCH" = "all" ] || (is_simulator_arch $arch);then
platform="appletvsimulator"
buildxcodeproj VLCKit ${platform} "tvOS Simulator"
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
fi
# Assumes both platforms were built currently
spushd build
rm -rf tvOS
mkdir tvOS
xcodebuild -create-xcframework $frameworks -output tvOS/VLCKit.xcframework
spopd # build
info "Build of VLCKit.xcframework for tvOS completed"
fi
if [ "$IOS" = "yes" ]; then
info "Building VLCKit.xcframework for iOS"
frameworks=""
platform=""
if [ "$FARCH" = "all" ] || (! is_simulator_arch $FARCH);then
platform="iphoneos"
buildxcodeproj VLCKit ${platform} iOS
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
bcsymbolmapfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/BCSymbolMaps
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
if [ -d ${bcsymbolmapfolder} ];then
info "Bitcode support found"
spushd $bcsymbolmapfolder
for i in `ls *.bcsymbolmap`
do
frameworks+=" -debug-symbols $bcsymbolmapfolder/$i"
done
spopd
fi
fi
if [ "$FARCH" = "all" ] || (is_simulator_arch $arch);then
platform="iphonesimulator"
buildxcodeproj VLCKit ${platform} "iOS Simulator"
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
fi
# Assumes both platforms were built currently
spushd build
rm -rf iOS
mkdir iOS
xcodebuild -create-xcframework $frameworks -output iOS/VLCKit.xcframework
spopd # build
info "Build of VLCKit.xcframework for iOS completed"
fi
if [ "$XROS" = "yes" ]; then
info "Building VLCKit.xcframework for xrOS"
frameworks=""
platform=""
if [ "$FARCH" = "all" ] || (! is_simulator_arch $FARCH);then
platform="xros"
buildxcodeproj VLCKit ${platform} xrOS
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
fi
if [ "$FARCH" = "all" ] || (is_simulator_arch $arch);then
platform="xrsimulator"
buildxcodeproj VLCKit ${platform} "xrOS Simulator"
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
fi
# Assumes both platforms were built currently
spushd build
rm -rf xrOS
mkdir xrOS
xcodebuild -create-xcframework $frameworks -output xrOS/VLCKit.xcframework
spopd # build
info "Build of VLCKit.xcframework for xrOS completed"
fi
if [ "$WATCHOS" = "yes" ]; then
info "Building VLCKit.xcframework for watchOS"
frameworks=""
platform=""
if [ "$FARCH" = "all" ] || (! is_simulator_arch $FARCH);then
platform="watchos"
buildxcodeproj VLCKit ${platform} watchOS
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
fi
if [ "$FARCH" = "all" ] || (is_simulator_arch $arch);then
platform="watchsimulator"
buildxcodeproj VLCKit ${platform} "watchOS Simulator"
dsymfolder=$PROJECT_DIR/build/VLCKit-${platform}.xcarchive/dSYMs/VLCKit.framework.dSYM
frameworks="$frameworks -framework VLCKit-${platform}.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $dsymfolder"
fi
# Assumes both platforms were built currently
spushd build
rm -rf watchOS
mkdir watchOS
xcodebuild -create-xcframework $frameworks -output watchOS/VLCKit.xcframework
spopd # build
info "Build of VLCKit.xcframework for watchOS completed"
fi
if [ "$MACOS" = "yes" ]; then
CURRENT_DIR=`pwd`
info "Building VLCKit.xcframework for macOS in ${CURRENT_DIR}"
buildxcodeproj VLCKit "macosx" macOS
spushd build
rm -rf macOS
mkdir macOS
xcodebuild -create-xcframework -framework VLCKit-macosx.xcarchive/Products/Library/Frameworks/VLCKit.framework -debug-symbols $PROJECT_DIR/build/VLCKit-macosx.xcarchive/dSYMs/VLCKit.framework.dSYM -output macOS/VLCKit.xcframework
spopd # build
info "Build of VLCKit.xcframework for macOS completed"
fi