Skip to content

Commit

Permalink
Compare LLVM_VERSION_SHORT to "140" rather than "14".
Browse files Browse the repository at this point in the history
In commit 2b07721, support was added to p-libcxx.inc & p-llvm.inc
for LLVM versions 14+ (in which, apparently, certain build flags
were changed). To detect these recent versions, the variable
LLVM_VERSION_SHORT was compared numerically to "14"-- the intent
obviously being to express "LLVM version 14 or later".

However, in both v-clang.inc & v-llvm.inc, LLVM_VERSION_SHORT
is defined as the concatenation of LLVM_VERSION_MAJOR and
LLVM_VERSION_MINOR. Therefore, on a machine with, say, LLVM
13.0 installed, LLVM_VERSION_SHORT will be "130" which compares
as larger than "14".

This patch changes the comparison to be against "140".
  • Loading branch information
sp1ff authored and MartinNowack committed Feb 28, 2024
1 parent 399ea40 commit a01f46c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions scripts/build/p-libcxx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ build_libcxx() {
"-DCMAKE_INSTALL_PREFIX=${LIBCXX_INSTALL}"
)

# Static ABI libraries are not supported under OS X
if [[ "${LLVM_VERSION_SHORT}" -ge "14" ]]; then
if [[ "${LLVM_VERSION_SHORT}" -ge "140" ]]; then
cmake_flags+=("-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi")
cmake_flags+=("-DLLVM_ENABLE_PROJECTS=")
cmake_flags+=("-DLLVM_ENABLE_PROJECTS_USED:BOOL=ON")
else
cmake_flags+=("-DLLVM_ENABLE_PROJECTS=libcxx;libcxxabi")
fi
# Static ABI libraries are not supported under OS X
if [[ "${OS}" == "osx" ]]; then
cmake_flags+=("-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY:BOOL=OFF")
else
Expand All @@ -59,7 +59,7 @@ build_libcxx() {
export LLVM_COMPILER_PATH="$(dirname "${BITCODE_CC}")"

cmake "${cmake_flags[@]}" "${LIBCXX_SRC}/llvm"
if [[ "${LLVM_VERSION_SHORT}" -ge "14" ]]; then
if [[ "${LLVM_VERSION_SHORT}" -ge "140" ]]; then
make runtimes "-j$(nproc)" || make runtimes || return 1
else
make cxx "-j$(nproc)" || make cxx || return 1
Expand All @@ -75,7 +75,7 @@ install_libcxx() {
export LLVM_COMPILER=clang
export LLVM_COMPILER_PATH="$(dirname "${BITCODE_CC}")"

if [[ "${LLVM_VERSION_SHORT}" -ge "14" ]]; then
if [[ "${LLVM_VERSION_SHORT}" -ge "140" ]]; then
cd "${LIBCXX_BUILD}/runtimes" || return 1
make install || return 1
else
Expand Down Expand Up @@ -128,4 +128,4 @@ get_build_artifacts_libcxx() {

setup_artifact_variables_libcxx() {
setup_build_variables_libcxx
}
}
2 changes: 1 addition & 1 deletion scripts/build/p-llvm.inc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ configure_llvm() {
"-DLLVM_BUILD_STATIC:BOOL=OFF"
"-DLIBCLANG_BUILD_STATIC:BOOL=OFF"
)
if [[ "${LLVM_VERSION_SHORT}" -ge "14" ]]; then
if [[ "${LLVM_VERSION_SHORT}" -ge "140" ]]; then
CONFIG+=("-DLLVM_ENABLE_PROJECTS=${ENABLED_LLVM_PROJECTS}")
CONFIG+=("-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi")
else
Expand Down

0 comments on commit a01f46c

Please sign in to comment.