mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
Fix for nasm detection
nasm is a business for ebuild.sh only
This commit is contained in:
parent
ac97cf5fb0
commit
9de5c877b5
48
buildme
48
buildme
@ -38,53 +38,6 @@ if [[ ! -d "$(xcode-select --print-path)" ]]; then
|
||||
fi
|
||||
}
|
||||
|
||||
isNASMGood() {
|
||||
# nasm should be greater or equal to 2.12.02 to be good building Clover.
|
||||
# There was a bad macho relocation in outmacho.c, fixed by Zenith432
|
||||
# and accepted by nasm devel during 2.12.rcxx (release candidate)
|
||||
|
||||
result=1
|
||||
local nasmver=$( "${1}" -v | grep 'NASM version' | awk '{print $3}' )
|
||||
|
||||
case "$nasmver" in
|
||||
2.12.0[2-9]* | 2.12.[1-9]* | 2.1[3-9]* | 2.[2-9]* | [3-9]* | [1-9][1-9]*)
|
||||
result=0;;
|
||||
*)
|
||||
printf "\n\e[1;33mUnknown or unsupported NASM version found at:\n${1}\n\n\e[0m";;
|
||||
esac
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
checkNASM() {
|
||||
local nasmArray=( $(which -a nasm) )
|
||||
local found=0
|
||||
|
||||
if [ ${#nasmArray[@]} -ge "1" ]; then
|
||||
|
||||
for i in "${nasmArray[@]}"
|
||||
do
|
||||
echo "found nasm v$(${i} -v | grep 'NASM version' | awk '{print $3}') at $(dirname ${i})"
|
||||
done
|
||||
|
||||
# we have a good nasm?
|
||||
for i in "${nasmArray[@]}"
|
||||
do
|
||||
if isNASMGood "${i}"; then
|
||||
found=1
|
||||
export NASM_PREFIX="$(dirname ${i})/"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$found" -eq 0 ]]; then
|
||||
echo "installing nasm.."
|
||||
NASM_PREFIX="$(dirname ${i})/"
|
||||
"${CLOVERROOT}"/buildnasm.sh
|
||||
fi
|
||||
}
|
||||
|
||||
checkGETTEXT() {
|
||||
if [[ ! -x $(which gettext) ]]; then
|
||||
"${CLOVERROOT}"/buildgettext.sh
|
||||
@ -105,7 +58,6 @@ export DIR_LOGS=${DIR_LOGS:-$DIR_TOOLS/logs}
|
||||
checkTools() {
|
||||
checkXCODE
|
||||
exportPaths
|
||||
checkNASM
|
||||
checkGETTEXT
|
||||
}
|
||||
|
||||
|
50
ebuild.sh
50
ebuild.sh
@ -33,7 +33,7 @@ PLATFORMFILE=
|
||||
MODULEFILE=
|
||||
TARGETRULE=
|
||||
|
||||
SCRIPT_VERS="2018-06-18"
|
||||
SCRIPT_VERS="2019-09-06"
|
||||
|
||||
# Macro
|
||||
M_NOGRUB=0
|
||||
@ -57,7 +57,7 @@ else
|
||||
TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-"$CLOVERROOT"/../../toolchain}
|
||||
fi
|
||||
if [[ ! -d $TOOLCHAIN_DIR ]]; then
|
||||
TOOLCHAIN_DIR="${PWD}"/../../opt/local
|
||||
TOOLCHAIN_DIR="${PWD}"/../opt/local
|
||||
fi
|
||||
export TOOLCHAIN_DIR
|
||||
echo "TOOLCHAIN_DIR: $TOOLCHAIN_DIR"
|
||||
@ -181,47 +181,6 @@ IsNumericOnly() {
|
||||
return 1 # yes is an integer (no matter for bash if there are zeroes at the beginning comparing it as integer)
|
||||
fi
|
||||
}
|
||||
needNASM() {
|
||||
local nasmPath=""
|
||||
local nasmArray=( $(which -a nasm) )
|
||||
local needInstall=1
|
||||
local good=""
|
||||
|
||||
if [ ${#nasmArray[@]} -ge "1" ]; then
|
||||
|
||||
for i in "${nasmArray[@]}"
|
||||
do
|
||||
echo "found nasm v$(${i} -v | grep 'NASM version' | awk '{print $3}') at $(dirname ${i})"
|
||||
done
|
||||
|
||||
# we have a good nasm?
|
||||
for i in "${nasmArray[@]}"
|
||||
do
|
||||
if isNASMGood "${i}"; then
|
||||
good="${i}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -x "${good}" ]] ; then
|
||||
# only nasm at index 0 is used!
|
||||
if [[ "${good}" == "${nasmArray[0]}" ]]; then
|
||||
echo "${good} is ok.."
|
||||
else
|
||||
echo "this one is good:"
|
||||
echo "${good}"
|
||||
fi
|
||||
else
|
||||
# no nasm versions suitable for Clover
|
||||
echo "nasm found, but is not good to build Clover.."
|
||||
needInstall=0
|
||||
fi
|
||||
else
|
||||
needInstall=0
|
||||
echo "nasm not found.."
|
||||
fi
|
||||
return $needInstall
|
||||
}
|
||||
|
||||
isNASMGood() {
|
||||
# nasm should be greater or equal to 2.12.02 to be good building Clover.
|
||||
@ -462,12 +421,13 @@ checkToolchain() {
|
||||
|
||||
if [[ -x "/opt/local/bin/nasm" ]]; then
|
||||
export NASM_PREFIX="/opt/local/bin/"
|
||||
elif [[ -f "${TOOLCHAIN_DIR}/bin/nasm" ]]; then
|
||||
elif [[ -x "${TOOLCHAIN_DIR}/bin/nasm" ]]; then
|
||||
# using $TOOLCHAIN_DIR here should allow Clover source to be
|
||||
# inside any sub folder instead of only in ~/
|
||||
export NASM_PREFIX="${TOOLCHAIN_DIR}/bin/"
|
||||
else
|
||||
export NASM_PREFIX=""
|
||||
export NASM_PREFIX="${TOOLCHAIN_DIR}/bin/"
|
||||
./buildnasm.sh
|
||||
fi
|
||||
|
||||
echo "NASM_PREFIX: $NASM_PREFIX"
|
||||
|
Loading…
Reference in New Issue
Block a user