forked from CloverHackyColor/CloverBootloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildme
executable file
·977 lines (900 loc) · 27.6 KB
/
buildme
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
#!/bin/bash
# created by vector sigma on July 15 2019
# modified by LAbyOne on My 2021
# github version
# Linux users should be able to use this wrapper, although the following are needed:
# (Ubuntu alike)
# sudo apt-get install build-essential uuid-dev iasl git gcc-9 nasm python3-distutils
# $1 argument override MYTOOLCHAIN variable, in case you want GCC53 for example
# ====== COLORS ======
COL_BLACK="\x1b[40;01m"
COL_RED="\x1b[31;01m"
COL_GREEN="\x1b[32;01m"
COL_YELLOW="\x1b[33;01m"
COL_MAGENTA="\x1b[35;01m"
COL_CYAN="\x1b[36;01m"
COL_WHITE="\x1b[37;01m"
COL_BLUE="\x1b[34;01m"
COL_RESET="\x1b[39;49;00m"
# ====== Main Window SetUp ======
if [[ "$2" != ci ]]; then
osascript <<EOF
tell application "System Events" to tell application "Finder"
tell process "Terminal"
set frontmost to true
end tell
end tell
tell application "Terminal"
activate
set bounds of window 1 to {0, 23, 615, 420}
# set current settings of window 1 to settings set "Pro"
# set font name of window 1 to "Monaco"
# set font size of window 1 to "11"
# set normal text color of window 1 to {3341, 35186, 50092}
# set position of first window to {650, 420}
end tell
EOF
fi
# ====== Clover workspace SetUp ======
cd "$(dirname $([ -L $0 ] && readlink $0 || echo $0))"
declare -r CLOVERROOT="$PWD"
declare -r SYSNAME="$(uname)"
MYTOOLCHAIN=${1:-GCC131}
revision=$(git describe --tags $(git rev-list --tags --max-count=1))
lsha1="not a git repo"
pyversion=$(echo $COL_CYAN"Current Python version: "$COL_WHITE$($(which python3) --version))
pynone=$(echo -e "$COL_RED Python3 seems missing on this machine, it is required to build Clover ")
export DIR_OUT=${DIR_OUT:-"$CLOVERROOT"/toolchain/tools/output}
export DIR_SCT=${DIR_SCT:-${CLOVERROOT}/toolchain/tools/Scripts}
if [[ ! -d ${DIR_SCT} ]] || [[ ! -d ${DIR_OUT} ]]; then
mkdir -p ${DIR_SCT} ${DIR_OUT}
fi
if [[ -d .git ]]; then
lsha1=$(git rev-parse --short HEAD)
fi
# Functions
pathmunge() {
if [[ ! $PATH =~ (^|:)$1(:|$) ]]; then
if [[ "${2:-}" = "after" ]]; then
export PATH=$PATH:$1
else
export PATH=$1:$PATH
fi
fi
}
checkXCODE() {
echo "[CHECK XCODE]"
if [[ ! -x /usr/bin/xcodebuild ]]; then
echo "ERROR: Install Xcode Tools from Apple before using this script."
exit 1
fi
if [[ ! -d "$(xcode-select --print-path)" ]]; then
echo "ERROR: Xcode Command Line Tools not selected:"
echo " open Xcode.app and go in Preferences->Locations,"
echo " and select the Command Line Tools"
exit 1
fi
}
checkGETTEXT() {
exportPaths
local locations=($(which msgmerge))
if [ "${#locations[@]}" -eq 0 ]; then
export GETTEXT_PREFIX="${TOOLCHAIN_DIR}"
"${CLOVERROOT}"/buildgettext.sh
else
# export gettex prefix to ensure buildpkg.sh will use it
# without the need to install it again
export GETTEXT_PREFIX="$(dirname "${locations[0]}")"
fi
}
exportPaths() {
if [[ "$SYSNAME" == Linux ]]; then
TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-/usr}
elif [[ "$SYSNAME" == Darwin ]]; then
pathmunge "$(xcode-select --print-path)"/usr/bin
if [[ -d ~/src/opt/local ]]; then
TOOLCHAIN_DIR=~/src/opt/local
else
TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-"$CLOVERROOT"/toolchain}
fi
fi
pathmunge "$TOOLCHAIN_DIR"/bin
export TOOLCHAIN_DIR=$TOOLCHAIN_DIR
export DIR_MAIN=${DIR_MAIN:-"$CLOVERROOT"/toolchain}
export DIR_TOOLS=${DIR_TOOLS:-$DIR_MAIN/tools}
export DIR_DOWNLOADS=${DIR_DOWNLOADS:-$DIR_TOOLS/download}
export DIR_LOGS=${DIR_LOGS:-$DIR_TOOLS/logs}
export PREFIX=${TOOLCHAIN_DIR}
}
checkTools() {
# export any env vars before building anything
if [[ "$SYSNAME" == Darwin ]]; then
checkXCODE
exportPaths
local GCC131_BIN="$PREFIX/cross/bin/x86_64-clover-linux-gnu-gcc"
if [[ $MYTOOLCHAIN == GCC* ]] && [[ ! -x "${GCC131_BIN}" ]]; then
if [[ $MYTOOLCHAIN == GCC131 ]]; then
cd "${CLOVERROOT}"
./build_gcc14.sh
else
MYTOOLCHAIN=XCODE8
fi
fi
else
exportPaths
fi
}
# Clone OR Update OpenCorePkg
function clone_OpenCorePkg() {
cd "${CLOVERROOT}"
if [ ! -d OpenCorePkg/AppleModels ]; then
echo "Cloning OpenCorePkg...."
git clone https://github.com/CloverHackyColor/OpenCorePkg.git > /dev/null
cd "${OpenCorePkg}"
git submodule update --init
else
echo "Updating OpenCorePkg...."
cd "${OpenCorePkg}"
git pull > /dev/null
fi
}
updateClover() {
echo "[UPDATE CLOVER]"
cd "${CLOVERROOT}"
clone_OpenCorePkg
if [[ -d .git ]]; then
git fetch --all --recurse-submodules
git pull --recurse-submodules origin master
else
echo "Error: this is not a git repository, can't update!"
fi
}
updateResetClover() {
echo "[UPDATE RESET CLOVER]"
cd "${CLOVERROOT}"
if [[ -d .git ]]; then
git fetch --all --recurse-submodules
git submodule foreach --recursive git clean -d -f -f
git clean -d -f -f
git submodule foreach --recursive git reset --hard origin/master
git reset --hard origin/master
git pull --recurse-submodules origin master
else
echo "Error: this is not a git repository, can't update!"
fi
}
buildCloverHFSPlus() {
if [[ -f "${CLOVERROOT}"/FileSystems/HFSPlus/X64/HFSPlus.efi ]]; then
echo "building Clover with HFSPlus"
buildClover HFSPlus
else
echo "${CLOVERROOT}/FileSystems/HFSPlus/X64/HFSPlus.efi: no such file!"
sleep 3
menu
fi
}
makeRelease() {
checkTools
# to force recreation of the Conf folder. You can still use a custom CONF_PATH if you don't want recreation.
rm -rf "$CLOVERROOT"/Conf
mkdir "$CLOVERROOT"/Conf
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER RELEASE]"
./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -t $MYTOOLCHAIN
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D LESS_DEBUG -t $MYTOOLCHAIN
# Run a post build script if exist (${DIR_TOOLS}/CloverScripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/CloverScripts/postbuild.sh ]]; then
chmod +x "${DIR_TOOLS}"/CloverScripts/postbuild.sh
echo "Running Clover postbuild script"
"${DIR_TOOLS}"/CloverScripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
}
makeReleaseXC() {
checkTools
# to force recreation of the Conf folder. You can still use a custom CONF_PATH if you don't want recreation.
rm -rf "$CLOVERROOT"/Conf
mkdir "$CLOVERROOT"/Conf
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER RELEASE WITH XCODE]"
local xrel="$(defaults read /Applications/Xcode.app/Contents/version.plist CFBundleShortVersionString)"
if [[ "$xrel" < "14.*" ]]; then
./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -D -t XCODE8
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D -t XCODE8
elif [[ "$xrel" == "14.*" ]]; then
./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -D -t XCODE14
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D -t XCODE14
elif [[ "$xrel" == "15.*" ]]; then
./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -D -t XCODE15
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D -t XCODE15
fi
# Run a post build script if exist (${DIR_TOOLS}/CloverScripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/CloverScripts/postbuild.sh ]]; then
chmod +x "${DIR_TOOLS}"/CloverScripts/postbuild.sh
echo "Running Clover postbuild script"
"${DIR_TOOLS}"/CloverScripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
}
buildCCPV() {
cd "${CLOVERROOT}"/Xcode/CloverConfigPlistValidator
make
}
BLC() {
if [[ ! -d "${CLOVERROOT}"/CloverPackage/BootLoaderChooser ]]; then
mkdir -p "${CLOVERROOT}"/CloverPackage/BootLoaderChooser
fi
curl -sLq https://github.com/jief666/BootloaderChooser/releases/download/1.4/BootX64.efi > "${CLOVERROOT}"/CloverPackage/BootLoaderChooser/BootX64.efi
chmod 775 "${CLOVERROOT}"/CloverPackage/BootLoaderChooser/BootX64.efi
}
buildClover() {
checkTools
# to force recreation of the Conf folder. You can still use a custom CONF_PATH if you don't want recreation.
rm -rf "$CLOVERROOT"/Conf
mkdir "$CLOVERROOT"/Conf
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER]"
# Run a custom build script if exist (${DIR_TOOLS}/Scripts/build.sh)
# This allow the user to run ebuild.sh with own parameters
if [[ -x "${DIR_TOOLS}"/Scripts/build.sh ]]; then
echo "Running custom build script"
"${DIR_TOOLS}"/Scripts/build.sh "${CLOVERROOT}" $MYTOOLCHAIN
else
local parameter=${1:-none}
if [[ "${parameter}" == HFSPlus ]]; then
#./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -D USE_APPLE_HFSPLUS_DRIVER -t $MYTOOLCHAIN
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D USE_APPLE_HFSPLUS_DRIVER -t $MYTOOLCHAIN
else
#./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -t $MYTOOLCHAIN
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D LESS_DEBUG -t $MYTOOLCHAIN
fi
fi
# Run a post build script if exist (${DIR_TOOLS}/CloverScripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/CloverScripts/postbuild.sh ]]; then
chmod +x "${DIR_TOOLS}"/CloverScripts/postbuild.sh
echo "Running Clover postbuild script"
"${DIR_TOOLS}"/CloverScripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
# Run a custom post build script if exist (${DIR_TOOLS}/Scripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/Scripts/postbuild.sh ]]; then
echo "Running postbuild script"
"${DIR_TOOLS}"/Scripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
}
buildCloverXC() {
checkTools
# to force recreation of the Conf folder. You can still use a custom CONF_PATH if you don't want recreation.
rm -rf "$CLOVERROOT"/Conf
mkdir "$CLOVERROOT"/Conf
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER WITH XCODE]"
# Run a custom build script if exist (${DIR_TOOLS}/Scripts/build.sh)
# This allow the user to run ebuild.sh with own parameters
if [[ -x "${DIR_TOOLS}"/Scripts/build.sh ]]; then
echo "Running custom build script"
"${DIR_TOOLS}"/Scripts/build.sh "${CLOVERROOT}" $MYTOOLCHAIN
else
local xrel="$(defaults read /Applications/Xcode.app/Contents/version.plist CFBundleShortVersionString)"
if [[ "$xrel" < "14.*" ]]; then
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D USE_APPLE_HFSPLUS_DRIVER -t XCODE8
elif [[ "$xrel" == "14.*" ]]; then
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D USE_APPLE_HFSPLUS_DRIVER -t XCODE14
elif [[ "$xrel" == "15.*" ]]; then
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -D USE_APPLE_HFSPLUS_DRIVER -t XCODE15
fi
fi
# Run a post build script if exist (${DIR_TOOLS}/CloverScripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/CloverScripts/postbuild.sh ]]; then
chmod +x "${DIR_TOOLS}"/CloverScripts/postbuild.sh
echo "Running Clover postbuild script"
"${DIR_TOOLS}"/CloverScripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
# Run a custom post build script if exist (${DIR_TOOLS}/Scripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/Scripts/postbuild.sh ]]; then
echo "Running postbuild script"
"${DIR_TOOLS}"/Scripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
}
buildtestsix() {
checkTools
# to force recreation of the Conf folder. You can still use a custom CONF_PATH if you don't want recreation.
rm -rf "$CLOVERROOT"/Conf
mkdir "$CLOVERROOT"/Conf
cd "${CLOVERROOT}"
echo "[BUILD CLOVERDB]"
./hebuild.sh -t $MYTOOLCHAIN
}
buildtestsev() {
checkTools
# to force recreation of the Conf folder. You can still use a custom CONF_PATH if you don't want recreation.
rm -rf "$CLOVERROOT"/Conf
mkdir "$CLOVERROOT"/Conf
cd "${CLOVERROOT}"
echo "[BUILD CLOVERDB]"
./hebuild.sh -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -t $MYTOOLCHAIN
}
buildCloverTest() {
checkTools
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER TEST]"
./ebuild.sh -nb -t $MYTOOLCHAIN
}
buildPkg() {
if [[ "$SYSNAME" == Darwin ]]; then
cd "${CLOVERROOT}"/CloverPackage
echo "[BUILD PKG]"
checkXCODE
checkGETTEXT
make pkg
else
echo && echo "can't build pkg on a non Darwin OS!"
fi
}
buildApp() {
local withClover=${1-"none"}
if [[ "$SYSNAME" == Darwin ]]; then
if [[ -f "${CLOVERROOT}"/CloverPackage/CloverV2/EFI/CLOVER/CLOVERX64.efi ]]; then
rm -f "${CLOVERROOT}"/CloverPackage/sym/.withV2
mkdir -p "${CLOVERROOT}"/CloverPackage/sym
if [[ $withClover == withV2 ]]; then
touch "${CLOVERROOT}"/CloverPackage/sym/.withV2
fi
cd "${CLOVERROOT}"/CloverApp
echo "[BUILD APP]"
checkXCODE
make
else
echo && echo "please, build Clover first!"
sleep 3
fi
else
echo && echo "Clover.app can only be built in macOS!"
fi
}
buildIso() {
cd "${CLOVERROOT}"/CloverPackage
echo "[BUILD ISO]"
make iso
}
makeV2() {
#clear
export V2=${V2:-${CLOVERROOT}/CloverPackage/CloverV2}
if [[ -f $V2/EFI/CLOVER/CLOVERX64.efi ]]; then
cd "${CLOVERROOT}"/CloverPackage
echo "" && echo -e $COL_CYAN"[BUILD CloverV2]"
make zip
else
echo "" && echo -e $COL_RED"please, Compile Clover first!!"
Sleep 3
fi
}
checkStatus() {
if [[ -d .git ]]; then
git fetch --recurse-submodules origin
git log -n 1 > "${DIR_OUT}"/status_${revision}-$(date +%Y%m%d-%H.%M.%S).txt
git status >> "${DIR_OUT}"/status_${revision}-$(date +%Y%m%d-%H.%M.%S).txt
git submodule foreach --recursive "git log -n 1 && git status" >> "${DIR_OUT}"/status_${revision}-$(date +%Y%m%d-%H.%M.%S).txt && open "${DIR_OUT}"/status_${revision}-*.txt
else
echo "Error: this is not a git repository, can't get info!"
fi
}
showdiff() {
if [[ -d .git ]]; then
git fetch --recurse-submodules origin
git diff > "${DIR_OUT}"/diff_${revision}-$(date +%Y%m%d-%H.%M.%S).txt && open "${DIR_OUT}"/diff_${revision}-*.txt
else
echo "Error: this is not a git repository, can't get info!"
fi
}
cleanBaseTools() {
cd "${CLOVERROOT}"/BaseTools
make clean
}
## Utilities
buildCPV() {
revision=r$(git describe --tags $(git rev-list --tags --max-count=1))
if [[ -d "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator ]]; then
rm -Rf "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator
fi
mkdir -p "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator
cd "${CLOVERROOT}"/Xcode/CloverConfigPlistValidator
checkXCODE
xcodebuild -project ./CloverConfigPlistValidator.xcodeproj -quiet CONFIGURATION_BUILD_DIR="${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator
mv -f "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator/CloverConfigPlistValidator "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator/CloverConfigPlistValidator_${revision}
rm -r "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator/*.dSYM
open "${CLOVERROOT}"/CloverPackage/CloverConfigPlistValidator
}
PlistEDPlus() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && curl -qsSLk https://github.com/ic005k/PlistEDPlus/releases/download/1.2.35/PlistEDPlus_Mac.dmg > PlistEDPlus_Mac.dmg
hdiutil attach -quiet -noverify -nobrowse PlistEDPlus_Mac.dmg && cp -Rf /Volumes/bin\:release\:PlistEDPlus/PlistEDPlus.app $HOME/Desktop/ClovUtils
hdiutil detach -force /Volumes/bin\:release\:PlistEDPlus
rm -r $HOME/Desktop/ClovUtils/PlistEDPlus_Mac.dmg && open $HOME/Desktop/ClovUtils
}
Hackintool() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && curl -sLq https://github.com/headkaze/Hackintool/releases/download/3.8.4/Hackintool.zip -o Hackintool.zip
unzip -q Hackintool.zip && rm -r Hackintool.zip && open $HOME/Desktop/ClovUtils
}
BitmaskDecode() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/corpnewt/BitmaskDecode && open $HOME/Desktop/ClovUtils
}
MaciASL() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && curl -sLq https://github.com/acidanthera/MaciASL/releases/download/1.6.2/MaciASL-1.6.2-RELEASE.dmg > MaciASL-1.6.2-RELEASE.dmg
hdiutil attach -quiet -noverify -nobrowse MaciASL-1.6.2-RELEASE.dmg && cp -Rf /Volumes/MaciASL/MaciASL.app $HOME/Desktop/ClovUtils
hdiutil detach -force /Volumes/MaciASL
rm -r $HOME/Desktop/ClovUtils/MaciASL-1.6.2-RELEASE.dmg && open $HOME/Desktop/ClovUtils
}
dmidecode() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils/dmidecode
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/acidanthera/dmidecode dmi-decode && xcodebuild -project ./dmi-decode/dmidecode.xcodeproj -quiet
cp -r dmi-decode/dmidecode $HOME/Desktop/ClovUtils/dmidecode && rm -Rf $HOME/Desktop/ClovUtils/dmi-decode && open $HOME/Desktop/ClovUtils
}
Get-IOReg-Devices() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/LAbyOne/Get-IOReg-Devices
mv -f Get-IOReg-Devices/Get\ IOReg\ Devices $HOME/Desktop/ClovUtils/Get\ IOReg-Devices && chmod a+x $HOME/Desktop/ClovUtils/Get\ IOReg-Devices/*.command
rm -rf Get-IOReg-Devices && open $HOME/Desktop/ClovUtils
}
NDBrightness () {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/KAMIKAZEUA/NativeDisplayBrightness NDBrightness
xcodebuild -project ./NDBrightness/NativeDisplayBrightness.xcodeproj -quiet -configuration Release clean build ARCHS=x86_64 ONLY_ACTIVE_ARCH=YES CONFIGURATION_BUILD_DIR=$HOME/Desktop/ClovUtils
rm -Rf $HOME/Desktop/ClovUtils/NDBrightness && rm -r $HOME/Desktop/ClovUtils/*.dSYM && open $HOME/Desktop/ClovUtils
}
SSDTTime() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/corpnewt/SSDTTime && open $HOME/Desktop/ClovUtils
}
USBMap() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/corpnewt/USBMap
open $HOME/Desktop/ClovUtils
}
Xiasl() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && curl -sLq https://github.com/ic005k/Xiasl/releases/download/1.1.66/Xiasl_Mac.dmg > Xiasl_Mac.dmg
hdiutil attach -quiet -noverify -nobrowse Xiasl_Mac.dmg && cp -Rf /Volumes/bin\:release\:Xiasl/Xiasl.app $HOME/Desktop/ClovUtils
hdiutil detach -force /Volumes/bin\:release\:Xiasl
rm -r $HOME/Desktop/ClovUtils/Xiasl_Mac.dmg && open $HOME/Desktop/ClovUtils
}
CsrDecode() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils/CsrDecode
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/corpnewt/CsrDecode && open $HOME/Desktop/ClovUtils
}
gibMacOS() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && git clone -q https://github.com/corpnewt/gibMacOS && open $HOME/Desktop/ClovUtils
}
mountR/W() {
if [[ ! -d $HOME/Desktop/ClovUtils ]]; then
mkdir -p $HOME/Desktop/ClovUtils
fi
cd $HOME/Desktop/ClovUtils && curl -sLq https://github.com/jacklukem/BigSurmountsrw/releases/download/1.0/BigSurmountsrw2.app.zip -o BigSurmountsrw2.app.zip && open $HOME/Desktop/ClovUtils
unzip -q $HOME/Desktop/ClovUtils/BigSurmountsrw2.app.zip && rm -r $HOME/Desktop/ClovUtils/BigSurmountsrw2.app.zip $HOME/Desktop/ClovUtils/__MACOSX
}
testing() {
#clear
echo
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"
echo -e " 🍀 Clover r${revision}$COL_WHITE (SHA: $lsha1)"
echo -e $COL_CYAN" Test Builds"
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"$COL_RESET
echo -e "\n\n\n\n\n\n\n\n\n\n\n"
PS3='
Please enter your choice: '
options=( 'test Clover with boot6'
'test Clover with boot7'
'test build (no autogen, no boot files)'
'back to Cloverbuilds'
'Exit')
select opt in "${options[@]}"
do
case $opt in
"test Clover with boot6")
buildtestsix
break
;;
"test Clover with boot7")
buildtestsev
break
;;
"test build (no autogen, no boot files)")
buildCloverTest
break
;;
"back to Cloverbuilds")
menu
break
;;
"Exit")
exit
break
;;
*)
echo "invalid option $REPLY"
break
;;
esac
done
testing
}
Utilities() {
echo
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"
echo -e " 🍀 Clover r${revision}$COL_WHITE (SHA: $lsha1)"
echo -e $COL_CYAN" External Utilities "
echo -e $COL_WHITE" All Files will be put on Desktop/ClovUtils"
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"$COL_RESET
echo -e "\n\n\n\n\n\n\n"
PS3='
Please enter your choice: '
options=( 'Get CloverConfigPlistValidator '
'Get PlistEDPlus '
'Get Hackintool '
'Get BitmaskDecode '
'Get MaciASL '
'Get dmidecode '
'Get IOReg-Devices '
'Get NativeDisplayBrightness '
'Get SSDTTime'
'Get USBMap'
'Get Xiasl'
'Get CsrDecode'
'Get gibMacOS'
'Get mountR/W'
'back to Cloverbuilds'
'Exit')
select opt in "${options[@]}"
do
case $opt in
"Get CloverConfigPlistValidator ")
buildCPV
break
;;
"Get PlistEDPlus ")
PlistEDPlus
break
;;
"Get Hackintool ")
Hackintool
break
;;
"Get BitmaskDecode ")
BitmaskDecode
break
;;
"Get MaciASL ")
MaciASL
break
;;
"Get dmidecode ")
dmidecode
break
;;
"Get IOReg-Devices ")
Get-IOReg-Devices
break
;;
"Get NativeDisplayBrightness ")
NDBrightness
break
;;
"Get SSDTTime")
SSDTTime
break
;;
"Get USBMap")
USBMap
break
;;
"Get Xiasl")
Xiasl
break
;;
"Get CsrDecode")
CsrDecode
break
;;
"Get gibMacOS")
gibMacOS
break
;;
"Get mountR/W")
mountR/W
break
;;
"back to Cloverbuilds")
menu
break
;;
"Exit")
exit
break
;;
*)
echo "invalid option $REPLY"
break
;;
esac
done
Utilities
}
Extra() {
#clear
echo
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"
if [[ ! -x "$(which python3)" ]]; then
echo -e " ${pynone}"
fi
echo -e "$COL_GREEN 🍀 Clover r${revision}$COL_WHITE (SHA: $lsha1)"
echo -e "$COL_WHITE Default TOOLCHAIN:$COL_CYAN $MYTOOLCHAIN$COL_WHITE "
echo -e "${COL_WHITE} Switch to${COL_CYAN} XCODE${COL_WHITE} can be done on${COL_CYAN} Cloverbuilds"
if [[ -x "$(which python3)" ]]; then
echo -e $COL_GREEN" ---------------------- ${pyversion}$COL_GREEN -------------------- "$COL_RESET
echo -e "\n\n\n\n\n\n\n\n\n\n"
else
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"$COL_RESET
echo -e "\n\n\n\n\n\n\n\n\n"
fi
PS3='
Please enter your choice: '
options=( 'Cloverbuilds '
'test Clover '
'check status '
'show diff '
'open CloverV2 directory'
'update Clover (reset changes)'
'clean BaseTools'
'Utilities'
'Exit')
select opt in "${options[@]}"
do
case $opt in
"Cloverbuilds ")
menu
break
;;
"test Clover ")
testing
break
;;
"check status ")
checkStatus
break
;;
"show diff ")
showdiff
break
;;
"open CloverV2 directory")
if [[ -d "${CLOVERROOT}"/CloverPackage/CloverV2/EFI/CLOVER ]]; then
open "${CLOVERROOT}"/CloverPackage/CloverV2/EFI/CLOVER
else
echo && echo "Directory not found. Compile Clover first!!"
sleep 2
fi
break
;;
"update Clover (reset changes)")
read -p "Are you sure? (type y to confirm or any other to negate) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
updateResetClover
fi
break
;;
"clean BaseTools")
read -p "Are you sure? (type y to confirm or any other to negate) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
cleanBaseTools
fi
break
;;
"Utilities")
Utilities
break
;;
"Exit")
exit 0
;;
*)
echo "invalid option $REPLY"
break
;;
esac
done
Extra
}
menu() {
#clear
echo
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"
if [[ ! -x "$(which python3)" ]]; then
echo -e " ${pynone}"
fi
echo -e "$COL_GREEN 🍀 Clover r${revision}$COL_WHITE (SHA: $lsha1)"
echo -e "$COL_WHITE Default TOOLCHAIN:$COL_CYAN $MYTOOLCHAIN$COL_WHITE "
echo -e "${COL_WHITE} Switch to${COL_CYAN} XCODE${COL_WHITE} select:${COL_CYAN} build (with XCode)"
echo -e "${COL_WHITE} Depending on your${COL_CYAN} XCODE version${COL_WHITE} the Toolset will be${COL_CYAN} automatically chosen"
# echo -e "${COL_WHITE} Toolset${COL_CYAN} is automatically chosen${COL_WHITE} depending on the${COL_CYAN} XCODE installed version"
if [[ -x "$(which python3)" ]]; then
echo -e $COL_GREEN" ---------------------- ${pyversion}$COL_GREEN -------------------- "$COL_RESET
echo -e "\n\n\n\n\n\n\n"
else
echo -e $COL_GREEN" ---------------------------------------------------------------------------------"$COL_RESET
echo -e "\n\n\n\n\n\n\n"
fi
PS3='
Please enter your choice: '
options=( 'build Clover (Default Toolchain) '
'build all (Default Toolchain) '
'make Release (Default Toolchain) '
# 'build Clover with HFSPlus '
'update Clover '
'make pkg '
'make iso '
'make Clover_V2'
'build Clover (with XCode)'
'build all (with XCode)'
'make Release (with XCode)'
'build Clover with HFSPlus'
'Extra Options'
'Exit')
select opt in "${options[@]}"
do
case $opt in
"build Clover (Default Toolchain) ")
buildClover
break
;;
"build all (Default Toolchain) ")
buildClover
BLC
buildPkg
buildIso
makeV2
break
;;
"make Release (Default Toolchain) ")
makeRelease
BLC
buildPkg
buildIso
makeV2
break
;;
"update Clover ")
updateClover
break
;;
"make pkg ")
BLC
buildPkg
break
;;
"make iso ")
buildIso
break
;;
"make Clover_V2")
makeV2
break
;;
"build Clover (with XCode)")
buildCloverXC
break
;;
"build all (with XCode)")
buildCloverXC
BLC
buildPkg
buildIso
makeV2
break
;;
"make Release (with XCode)")
makeReleaseXC
BLC
buildPkg
buildIso
makeV2
break
;;
"build Clover with HFSPlus ")
buildCloverHFSPlus
break
;;
"Extra Options")
Extra
break
;;
"Exit")
exit 0
;;
*)
echo "invalid option $REPLY"
break
;;
esac
done
menu
}
# Main
clone_OpenCorePkg
set -e
if [[ "$2" == ci ]]; then
makeRelease
# buildCCPV
BLC
buildPkg
buildIso
makeV2
else
menu
fi