Stop trying to automate the dependency activation
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/build Pipeline failed Details

This commit is contained in:
Sameer Rahmani 2023-02-04 20:33:27 +00:00
parent 90c59443bf
commit 45cc991891
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
5 changed files with 78 additions and 12 deletions

View File

@ -1,3 +1,11 @@
clone:
git:
image: woodpeckerci/plugin-git
settings:
depth: 1
lfs: false
recursive: false
pipeline:
Prepare:
image: beta.devheroes.codes/serene/ci:9
@ -5,8 +13,7 @@ pipeline:
- pwd
- ./builder deps pull toolchain
- ./builder deps pull bdwgc
- export SERENE_ROOT=$(pwd)
- source activate
- export SERENE_AUTO_DEP=true
- ./builder build
volumes:

View File

@ -47,7 +47,6 @@ The ~builder~ script can build the necessary dependencies for you. Just make sur
all the dependencies as instructed above and follow:
#+BEGIN_SRC bash
# Download prebuilt dependencies instead of building from source (X86_64 only)
# Try to pull a prebuilt package for the toolchain (including llvm libraries)
@ -63,9 +62,16 @@ all the dependencies as instructed above and follow:
After building or pulling the dependencies, you'll have all of them under =~/.serene/env/=.
All you need to do is to activate the environment and build Serene itself.
To activate the environment, you can just do ~source ./activate~ in the root of the
source tree to activate the toolchain and the right set up dependencies.
After a =pull= or =build=, the ~builder~ script will let you know that what environment variables
are necessary to activate the dependencies. Also, if you are lazy like me, you can just set
the =SERENE_AUTO_DEP= to =true= and let the builder script set those for you. E.g.
#+BEGIN_SRC bash
export SERENE_AUTO_DEP="true"
#+END_SRC
Be advised that, setting up the above variable makes it a bit harder to switch to other environment
in the same shell that usually is not the case.
** Build and installing dependencies (Other platforms)
Currently, the ~builder~ script does not support any platform beside GNU/Linux. So, you

View File

@ -78,6 +78,7 @@ source "$ME/scripts/deps.sh"
# Initialization
# -----------------------------------------------------------------------------
mkdir -p "$DEPS_BUILD_DIR"
setup_dependencies
# -----------------------------------------------------------------------------
# Helper functions
@ -109,8 +110,8 @@ function popd_build() {
function build-gen() {
pushed_build
info "Running: "
info "cmake -G Ninja ${CMAKEARGS[*]} ${CMAKEARGS[*]}" "\"$*\" \"$ROOT_DIR\""
cmake -G Ninja "${CMAKEARGS[@]}" "${CMAKEARGS_DEBUG[@]}" "$*" "$ROOT_DIR"
info "cmake -G Ninja ${CMAKEARGS[*]} ${CMAKEARGS[*]}" "\"$*\" \"$ME\""
cmake -G Ninja "${CMAKEARGS[@]}" "${CMAKEARGS_DEBUG[@]}" "$*" "$ME"
popd_build
}
@ -132,6 +133,7 @@ function build() { ## Builds the project by regenerating the build scripts
local cpus
rm -rf "$BUILD_DIR"
build-gen "$@"
pushed_build

3
config
View File

@ -67,8 +67,6 @@ BDWGC_DIR_NAME="bdwgc"
BDWGC_SOURCE_DIR="$ME/deps/$BDWGC_DIR_NAME"
BDWGC_BUILD_DIR="$DEPS_BUILD_DIR/${BDWGC_DIR_NAME}_build"
BDWGC_INSTALL_DIR="$DEPS_BUILD_DIR/$BDWGC_DIR_NAME.$(get_version $BDWGC_SOURCE_DIR)"
# This is a variable that cmake expects
BDWgc_DIR="$BDWGC_INSTALL_DIR/lib64/cmake/bdwgc"
IWYU_DIR="$ME/deps/include-what-you-use"
@ -92,4 +90,3 @@ export BDWGC_DIR_NAME
export BDWGC_DIR
export BDWGC_BUILD_DIR
export BDWGC_INSTALL_DIR
export BDWgc_DIR

View File

@ -64,6 +64,7 @@ function build_toolchain() { ## Build LLVM and the toolchain
cmake --build . --parallel
cmake -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_DIR" -P cmake_install.cmake
_pop
info_toolchain
}
function package_toolchain() { ## Packages the built toolchain
@ -78,7 +79,7 @@ function package_toolchain() { ## Packages the built toolchain
info "Packaging the toolchain version '$version'..."
_push "$DEPS_BUILD_DIR"
local pkg
pkg="$LLVM_DIR_NAME.$(get_version "$LLVM_DIR")"
pkg="$LLVM_DIR_NAME.$version"
time tar -I "$ZSTD_CLI" -cf "$pkg.zstd" "$pkg"
_pop
}
@ -122,6 +123,19 @@ function pull_toolchain() {
exit 4
fi
_pop
info_toolchain
}
function info_toolchain() {
local version
version=$(get_version "$LLVM_DIR")
info "To activate toolchain version '$version' add the following env variable to your shell:"
info "export PATH=$LLVM_INSTALL_DIR/bin:$PATH"
info "export CC='$LLVM_INSTALL_DIR/bin/clang'"
info "export CXX='$LLVM_INSTALL_DIR/bin/clang++'"
info "export LDFLAGS=\"-fuse-ld=lld $LDFLAGS\""
}
function build_bdwgc() { ## Builds the BDW GC
@ -168,7 +182,9 @@ function build_bdwgc() { ## Builds the BDW GC
cmake --build . --parallel
cmake -DCMAKE_INSTALL_PREFIX="$BDWGC_INSTALL_DIR" -P cmake_install.cmake
_pop
info_bdwgc
}
function package_bdwgc() { ## Packages the built toolchain
@ -183,7 +199,7 @@ function package_bdwgc() { ## Packages the built toolchain
info "Packaging the BDWGC version '$version'..."
_push "$DEPS_BUILD_DIR"
local pkg
pkg="$BDWGC_DIR_NAME.$(get_version "$BDWGC_SOURCE_DIR")"
pkg="$BDWGC_DIR_NAME.$version"
time tar -I "$ZSTD_CLI" -cf "$pkg.zstd" "$pkg"
_pop
}
@ -229,6 +245,16 @@ function pull_bdwgc() {
exit 4
fi
_pop
info_bdwgc
}
function info_bdwgc() {
local version
version=$(get_version "$BDWGC_SOURCE_DIR")
info "To activate BDWGC version '$version' add the following env variable to your shell:"
info "export BDWgc_DIR='$BDWGC_INSTALL_DIR/lib64/cmake/bdwgc'"
}
function manage_dependencies() {
@ -315,3 +341,31 @@ function install_dependencies() {
function unpack() {
tar -I "$ZSTD_CLI" -xf "$1" -C "$DEPS_BUILD_DIR"
}
function setup_dependencies() {
if [[ "$SERENE_AUTO_DEP" = "true" ]]; then
if [ -d "$LLVM_INSTALL_DIR" ]; then
info "Activating the toolchain at '$LLVM_INSTALL_DIR'..."
export PATH="$LLVM_INSTALL_DIR/bin:$PATH"
CC=$(which clang)
CXX=$(which clang++)
info "Setting CC to '$CC'"
info "Setting CXX to '$CXX'"
LDFLAGS="-fuse-ld=lld"
info "Switching to LLD."
export CC
export CXX
export LDFLAGS
fi
if [ -d "$BDWGC_INSTALL_DIR" ]; then
info "Activating the BDWGC at '$BDWGC_INSTALL_DIR'..."
BDWgc_DIR="$BDWGC_INSTALL_DIR/lib64/cmake/bdwgc"
export BDWgc_DIR
fi
fi
}