Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python detection in clang recipe #5748

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ build_requires:
- CMake
- curl
- ninja
- alibuild-recipe-tools
env:
LLVM_ROOT: "$CLANG_ROOT" # needed by LLVMAlt
LLVM_ROOT: "$CLANG_ROOT" # needed by LLVMAlt
prefer_system: (osx.*)
prefer_system_check: |
brew --prefix llvm@18 && test -d $(brew --prefix llvm@18)
brew --prefix llvm@18 && test -d "$(brew --prefix llvm@18)"
---
#!/bin/bash -e

Expand All @@ -36,6 +37,18 @@ case $ARCHITECTURE in
*) echo 'Unknown LLVM target for architecture' >&2; exit 1 ;;
esac


# If we have our own python, use it
if [ -n "$PYTHON_REVISION" ]; then
export PYTHON_HOME="$PYTHON_ROOT"
which -a python
which -a python3
# if [ -n "$VIRTUAL_ENV" ]; then
# deactivate
# fi
fi


# BUILD_SHARED_LIBS=ON is needed for e.g. adding dynamic plugins to clang-tidy.
# Apache Arrow needs LLVM_ENABLE_RTTI=ON.
cmake "$SOURCEDIR/llvm" \
Expand All @@ -46,7 +59,6 @@ cmake "$SOURCEDIR/llvm" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALLROOT" \
-DLLVM_INSTALL_UTILS=ON \
-DPYTHON_EXECUTABLE="$(which python3)" \
-DDEFAULT_SYSROOT="$DEFAULT_SYSROOT" \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
Expand Down Expand Up @@ -109,22 +121,8 @@ EOF
"$INSTALLROOT/bin-safe/clang++" -v -c test.cc

# Modulefile
mkdir -p etc/modulefiles
cat > "etc/modulefiles/$PKGNAME" <<EoF
#%Module1.0
proc ModulesHelp { } {
global version
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
}
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
# Dependencies
module load BASE/1.0 \\
${GCC_TOOLCHAIN_REVISION:+GCC-Toolchain/$GCC_TOOLCHAIN_VERSION-$GCC_TOOLCHAIN_REVISION}
# Our environment
set CLANG_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
mkdir -p "$INSTALLROOT/etc/modulefiles"
alibuild-generate-module --lib --cmake > "$INSTALLROOT/etc/modulefiles/$PKGNAME"
cat >> "$INSTALLROOT/etc/modulefiles/$PKGNAME" <<EoF
prepend-path PATH \$CLANG_ROOT/bin-safe
prepend-path LD_LIBRARY_PATH \$CLANG_ROOT/lib
EoF
mkdir -p "$INSTALLROOT/etc/modulefiles"
rsync -a --delete etc/modulefiles/ "$INSTALLROOT/etc/modulefiles"
8 changes: 8 additions & 0 deletions python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,32 @@ prefer_system_replacement_specs:
env:
PYTHON_ROOT: $(brew --prefix python3)
PYTHON_REVISION: ""
PYTHONHOME: ""
PYTHONPATH: ""
"python3.*":
env:
# Python is in path, so we need a dummy placeholder for PYTHON_ROOT
# to avoid having /bin in the middle of the path.
PYTHON_ROOT: "/dummy-python-folder"
PYTHON_REVISION: ""
PYTHONHOME: ""
PYTHONPATH: ""

# Workaround to support old alibuild versions that don't regex match alibuild_system_replace
"python-brew3":
env:
PYTHON_ROOT: $(brew --prefix python3)
PYTHON_REVISION: ""
PYTHONHOME: ""
PYTHONPATH: ""
"python3":
env:
# Python is in path, so we need a dummy placeholder for PYTHON_ROOT
# to avoid having /bin in the middle of the path.
PYTHON_ROOT: "/dummy-python-folder"
PYTHON_REVISION: ""
PYTHONHOME: ""
PYTHONPATH: ""
---
rsync -av --exclude '**/.git' $SOURCEDIR/ $BUILDDIR/

Expand Down