builder: Give up on automatically setup the dev env
This commit is contained in:
parent
d8721ec5e6
commit
7993e6ac1c
|
@ -13,7 +13,10 @@ pipeline:
|
|||
- pwd
|
||||
- ./builder deps pull toolchain
|
||||
- ./builder deps pull bdwgc
|
||||
- export SERENE_AUTO_DEP=true
|
||||
- export llvm_version=$(git ls-tree HEAD deps/llvm-project|awk '{print $3}')
|
||||
- export bdwgc_version=$(git ls-tree HEAD deps/bdwgc|awk '{print $3}')
|
||||
- export PATH=/root/.serene/env/llvm.$llvm_version/bin:$PATH
|
||||
- export BDWgc_DIR='/root/.serene/env/bdwgc.$bdwgc_version/lib64/cmake/bdwgc'
|
||||
- ./builder build
|
||||
|
||||
volumes:
|
||||
|
|
|
@ -25,10 +25,15 @@ project(Serene
|
|||
# Clangd command file
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
||||
|
||||
# Policies ==========================
|
||||
# =============================================================================
|
||||
# Policies
|
||||
# =============================================================================
|
||||
cmake_policy(SET CMP0116 OLD)
|
||||
|
||||
# User Options ======================
|
||||
|
||||
# =============================================================================
|
||||
# User Options
|
||||
# =============================================================================
|
||||
option(CPP_20_SUPPORT "C++20 Support" OFF)
|
||||
option(SERENE_BUILD_TESTING "Enable tests" OFF)
|
||||
option(SERENE_ENABLE_BUILDID "Enable build id." OFF)
|
||||
|
|
87
builder
87
builder
|
@ -40,38 +40,72 @@
|
|||
#
|
||||
set -e
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Vars & Config
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
command=$1
|
||||
VERSION="0.7.0"
|
||||
VERSION="0.8.0"
|
||||
|
||||
ME=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
|
||||
|
||||
source "$ME/config"
|
||||
|
||||
LLVM_VERSION="11"
|
||||
|
||||
# TODO: Add sloppiness to the cmake list file as well
|
||||
export CCACHE_SLOPPINESS="pch_defines,time_macros"
|
||||
|
||||
export ASAN_OPTIONS=check_initialization_order=1
|
||||
LSAN_OPTIONS=suppressions=$(pwd)/.ignore_sanitize
|
||||
export LSAN_OPTIONS
|
||||
export LDFLAGS="-fuse-ld=lld"
|
||||
|
||||
CMAKEARGS_DEBUG=("-DCMAKE_BUILD_TYPE=Debug")
|
||||
CMAKEARGS=("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
"-DCMAKE_CXX_FLAGS='-stdlib=libc++'"
|
||||
"-DSERENE_CCACHE_DIR=$HOME/.ccache")
|
||||
|
||||
# shellcheck source=./scripts/utils.sh
|
||||
source "$ME/scripts/utils.sh"
|
||||
|
||||
# shellcheck source=./scripts/devfs.sh
|
||||
source "$ME/scripts/devfs.sh"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# CONFIG VARS
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# By default Clang is the compiler that we use and support. But you may use
|
||||
# whatever you want. But just be aware of the fact that we might not be able
|
||||
# to help you in case of any issue.
|
||||
CC="${CC:-clang}"
|
||||
CXX="${CXX:-clang++}"
|
||||
LDFLAGS="-fuse-ld=lld"
|
||||
|
||||
# The target architectures that we want to build Serene in and also we want
|
||||
# serene to support. We use this variable when we're building the llvm
|
||||
TARGET_ARCHS="X86;AArch64;AMDGPU;ARM;RISCV;WebAssembly"
|
||||
|
||||
# The repository to push/pull packages to/from.
|
||||
DEV_HEROES="https://beta.devheroes.codes"
|
||||
|
||||
BUILD_DIR_NAME="build"
|
||||
export BUILD_DIR_NAME
|
||||
|
||||
BUILD_DIR="$ME/$BUILD_DIR_NAME"
|
||||
export BUILD_DIR
|
||||
|
||||
DEPS_BUILD_DIR="$HOME/.serene/env"
|
||||
export DEPS_BUILD_DIR
|
||||
|
||||
# Serene subprojects. We use this array to run common tasks on all the projects
|
||||
# like running the test cases
|
||||
PROJECTS=(libserene serenec serene-repl serene-tblgen)
|
||||
|
||||
# TODO: Remove this
|
||||
LLVM_VERSION="11"
|
||||
|
||||
# TODO: Add sloppiness to the cmake list file as well
|
||||
CCACHE_SLOPPINESS="pch_defines,time_macros"
|
||||
export CCACHE_SLOPPINESS
|
||||
|
||||
ASAN_OPTIONS=check_initialization_order=1
|
||||
export ASAN_OPTIONS
|
||||
|
||||
LSAN_OPTIONS=suppressions="$ME/.ignore_sanitize"
|
||||
export LSAN_OPTIONS
|
||||
|
||||
|
||||
CMAKEARGS_DEBUG=(
|
||||
"-DCMAKE_BUILD_TYPE=Debug"
|
||||
)
|
||||
|
||||
CMAKEARGS=(
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
"-DCMAKE_CXX_FLAGS='-stdlib=libc++'"
|
||||
"-DSERENE_CCACHE_DIR=$HOME/.ccache"
|
||||
)
|
||||
|
||||
# shellcheck source=./scripts/deps.sh
|
||||
source "$ME/scripts/deps.sh"
|
||||
|
||||
|
@ -79,7 +113,7 @@ source "$ME/scripts/deps.sh"
|
|||
# Initialization
|
||||
# -----------------------------------------------------------------------------
|
||||
mkdir -p "$DEPS_BUILD_DIR"
|
||||
setup_dependencies
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helper functions
|
||||
|
@ -111,8 +145,8 @@ function popd_build() {
|
|||
function build-gen() {
|
||||
pushed_build
|
||||
info "Running: "
|
||||
info "cmake -G Ninja ${CMAKEARGS[*]} ${CMAKEARGS[*]}" "\"$*\" \"$ME\""
|
||||
cmake -G Ninja "${CMAKEARGS[@]}" "${CMAKEARGS_DEBUG[@]}" "$*" "$ME"
|
||||
info "cmake -G Ninja ${CMAKEARGS[*]} ${CMAKEARGS_DEBUG[*]}" "$@" "$ME"
|
||||
cmake -G Ninja "${CMAKEARGS[*]} ${CMAKEARGS_DEBUG[*]}" "$@" "$ME"
|
||||
popd_build
|
||||
}
|
||||
|
||||
|
@ -126,7 +160,7 @@ function deps() { ## Manage the dependencies
|
|||
|
||||
function compile() { ## Compiles the project using the generated build scripts
|
||||
pushed_build
|
||||
cmake --build .
|
||||
cmake --build . --parallel
|
||||
popd_build
|
||||
}
|
||||
|
||||
|
@ -139,7 +173,6 @@ function build() { ## Builds the project by regenerating the build scripts
|
|||
|
||||
cpus=$(nproc)
|
||||
cmake --build . -j "$cpus"
|
||||
|
||||
popd_build
|
||||
}
|
||||
|
||||
|
|
92
config
92
config
|
@ -1,92 +0,0 @@
|
|||
# Serene Programming Language
|
||||
#
|
||||
# Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Commentary
|
||||
# -----------------------------------------------------------------------------
|
||||
# This file contains bunch of variables that you can tune to fit you needs. The
|
||||
# `builder` script and `bin/activate` use this file to operate.
|
||||
#
|
||||
# Modify the `CONFIG VARS` the way you see fit or just use the default.
|
||||
|
||||
ME=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
|
||||
source "$ME/scripts/utils.sh"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# CONFIG VARS
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# By default Clang is the compiler that we use and support. But you may use
|
||||
# whatever you want. But just be aware of the fact that we might not be able
|
||||
# to help you in case of any issue.
|
||||
CC="${CC:-clang}"
|
||||
CXX="${CXX:-clang++}"
|
||||
|
||||
# The target architectures that we want to build Serene in and also we want
|
||||
# serene to support. We use this variable when we're building the llvm
|
||||
TARGET_ARCHS="X86;AArch64;AMDGPU;ARM;RISCV;WebAssembly"
|
||||
|
||||
# The repository to push/pull packages to/from.
|
||||
DEV_HEROES="https://beta.devheroes.codes"
|
||||
BUILD_DIR_NAME="build"
|
||||
|
||||
# Serene subprojects. We use this array to run common tasks on all the projects
|
||||
# like running the test cases
|
||||
PROJECTS=(libserene serenec serene-repl serene-tblgen)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# INTERNAL VARS
|
||||
# -----------------------------------------------------------------------------
|
||||
# You don't have any business in this section. Don't change any thing here
|
||||
# unless you really know what you're doing
|
||||
|
||||
|
||||
BUILD_DIR="$ME/$BUILD_DIR_NAME"
|
||||
DEPS_BUILD_DIR="$HOME/.serene/env"
|
||||
|
||||
LLVM_DIR_NAME="llvm"
|
||||
LLVM_DIR="$ME/deps/llvm-project"
|
||||
LLVM_SOURCE_DIR="$LLVM_DIR/$LLVM_DIR_NAME"
|
||||
LLVM_BUILD_DIR="$DEPS_BUILD_DIR/${LLVM_DIR_NAME}_build"
|
||||
LLVM_INSTALL_DIR="$DEPS_BUILD_DIR/$LLVM_DIR_NAME.$(get_version $LLVM_DIR)"
|
||||
|
||||
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)"
|
||||
|
||||
IWYU_DIR="$ME/deps/include-what-you-use"
|
||||
|
||||
ZSTD_CLI="zstd --ultra -22 -T$(nproc)"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Exports
|
||||
# -----------------------------------------------------------------------------
|
||||
export ME
|
||||
export TARGET_ARCHS
|
||||
export DEV_HEROES
|
||||
export PROJECTS
|
||||
|
||||
export BUILD_DIR
|
||||
export LLVM_DIR_NAME
|
||||
export LLVM_DIR
|
||||
export LLVM_SOURCE_DIR
|
||||
export LLVM_BUILD_DIR
|
||||
export LLVM_INSTALL_DIR
|
||||
export BDWGC_DIR_NAME
|
||||
export BDWGC_DIR
|
||||
export BDWGC_BUILD_DIR
|
||||
export BDWGC_INSTALL_DIR
|
|
@ -21,11 +21,25 @@
|
|||
# This file contains some functions to build, pack and distribute the
|
||||
# dependencies
|
||||
#
|
||||
# IMPORTANT: ENV Vars comes from the `config` file
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "scripts/utils.sh"
|
||||
|
||||
LLVM_DIR_NAME="llvm"
|
||||
LLVM_DIR="$ME/deps/llvm-project"
|
||||
LLVM_SOURCE_DIR="$LLVM_DIR/$LLVM_DIR_NAME"
|
||||
LLVM_BUILD_DIR="$DEPS_BUILD_DIR/${LLVM_DIR_NAME}_build"
|
||||
LLVM_INSTALL_DIR="$DEPS_BUILD_DIR/$LLVM_DIR_NAME.$(get_version "$LLVM_DIR")"
|
||||
|
||||
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")"
|
||||
|
||||
IWYU_DIR="$ME/deps/include-what-you-use"
|
||||
|
||||
ZSTD_CLI="zstd --ultra -22 -T$(nproc)"
|
||||
|
||||
function build_toolchain() { ## Build LLVM and the toolchain
|
||||
local version
|
||||
version=$(get_version "$LLVM_DIR")
|
||||
|
@ -126,16 +140,17 @@ function pull_toolchain() {
|
|||
info_toolchain
|
||||
}
|
||||
|
||||
get_toolchain_version() {
|
||||
get_version "$LLVM_DIR"
|
||||
}
|
||||
|
||||
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\""
|
||||
info "export PATH=$LLVM_INSTALL_DIR/bin:\$PATH"
|
||||
}
|
||||
|
||||
function build_bdwgc() { ## Builds the BDW GC
|
||||
|
@ -204,6 +219,10 @@ function package_bdwgc() { ## Packages the built toolchain
|
|||
_pop
|
||||
}
|
||||
|
||||
function get_bdwgc_version {
|
||||
get_version "$BDWGC_SOURCE_DIR"
|
||||
}
|
||||
|
||||
function push_bdwgc() { ## Push the BDWGC package to the package repository
|
||||
local version
|
||||
version=$(get_version "$BDWGC_SOURCE_DIR")
|
||||
|
@ -279,7 +298,9 @@ function manage_dependencies() {
|
|||
"install")
|
||||
install_dependencies "${@:2}"
|
||||
;;
|
||||
|
||||
"version")
|
||||
get_dep_version "${@:2}"
|
||||
;;
|
||||
*)
|
||||
error "Don't know about '$1' action"
|
||||
exit 1
|
||||
|
@ -287,6 +308,7 @@ function manage_dependencies() {
|
|||
esac
|
||||
}
|
||||
|
||||
|
||||
function pull_dep() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
|
@ -296,6 +318,15 @@ function pull_dep() {
|
|||
pull_"$1" "${@:2}"
|
||||
}
|
||||
|
||||
function get_dep_version() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_"$1"_version "${@:2}"
|
||||
}
|
||||
|
||||
function build_dep() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
|
|
Loading…
Reference in New Issue