From 720a63aadfe9759792ea2500078c9ea04384b3e4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 5 Jun 2019 17:28:15 +0200 Subject: [PATCH] Bubblewrap and libcap install scripts --- INSTALL.rst | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ configure | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/INSTALL.rst b/INSTALL.rst index cc5b512a..baf7f051 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -45,6 +45,8 @@ Requirements - |ZeroMQ| : networking library - `GMP `_ : Gnu Multiple Precision Arithmetic Library - |OCaml| compiler with |OPAM| package manager +- `Bubblewrap `_ : Sandboxing tool required by Opam +- `libcap https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git`_ : POSIX capabilities required by Bubblewrap - |Ninja| : a parallel build system @@ -86,6 +88,8 @@ The following packages are supported by the :command:`configure` installer: * zeromq * f77zmq * gmp +* libcap +* bwrap * ocaml ( :math:`\approx` 10 minutes) * ezfio * docopt @@ -243,6 +247,55 @@ With Debian or Ubuntu, you can use sudo apt install libgmp-dev +libcap +------ + +Libcap is a library for getting and setting POSIX.1e draft 15 capabilities. + +* Download the latest version of libcap here: + ``_ + and move it in the :file:`${QP_ROOT}/external` directory + +* Extract the archive, go into the :file:`libcap-*/libcap` directory and run + the following command + +.. code:: bash + + prefix=$QP_ROOT make install + +With Debian or Ubuntu, you can use + +.. code:: bash + + sudo apt install libcap-dev + + +Bubblewrap +---------- + +Bubblewrap is an unprivileged sandboxing tool. + +* Download Bubblewrap here: + ``_ + and move it in the :file:`${QP_ROOT}/external` directory + +* Extract the archive, go into the :file:`bubblewrap-*` directory and run + the following commands + +.. code:: bash + + ./configure --prefix=$QP_ROOT && make -j 8 + make install-exec-am + + +With Debian or Ubuntu, you can use + +.. code:: bash + + sudo apt install bubblewrap + + + OCaml ----- diff --git a/configure b/configure index ffda5016..6600668a 100755 --- a/configure +++ b/configure @@ -175,7 +175,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then fi if [[ ${PACKAGES} = all ]] ; then - PACKAGES="zlib ninja irpf90 zeromq f77zmq gmp ocaml ezfio docopt resultsFile bats" + PACKAGES="bwrap libcap zlib ninja irpf90 zeromq f77zmq gmp ocaml ezfio docopt resultsFile bats" fi @@ -206,6 +206,32 @@ EOF make install EOF + elif [[ ${PACKAGE} = bwrap ]] ; then + + download \ + "https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz" \ + "${QP_ROOT}"/external/bwrap.tar.xz + execute << EOF + cd "\${QP_ROOT}"/external + tar --xz --extract --file bwrap.tar.xz + rm bwrap.tar.xz + cd bubblewrap* + ./configure --prefix=$QP_ROOT && make -j 8 + make install-exec-am +EOF + + elif [[ ${PACKAGE} = libcap ]] ; then + + download \ + "https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz" \ + "${QP_ROOT}"/external/libcap.tar.gz + execute << EOF + cd "\${QP_ROOT}"/external + tar --gunzip --extract --file libcap.tar.gz + rm libcap.tar.gz + cd libcap-*/libcap + prefix=$QP_ROOT make install +EOF elif [[ ${PACKAGE} = irpf90 ]] ; then @@ -399,6 +425,18 @@ if [[ ${ZLIB} = $(not_found) ]] ; then fail fi +BWRAP=$(find_exe bwrap) +if [[ ${BWRAP} = $(not_found) ]] ; then + error "Bubblewrap (bwrap) is not installed." + fail +fi + +LIBCAP=$(find_lib -lcap) +if [[ ${LIBCAP} = $(not_found) ]] ; then + error "Libcap (libcap) is not installed." + fail +fi + OPAM=$(find_exe opam) if [[ ${OPAM} = $(not_found) ]] ; then error "OPAM (ocaml) package manager is not installed."