2017-08-24 23:53:16 +08:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
cd "$DIR"
|
2016-11-19 00:35:29 +08:00
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
source "$DIR/environment/util.sh"
|
|
|
|
|
2017-04-06 18:05:58 +08:00
|
|
|
function print_help () {
|
|
|
|
echo "Usage: $0 [OPTION]"
|
2020-11-13 03:18:11 +08:00
|
|
|
echo -e "Check for missing packages and setup the project.\n"
|
2017-04-06 18:05:58 +08:00
|
|
|
echo "Optional arguments:"
|
2022-02-03 20:03:35 +08:00
|
|
|
echo -e " -h\tdisplay this help and exit"
|
|
|
|
echo -e " --without-libs-setup\tskip the step for setting up libs"
|
2022-02-02 16:07:57 +08:00
|
|
|
echo -e " --wsl-quicklisp-proxy \"host:port\"\tquicklist HTTP proxy (this flag + HTTP proxy are required on WSL)"
|
2017-04-06 18:05:58 +08:00
|
|
|
}
|
|
|
|
|
2017-08-24 23:53:16 +08:00
|
|
|
function setup_virtualenv () {
|
|
|
|
pushd $1 > /dev/null
|
|
|
|
echo "Setting up virtualenv for: $1"
|
2017-04-06 18:05:58 +08:00
|
|
|
|
2017-08-24 23:53:16 +08:00
|
|
|
# remove old virtualenv
|
|
|
|
if [ -d ve3 ]; then
|
|
|
|
rm -rf ve3
|
|
|
|
fi
|
2017-04-06 18:05:58 +08:00
|
|
|
|
2017-08-24 23:53:16 +08:00
|
|
|
# create new virtualenv
|
2022-06-23 20:02:21 +08:00
|
|
|
python3 -m virtualenv -p python3 ve3 || exit 1
|
2017-08-24 23:53:16 +08:00
|
|
|
source ve3/bin/activate
|
2020-09-23 01:52:26 +08:00
|
|
|
pip --timeout 1000 install -r requirements.txt || exit 1
|
2017-08-24 23:53:16 +08:00
|
|
|
deactivate
|
|
|
|
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
2017-04-06 18:05:58 +08:00
|
|
|
|
2022-02-02 16:07:57 +08:00
|
|
|
wsl_quicklisp_proxy=""
|
2022-02-03 20:03:35 +08:00
|
|
|
setup_libs=true
|
|
|
|
if [[ $# -eq 1 && "$1" == "-h" ]]; then
|
2017-04-06 18:05:58 +08:00
|
|
|
print_help
|
2022-02-03 20:03:35 +08:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
while(($#)); do
|
|
|
|
case "$1" in
|
|
|
|
--wsl-quicklisp-proxy)
|
|
|
|
shift
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
echo "Missing proxy URL"
|
|
|
|
print_help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
wsl_quicklisp_proxy=":proxy \"http://$1/\""
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--without-libs-setup)
|
|
|
|
shift
|
|
|
|
setup_libs=false
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# unknown option
|
|
|
|
echo "Invalid argument provided: $1"
|
|
|
|
print_help
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2017-04-06 18:05:58 +08:00
|
|
|
fi
|
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
DISTRO=$(operating_system)
|
2022-04-07 21:23:18 +08:00
|
|
|
ARCHITECTURE=$(architecture)
|
2022-06-23 20:02:21 +08:00
|
|
|
if [ "${ARCHITECTURE}" = "arm64" ] || [ "${ARCHITECTURE}" = "aarch64" ]; then
|
2022-04-07 21:23:18 +08:00
|
|
|
OS_SCRIPT=$DIR/environment/os/$DISTRO-arm.sh
|
|
|
|
else
|
|
|
|
OS_SCRIPT=$DIR/environment/os/$DISTRO.sh
|
|
|
|
fi
|
|
|
|
echo "ALL BUILD PACKAGES: $($OS_SCRIPT list MEMGRAPH_BUILD_DEPS)"
|
|
|
|
$OS_SCRIPT check MEMGRAPH_BUILD_DEPS
|
2020-11-13 03:18:11 +08:00
|
|
|
echo "All packages are in-place..."
|
2017-04-06 18:05:58 +08:00
|
|
|
|
2017-03-06 23:15:20 +08:00
|
|
|
# create a default build directory
|
|
|
|
mkdir -p ./build
|
|
|
|
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
# quicklisp package manager for Common Lisp
|
|
|
|
quicklisp_install_dir="$HOME/quicklisp"
|
|
|
|
if [[ -v QUICKLISP_HOME ]]; then
|
|
|
|
quicklisp_install_dir="${QUICKLISP_HOME}"
|
|
|
|
fi
|
2018-10-15 17:01:57 +08:00
|
|
|
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
if [[ ! -f "${quicklisp_install_dir}/setup.lisp" ]]; then
|
|
|
|
wget -nv https://beta.quicklisp.org/quicklisp.lisp -O quicklisp.lisp || exit 1
|
|
|
|
echo \
|
|
|
|
"
|
|
|
|
(load \"${DIR}/quicklisp.lisp\")
|
2022-02-02 16:07:57 +08:00
|
|
|
(quicklisp-quickstart:install $wsl_quicklisp_proxy :path \"${quicklisp_install_dir}\")
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
" | sbcl --script || exit 1
|
|
|
|
rm -rf quicklisp.lisp || exit 1
|
|
|
|
fi
|
2018-10-18 17:34:37 +08:00
|
|
|
ln -Tfs "$DIR/src/lisp" "${quicklisp_install_dir}/local-projects/lcp"
|
2019-05-09 20:57:02 +08:00
|
|
|
# Install LCP dependencies
|
|
|
|
# TODO: We should at some point cache or have a mirror of packages we use.
|
|
|
|
# TODO: move the installation of LCP's dependencies into ./setup.sh
|
|
|
|
echo \
|
|
|
|
"
|
|
|
|
(load \"${quicklisp_install_dir}/setup.lisp\")
|
|
|
|
(ql:quickload '(:lcp :lcp/test) :silent t)
|
|
|
|
" | sbcl --script
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
|
2022-02-03 20:03:35 +08:00
|
|
|
if [[ "$setup_libs" == "true" ]]; then
|
|
|
|
# Setup libs (download).
|
|
|
|
cd libs
|
|
|
|
./cleanup.sh
|
|
|
|
./setup.sh
|
|
|
|
cd ..
|
|
|
|
fi
|
2016-11-19 00:35:29 +08:00
|
|
|
|
2020-11-24 20:09:14 +08:00
|
|
|
# setup gql_behave dependencies
|
|
|
|
setup_virtualenv tests/gql_behave
|
2017-07-21 19:09:22 +08:00
|
|
|
|
2017-08-02 16:48:33 +08:00
|
|
|
# setup stress dependencies
|
2017-08-24 23:53:16 +08:00
|
|
|
setup_virtualenv tests/stress
|
2017-08-02 16:48:33 +08:00
|
|
|
|
2019-09-11 22:39:35 +08:00
|
|
|
# setup integration/ldap dependencies
|
|
|
|
setup_virtualenv tests/integration/ldap
|
|
|
|
|
2021-01-16 02:04:44 +08:00
|
|
|
# Setup tests dependencies.
|
|
|
|
# cd tests
|
|
|
|
# ./setup.sh
|
|
|
|
# cd ..
|
|
|
|
# TODO(gitbuda): Remove setup_virtualenv, replace it with tests/ve3. Take care
|
|
|
|
# of the build order because tests/setup.py builds pymgclient which depends on
|
|
|
|
# mgclient which is build after this script by calling make.
|
|
|
|
|
2017-04-06 18:05:58 +08:00
|
|
|
echo "Done installing dependencies for Memgraph"
|
2020-10-06 19:57:33 +08:00
|
|
|
|
|
|
|
echo "Linking git hooks"
|
|
|
|
for hook in $(find $DIR/.githooks -type f -printf "%f\n"); do
|
|
|
|
ln -s -f "$DIR/.githooks/$hook" "$DIR/.git/hooks/$hook"
|
|
|
|
echo "Added $hook hook"
|
|
|
|
done;
|
2022-05-12 03:07:04 +08:00
|
|
|
|
|
|
|
# Install precommit hook
|
|
|
|
python3 -m pip install pre-commit
|
|
|
|
python3 -m pre_commit install
|
2022-07-12 16:54:23 +08:00
|
|
|
|
|
|
|
# Link `include/mgp.py` with `release/mgp/mgp.py`
|
|
|
|
ln -v -f include/mgp.py release/mgp/mgp.py
|