FOSS-VG/setupenv.bashrc

118 lines
3.6 KiB
Plaintext
Raw Normal View History

2022-06-27 11:46:13 +02:00
# Copyright 2022, FOSS-VG Developers and Contributers
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, version 3.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# version 3 along with this program.
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
echo ">>> Loading shell environment for FOSS-VG development..."
export PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
echo "Project base directory is $PROJECT_BASE_DIR"
if [ -f "$PROJECT_BASE_DIR/.localenv.bashrc" ]; then
source "$PROJECT_BASE_DIR/.localenv.bashrc"
echo "Applied local environment customizations."
fi
2022-06-27 07:57:57 +02:00
alias clean="pushd \"$PROJECT_BASE_DIR\" >/dev/null 2>&1; scripts/clean.sh; popd >/dev/null 2>&1"
alias clean_dependencies="pushd \"$PROJECT_BASE_DIR\" >/dev/null 2>&1; scripts/clean_dependencies.sh; popd >/dev/null 2>&1"
alias setup_project="pushd \"$PROJECT_BASE_DIR\" >/dev/null 2>&1; scripts/setup_project.sh; popd >/dev/null 2>&1"
function run_tests {
pushd "$PROJECT_BASE_DIR" >/dev/null 2>&1
scripts/test.sh
popd >/dev/null 2>&1
}
function build {
pushd "$PROJECT_BASE_DIR" >/dev/null 2>&1
scripts/build.sh
popd >/dev/null 2>&1
}
echo "Added aliases and functions."
export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH"
if uname -s | tr [:upper:] [:lower:] | grep cygwin >/dev/null; then
echo "Adding cygwin workaound for library path."
2022-10-30 06:10:04 +01:00
export PATH="$PROJECT_BASE_DIR/bin/lib:$PATH"
fi
echo "PATH is $PATH"
if [ -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib
else
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib:"$LD_LIBRARY_PATH"
fi
echo "LD_LIBRARY_PATH is $LD_LIBRARY_PATH"
2022-09-11 10:11:17 +02:00
echo ">>> Checking for dependencies..."
MISSING_DEPS=0
if command -v wget > /dev/null 2>&1; then
true
else
if command -v curl > /dev/null 2>&1; then
true
else
2022-09-30 06:13:38 +02:00
echo "WARNING: \`wget\` or \`curl\` is needed to download some additional dependencies."
2022-09-11 10:11:17 +02:00
MISSING_DEPS=1
fi
fi
if command -v sha256sum > /dev/null 2>&1; then
true
else
if command -v sha256 > /dev/null 2>&1; then
true
else
2022-09-30 06:13:38 +02:00
echo "WARNING: Coreutils \`sha256sum\` or a \`sha256\` as found on NetBSD is needed to verify downloaded files."
2022-09-11 10:11:17 +02:00
MISSING_DEPS=1
fi
fi
if command -v gzip > /dev/null 2>&1; then
true
else
2022-09-30 06:13:38 +02:00
echo "WARNING: \`gzip\` is needed to decompress downloaded dependencies."
2022-09-11 10:11:17 +02:00
MISSING_DEPS=1
fi
if command -v tar > /dev/null 2>&1; then
true
else
2022-09-30 06:13:38 +02:00
echo "WARNING: \`tar\` is needed to unpack downloaded dependencies."
2022-09-11 10:11:17 +02:00
MISSING_DEPS=1
fi
if command -v cmake > /dev/null 2>&1; then
true
else
2022-09-30 06:13:38 +02:00
echo "WARNING: \`cmake\` is needed to build downloaded dependencies."
2022-09-11 10:11:17 +02:00
MISSING_DEPS=1
fi
if [ -z "$CXX" ]; then
if command -v c++ > /dev/null 2>&1; then
true
else
2022-09-30 06:13:38 +02:00
echo "WARNING: Your system does not appear to have a standard C++ compiler. If you have a C++ compiler installed, but not linked to \`c++\` on your PATH, set it manually using \`CXX=/path/to/your/compiler\`."
2022-09-11 10:11:17 +02:00
MISSING_DEPS=1
fi
fi
if [ "$MISSING_DEPS" -eq 0 ]; then
echo "All set."
fi
unset MISSING_DEPS