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
2022-08-16 13:55:42 +02:00
echo ">>> Loading shell environment for FOSS-VG development..."
2022-06-27 11:47:36 +02:00
2022-06-27 07:35:04 +02:00
PROJECT_BASE_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
2022-08-16 13:55:42 +02:00
echo "Project base directory is $PROJECT_BASE_DIR"
2022-06-27 07:35:04 +02:00
2022-09-30 17:53:11 +02:00
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"
2022-06-28 22:03:27 +02:00
function run_tests {
pushd "$PROJECT_BASE_DIR" >/dev/null 2>&1
scripts/test.sh
popd >/dev/null 2>&1
}
2022-06-27 07:35:04 +02:00
2022-06-27 09:01:52 +02:00
function build {
pushd "$PROJECT_BASE_DIR" >/dev/null 2>&1
2022-07-06 12:29:19 +02:00
scripts/build.sh
2022-06-27 09:01:52 +02:00
popd >/dev/null 2>&1
}
2022-08-16 13:55:42 +02:00
echo "Added aliases and functions."
2022-10-28 01:53:20 +02:00
export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH"
2022-08-16 13:55:42 +02:00
echo "PATH is $PATH"
2022-06-27 09:01:52 +02:00
2022-06-27 07:35:04 +02:00
if [ -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib
else
2022-06-28 18:06:24 +02:00
export LD_LIBRARY_PATH="$PROJECT_BASE_DIR"/bin/lib:"$LD_LIBRARY_PATH"
2022-06-27 07:35:04 +02:00
fi
2022-08-16 13:55:42 +02:00
echo "LD_LIBRARY_PATH is $LD_LIBRARY_PATH"
2022-06-27 07:35:04 +02:00
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