22
33# ebuild.sh ->ebuild.sh //renamed to be unique file begining from E
44# Script for building CloverEFI source under OS X or Linux
5- # Supported chainloads(compilers) are XCODE*, GCC*, UNIXGCC and CLANG
5+ # Supported chainloads(compilers) are XCODE*, GCC*, UNIXGCC and LLVM
66#
77#
88# Created by Jadran Puharic on 1/6/12.
@@ -54,26 +54,29 @@ export PYTHON_COMMAND=python3
5454
5555# if building through Xcode, then TOOLCHAIN_DIR is not defined
5656# checking if it is where CloverGrowerPro put it
57- if [[ " $SYSNAME " == Linux ]]; then
58- export TOOLCHAIN=GCC152
59- TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-/ usr}
60- else
61- if [[ -d ~ /src/opt/local ]]; then
62- TOOLCHAIN_DIR=~ /src/opt/local
63- else
64- TOOLCHAIN_DIR=${TOOLCHAIN_DIR:- " $CLOVERROOT " / toolchain}
65- fi
66- export DIR_MAIN=${DIR_MAIN:- " $CLOVERROOT " / toolchain}
67- fi
68- export TOOLCHAIN_DIR
69- echo " TOOLCHAIN_DIR: $TOOLCHAIN_DIR "
57+ # if [[ "$SYSNAME" == Linux ]]; then
58+ # export TOOLCHAIN=GCC152
59+ # TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-/usr}
60+ # else
61+ # if [[ "$TOOLCHAIN" == LLVM ]]; then
62+ # TOOLCHAIN_DIR=/opt/local
63+ # elif [[ -d ~/src/opt/local ]]; then
64+ # TOOLCHAIN_DIR=~/src/opt/local
65+ # else
66+ # TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-"$CLOVERROOT"/toolchain}
67+ # fi
68+ # export DIR_MAIN=${DIR_MAIN:-"$CLOVERROOT"/toolchain}
69+ # fi
70+ # export TOOLCHAIN_DIR
71+ # echo "TOOLCHAIN_DIR: $TOOLCHAIN_DIR"
7072
7173VBIOSPATCHCLOVEREFI=0
7274ONLYSATA0PATCH=0
7375USE_BIOS_BLOCKIO=0
7476USE_LOW_EBDA=1
7577CLANG=0
7678GENPAGE=0
79+ LLVM=0
7780
7881FORCEREBUILD=0
7982NOBOOTFILES=0
@@ -246,8 +249,8 @@ usage() {
246249 print_option_help " -v, --version" " print the version information and exit"
247250 echo
248251 echo " Toolchain:"
249- # print_option_help "-clang" "use XCode Clang toolchain"
250- # print_option_help "-llvm" "use LLVM toolchain"
252+ # print_option_help "-clang" "use Clang toolchain"
253+ print_option_help " -llvm" " use LLVM toolchain"
251254# print_option_help "-gcc49" "use GCC 4.9 toolchain"
252255 print_option_help " -gcc53" " use GCC 5.3 toolchain, including gcc-11"
253256 print_option_help " -gcc131" " use GCC 13.1 toolchain, including gcc-14.2"
@@ -258,7 +261,7 @@ usage() {
258261 print_option_help " -xcode5" " use XCode 5 toolchain, "
259262 print_option_help " -xcode8" " use XCode 8 toolchain [Default]"
260263 print_option_help " -xcode14" " use XCode 14 toolchain"
261- print_option_help " -xcode15 " " use XCode 15 toolchain"
264+ print_option_help " -xcode16 " " use XCode 16-26 toolchain"
262265 print_option_help " -t TOOLCHAIN, --tagname=TOOLCHAIN" " force to use a specific toolchain"
263266 echo
264267 echo " Target:"
@@ -309,7 +312,7 @@ checkCmdlineArguments() {
309312 local option=$1
310313 shift
311314 case " $option " in
312- -clang | --clang ) TOOLCHAIN=XCLANG ; CLANG=1 ;;
315+ -llvm | --llvm ) TOOLCHAIN=LLVM ; CLANG=1 ;;
313316 -xcode5 | --xcode5 ) TOOLCHAIN=XCODE5 ; CLANG=1 ;;
314317 -xcode8 | --xcode8 ) TOOLCHAIN=XCODE8 ; CLANG=1 ;;
315318 -xcode14 | --xcode14 ) TOOLCHAIN=XCODE14 ; CLANG=1 ;;
@@ -461,6 +464,11 @@ checkToolchain() {
461464 ./buildnasm.sh
462465 fi
463466
467+ if [[ $TOOLCHAIN == LLVM ]]; then
468+ export LLVM_PREFIX=" /opt/local/bin/"
469+ export LLVM_BIN=" /opt/local/libexec/llvm-19/bin/"
470+ fi
471+
464472 echo " NASM_PREFIX: $NASM_PREFIX "
465473
466474 # NASM_VER=`nasm -v | awk '/version/ {print $3}'`
@@ -474,7 +482,8 @@ checkToolchain() {
474482
475483# Main build script
476484MainBuildScript () {
477- checkCmdlineArguments $@
485+ # checkCmdlineArguments $@
486+
478487 checkToolchain
479488
480489 # local repoRev=$(git describe --tags $(git rev-list --tags --max-count=1))
@@ -585,7 +594,7 @@ MainBuildScript() {
585594 [[ " $ONLYSATA0PATCH " -ne 0 ]] && addEdk2BuildMacro ' ONLY_SATA_0'
586595 [[ " $USE_LOW_EBDA " -ne 0 ]] && addEdk2BuildMacro ' USE_LOW_EBDA'
587596 [[ -d " $WORKSPACE /MdeModulePkg/Universal/Variable/EmuRuntimeDxe" ]] && addEdk2BuildMacro ' HAVE_LEGACY_EMURUNTIMEDXE'
588- [[ " $CLANG " -ne 0 ]] && addEdk2BuildMacro ' CLANG '
597+ [[ " $LLVM " -ne 0 ]] && addEdk2BuildMacro ' LLVM '
589598 [[ " $ENABLE_MODERN_CPU " -ne 0 ]] && addEdk2BuildMacro ' ENABLE_MODERN_CPU_QUIRKS'
590599
591600 local cmd=" ${EDK2_BUILD_OPTIONS[@]} "
@@ -604,6 +613,8 @@ MainBuildScript() {
604613 echo " $cmd "
605614 echo
606615
616+
617+
607618 # Build Clover version
608619 if (( $SkipAutoGen == 0 )) || (( $FORCEREBUILD == 1 )) ; then
609620
@@ -915,6 +926,24 @@ export LC_ALL=POSIX
915926
916927startBuildEpoch=$( date -u " +%s" )
917928
929+ checkCmdlineArguments $@
930+
931+ if [[ " $SYSNAME " == Linux ]]; then
932+ export TOOLCHAIN=GCC152
933+ TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-/ usr}
934+ else
935+ if [[ " $TOOLCHAIN " == LLVM ]]; then
936+ TOOLCHAIN_DIR=/opt/local
937+ elif [[ -d ~ /src/opt/local ]]; then
938+ TOOLCHAIN_DIR=~ /src/opt/local
939+ else
940+ TOOLCHAIN_DIR=${TOOLCHAIN_DIR:- " $CLOVERROOT " / toolchain}
941+ fi
942+ export DIR_MAIN=${DIR_MAIN:- " $CLOVERROOT " / toolchain}
943+ fi
944+ export TOOLCHAIN_DIR
945+ echo " TOOLCHAIN_DIR: $TOOLCHAIN_DIR "
946+
918947# Add toolchain bin directory to the PATH
919948if [[ " $SYSNAME " != Linux ]]; then
920949 pathmunge " $TOOLCHAIN_DIR /bin"
0 commit comments