Move build-setup script to correct directory (#1271)
This commit is contained in:
100
build-setup.sh
100
build-setup.sh
@@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
# get helpful utilities
|
||||
source $RDIR/scripts/utils.sh
|
||||
|
||||
common_setup
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0} [OPTIONS] [riscv-tools | esp-tools]"
|
||||
echo ""
|
||||
echo "Helper script to initialize repository that wraps other scripts."
|
||||
echo "Sets up conda environment, initializes submodules, and installs toolchain collateral."
|
||||
echo ""
|
||||
echo "Installation Types"
|
||||
echo " riscv-tools: if set, builds the riscv toolchain (this is also the default)"
|
||||
echo " esp-tools: if set, builds esp-tools toolchain used for the hwacha vector accelerator"
|
||||
echo ""
|
||||
echo "Options"
|
||||
echo " --help -h : Display this message"
|
||||
echo " --unpinned-deps -ud : Use unpinned conda environment"
|
||||
echo " --force -f : Skip prompt checking for tagged release/conda"
|
||||
echo " --skip-validate : DEPRECATED: Same functionality as --force"
|
||||
echo " --skip-conda : Skip conda env creation"
|
||||
echo " --skip-toolchain-extra : Skip building extra RISC-V toolchain collateral (Spike, PK, tests, libgloos)"
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
TOOLCHAIN="riscv-tools"
|
||||
USE_PINNED_DEPS=true
|
||||
FORCE_FLAG=""
|
||||
SKIP_CONDA=false
|
||||
SKIP_TOOLCHAIN=false
|
||||
|
||||
# getopts does not support long options, and is inflexible
|
||||
while [ "$1" != "" ];
|
||||
do
|
||||
case $1 in
|
||||
-h | --help )
|
||||
usage 3 ;;
|
||||
riscv-tools | esp-tools)
|
||||
TOOLCHAIN=$1 ;;
|
||||
-ud | --unpinned-deps )
|
||||
USE_PINNED_DEPS=false ;;
|
||||
--force | -f | --skip-validate)
|
||||
FORCE_FLAG=$1 ;;
|
||||
--skip-conda)
|
||||
SKIP_CONDA=true ;;
|
||||
--skip-toolchain-extra)
|
||||
SKIP_TOOLCHAIN=true ;;
|
||||
* )
|
||||
error "invalid option $1"
|
||||
usage 1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$SKIP_CONDA" = false ]; then
|
||||
# note: lock file must end in .conda-lock.yml - see https://github.com/conda-incubator/conda-lock/issues/154
|
||||
CONDA_REQS=$RDIR/conda-reqs
|
||||
CONDA_LOCK_REQS=$CONDA_REQS/conda-lock-reqs
|
||||
LOCKFILE=$CONDA_LOCK_REQS/conda-requirements-$TOOLCHAIN-linux-64.conda-lock.yml
|
||||
|
||||
if [ "$USE_PINNED_DEPS" = false ]; then
|
||||
# auto-gen the lockfile
|
||||
conda-lock -f $CONDA_REQS/chipyard.yaml -f $CONDA_REQS/$TOOLCHAIN.yaml --lockfile $LOCKFILE
|
||||
fi
|
||||
|
||||
# use conda-lock to create env
|
||||
conda-lock install -p $RDIR/.conda-env $LOCKFILE
|
||||
|
||||
source $RDIR/.conda-env/etc/profile.d/conda.sh
|
||||
conda activate $RDIR/.conda-env
|
||||
fi
|
||||
|
||||
if [ -z "$FORCE_FLAG" ]; then
|
||||
if [ -z ${CONDA_DEFAULT_ENV+x} ]; then
|
||||
error "ERROR: No conda environment detected. Did you activate the conda environment (e.x. 'conda activate base')?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
$RDIR/scripts/init-submodules-no-riscv-tools.sh $FORCE_FLAG
|
||||
|
||||
if [ "$SKIP_TOOLCHAIN" = false ]; then
|
||||
$RDIR/scripts/build-toolchain-extra.sh $FORCE_FLAG $TOOLCHAIN
|
||||
fi
|
||||
|
||||
$RDIR/scripts/gen-tags.sh
|
||||
|
||||
cat << EOT >> env.sh
|
||||
# line auto-generated by $0
|
||||
conda activate $RDIR/.conda-env
|
||||
source $RDIR/scripts/fix-open-files.sh
|
||||
EOT
|
||||
1
build-setup.sh
Symbolic link
1
build-setup.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
scripts/build-setup.sh
|
||||
100
scripts/build-setup.sh
Executable file
100
scripts/build-setup.sh
Executable file
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# exit script if any command fails
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
RDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
# get helpful utilities
|
||||
source $RDIR/scripts/utils.sh
|
||||
|
||||
common_setup
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0} [OPTIONS] [riscv-tools | esp-tools]"
|
||||
echo ""
|
||||
echo "Helper script to initialize repository that wraps other scripts."
|
||||
echo "Sets up conda environment, initializes submodules, and installs toolchain collateral."
|
||||
echo ""
|
||||
echo "Installation Types"
|
||||
echo " riscv-tools: if set, builds the riscv toolchain (this is also the default)"
|
||||
echo " esp-tools: if set, builds esp-tools toolchain used for the hwacha vector accelerator"
|
||||
echo ""
|
||||
echo "Options"
|
||||
echo " --help -h : Display this message"
|
||||
echo " --unpinned-deps -ud : Use unpinned conda environment"
|
||||
echo " --force -f : Skip prompt checking for tagged release/conda"
|
||||
echo " --skip-validate : DEPRECATED: Same functionality as --force"
|
||||
echo " --skip-conda : Skip conda env creation"
|
||||
echo " --skip-toolchain-extra : Skip building extra RISC-V toolchain collateral (Spike, PK, tests, libgloos)"
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
TOOLCHAIN="riscv-tools"
|
||||
USE_PINNED_DEPS=true
|
||||
FORCE_FLAG=""
|
||||
SKIP_CONDA=false
|
||||
SKIP_TOOLCHAIN=false
|
||||
|
||||
# getopts does not support long options, and is inflexible
|
||||
while [ "$1" != "" ];
|
||||
do
|
||||
case $1 in
|
||||
-h | --help )
|
||||
usage 3 ;;
|
||||
riscv-tools | esp-tools)
|
||||
TOOLCHAIN=$1 ;;
|
||||
-ud | --unpinned-deps )
|
||||
USE_PINNED_DEPS=false ;;
|
||||
--force | -f | --skip-validate)
|
||||
FORCE_FLAG=$1 ;;
|
||||
--skip-conda)
|
||||
SKIP_CONDA=true ;;
|
||||
--skip-toolchain-extra)
|
||||
SKIP_TOOLCHAIN=true ;;
|
||||
* )
|
||||
error "invalid option $1"
|
||||
usage 1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$SKIP_CONDA" = false ]; then
|
||||
# note: lock file must end in .conda-lock.yml - see https://github.com/conda-incubator/conda-lock/issues/154
|
||||
CONDA_REQS=$RDIR/conda-reqs
|
||||
CONDA_LOCK_REQS=$CONDA_REQS/conda-lock-reqs
|
||||
LOCKFILE=$CONDA_LOCK_REQS/conda-requirements-$TOOLCHAIN-linux-64.conda-lock.yml
|
||||
|
||||
if [ "$USE_PINNED_DEPS" = false ]; then
|
||||
# auto-gen the lockfile
|
||||
conda-lock -f $CONDA_REQS/chipyard.yaml -f $CONDA_REQS/$TOOLCHAIN.yaml --lockfile $LOCKFILE
|
||||
fi
|
||||
|
||||
# use conda-lock to create env
|
||||
conda-lock install -p $RDIR/.conda-env $LOCKFILE
|
||||
|
||||
source $RDIR/.conda-env/etc/profile.d/conda.sh
|
||||
conda activate $RDIR/.conda-env
|
||||
fi
|
||||
|
||||
if [ -z "$FORCE_FLAG" ]; then
|
||||
if [ -z ${CONDA_DEFAULT_ENV+x} ]; then
|
||||
error "ERROR: No conda environment detected. Did you activate the conda environment (e.x. 'conda activate base')?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
$RDIR/scripts/init-submodules-no-riscv-tools.sh $FORCE_FLAG
|
||||
|
||||
if [ "$SKIP_TOOLCHAIN" = false ]; then
|
||||
$RDIR/scripts/build-toolchain-extra.sh $FORCE_FLAG $TOOLCHAIN
|
||||
fi
|
||||
|
||||
$RDIR/scripts/gen-tags.sh
|
||||
|
||||
cat << EOT >> env.sh
|
||||
# line auto-generated by $0
|
||||
conda activate $RDIR/.conda-env
|
||||
source $RDIR/scripts/fix-open-files.sh
|
||||
EOT
|
||||
Reference in New Issue
Block a user