memgraph/init

147 lines
4.0 KiB
Plaintext
Raw Normal View History

#!/bin/bash -e
required_pkgs=(git arcanist # source code control
cmake clang-3.9 llvm-3.9 pkg-config # build system
curl wget # for downloading libs
uuid-dev default-jre-headless # required by antlr
libreadline-dev # for memgraph console
libssl-dev
libseccomp-dev
python3 python-virtualenv python3-pip # for qa, macro_benchmark and stress tests
uuid-dev # mg-utils
libcurl4-openssl-dev # mg-requests
libldap2-dev # mg-auth
sbcl # for custom Lisp C++ preprocessing
)
optional_pkgs=(clang-format # source code formatting
doxygen graphviz # source documentation generators
php-cli # for user technical documentation generators
mono-runtime mono-mcs nodejs # for driver tests
)
use_sudo=0
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
2016-11-19 00:35:29 +08:00
function print_help () {
echo "Usage: $0 [OPTION]"
echo -e "Check for missing packages and install them if possible.\n"
echo "Optional arguments:"
echo -e " -s\tuse sudo apt-get for installing packages"
echo -e " -h\tdisplay this help and exit"
}
function setup_virtualenv () {
pushd $1 > /dev/null
echo "Setting up virtualenv for: $1"
# remove old virtualenv
if [ -d ve3 ]; then
rm -rf ve3
fi
# create new virtualenv
virtualenv -p python3 ve3 || exit 1
source ve3/bin/activate
# we need to increase the timeout for pip because our local cache server
# can sometimes be stupid, see: https://github.com/devpi/devpi/issues/208
pip --timeout 1000 install -i http://deps.memgraph.io:3141/root/pypi \
--trusted-host deps.memgraph.io -r requirements.txt || exit 1
deactivate
popd > /dev/null
}
if [[ $# -gt 1 ]]; then
print_help
exit 1
elif [[ $# -eq 1 ]]; then
case "$1" in
-s)
use_sudo=1
;;
-h)
print_help
exit 0
;;
*)
# unknown option
print_help
exit 1
;;
esac
fi
echo "Started installing dependencies for Memgraph"
required_missing=0
# install all dependencies on debian based operating systems
for pkg in ${required_pkgs[@]}; do
if dpkg -s $pkg 2>/dev/null >/dev/null; then
echo "Found $pkg"
elif (( $use_sudo )); then
echo "Installing $pkg"
if [[ ! `sudo apt-get -y install $pkg` ]]; then
echo "Didn't install $pkg [required]"
required_missing=1
fi
else
echo "Missing $pkg [required]"
required_missing=1
fi
done
for pkg in ${optional_pkgs[@]}; do
if dpkg -s $pkg 2>/dev/null >/dev/null; then
echo "Found $pkg [optional]"
else
echo "Missing $pkg [optional]"
fi
done
2016-11-19 00:35:29 +08:00
if (( $required_missing )); then
echo "Missing required packages. EXITING!"
echo "Please, install required packages and rerun $0 again."
exit 2
fi
# create a default build directory
mkdir -p ./build
# quicklisp package manager for Common Lisp
Replace boost with capnp in RPC Summary: Converts the RPC stack to use Cap'n Proto for serialization instead of boost. There are still some traces of boost in other places in the code, but most of it is removed. A future diff should cleanup boost for good. The RPC API is now changed to be more flexible with regards to how serialize data. This makes the simplest cases a bit more verbose, but allows complex serialization code to be correctly written instead of relying on hacks. (For reference, look for the old serialization of `PullRpc` which had a nasty pointer hacks to inject accessors in `TypedValue`.) Since RPC messages were uselessly modeled via inheritance of Message base class, that class is now removed. Furthermore, that approach doesn't really work with Cap'n Proto. Instead, each message type is required to have some type information. This can be automated, so `define-rpc` has been added to LCP, which hopefully simplifies defining new RPC request and response messages. Specify Cap'n Proto schema ID in cmake This preserves Cap'n Proto generated typeIds across multiple generations of capnp schemas through LCP. It is imperative that typeId stays the same to ensure that different compilations of Memgraph may communicate via RPC in a distributed cluster. Use CLOS for meta information on C++ types in LCP Since some structure slots and functions have started to repeat themselves, it makes sense to model C++ meta information via Common Lisp Object System. Depends on D1391 Reviewers: buda, dgleich, mferencevic, mtomic, mculinovic, msantl Reviewed By: msantl Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1407
2018-06-04 15:48:48 +08:00
# TODO: We should at some point cache or have a mirror of packages we use.
quicklisp_install_dir="$HOME/quicklisp"
if [[ -v QUICKLISP_HOME ]]; then
quicklisp_install_dir="${QUICKLISP_HOME}"
fi
# TODO: move the installation of LCP's dependencies into ./setup.sh
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\")
(quicklisp-quickstart:install :path \"${quicklisp_install_dir}\")
(ql:quickload '(:cl-ppcre :prove) :silent t)
" | sbcl --script || exit 1
rm -rf quicklisp.lisp || exit 1
fi
ln -Tfs "$DIR/src/lisp" "${quicklisp_install_dir}/local-projects/lcp"
# setup libs (download)
2016-11-19 00:35:29 +08:00
cd libs
./cleanup.sh
2016-11-19 00:35:29 +08:00
./setup.sh
cd ..
# setup qa dependencies
setup_virtualenv tests/qa
# setup stress dependencies
setup_virtualenv tests/stress
echo "Done installing dependencies for Memgraph"