Odin
Odin copied to clipboard
Fix put preferable llvm-config-14 first.
Fix building on systems with default LLVM v15 and higher, Arch Linux for example.
while you're at it, why not just recover from finding an unsupported version and try the next one?:
MIN_LLVM_VERSION=("11.0.0")
FIRST_UNSUPPORTED_LLVM_VERSION=("15.0.0")
if [ ! "$LLVM_CONFIG" ]; then
for THE_LLVM_CONFIG in llvm-config llvm-config-11 llvm-config-11-64 llvm-config-14; do
if [ ! -x "$(command -v $THE_LLVM_CONFIG)" ]; then
continue
fi
if [ $(version $($THE_LLVM_CONFIG --version)) -lt $(version $MIN_LLVM_VERSION) ] ; then
echo "Tried to use" $(which $THE_LLVM_CONFIG) "version" $($THE_LLVM_CONFIG --version) \
": must be at least" $MIN_LLVM_VERSION
continue
fi
if [ $(version $($THE_LLVM_CONFIG --version)) -ge $(version $FIRST_UNSUPPORTED_LLVM_VERSION) ] ; then
echo "Tried to use" $(which $THE_LLVM_CONFIG) "version" $($THE_LLVM_CONFIG --version) \
": must be lower than" $FIRST_UNSUPPORTED_LLVM_VERSION
continue
fi
LLVM_CONFIG=$THE_LLVM_CONFIG
break
done
fi
if [ ! "$LLVM_CONFIG" ]; then
panic "Unable to find LLVM-config"
else
echo "Found " $(which $LLVM_CONFIG) "version" $($LLVM_CONFIG --version)
fi
just a proof of concept, it can probably be simplified a bit
This PR is stale and can likely be closed. The build_odin.sh script has been refactored and there's a separate PR to add checks for LLVM14 in https://github.com/odin-lang/Odin/pull/2893. The order of when LLVM14 is checked is important so that Odin always cuts a release with an officially supported version of LLVM as outlined in that PR.