#!/usr/bin/env bash usage() { echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [cross] [verbose] [objwriter] [clangx.y]" echo "managed - optional argument to build the managed code" echo "native - optional argument to build the native code" echo "The following arguments affect native builds only:" echo "BuildArch can be: x64, x86, arm, arm64, armel, wasm" echo "BuildType can be: Debug, Release" echo "clean - optional argument to force a clean build." echo "verbose - optional argument to enable verbose build output." echo "objwriter - optional argument to enable build ObjWriter library" echo "clangx.y - optional argument to build using clang version x.y." echo "cross - optional argument to signify cross compilation," echo " - will use ROOTFS_DIR environment variable if set." echo "skiptests - optional argument to skip running tests after building." exit 1 } setup_dirs() { echo Setting up directories for build mkdir -p "$__ProductBinDir" mkdir -p "$__IntermediatesDir" if [ $__CrossBuild = 1 ]; then mkdir -p "$__ProductHostBinDir" mkdir -p "$__IntermediatesHostDir" fi } # Performs "clean build" type actions (deleting and remaking directories) clean() { echo "Cleaning previous output for the selected configuration" rm -rf "$__ProductBinDir" rm -rf "$__IntermediatesDir" if [ $__CrossBuild = 1 ]; then rm -rf "$__ProductHostBinDir" rm -rf "$__IntermediatesHostDir" fi } get_current_linux_rid() { # Construct RID for current distro rid=linux if [ -e /etc/os-release ]; then source /etc/os-release if [[ $ID == "alpine" ]]; then rid="linux-musl" fi elif [ -e /etc/redhat-release ]; then redhatRelease=$(