Commit 2d0359aa authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Add a convenience script to install all dependencies in the current opam switch.

parent acb706f6
#!/bin/sh
#This script is used to initialize a freshly created opam switch
#with CDuce PINS
#Change these variables to suit your needs
GIT_REPO="git+https://gitlab.math.univ-paris-diderot.fr/cduce/cduce"
BRANCH="dune-switch"
PACKAGES="cduce-types cduce"
##
OPAM=`which opam`
SCRIPT_PATH=`dirname $0`
BASE_PATH="$(cd ${SCRIPT_PATH}/..; pwd)"
if test -z "$OPAM" ;
then
echo "Error: cannot find opam in PATH, is it installed ?"
exit 1
fi
DEPS="${PACKAGES}"
for p in $PACKAGES
do
OFILE="${BASE_PATH}/${p}.opam"
if test -f "$OFILE";
then
DEPS="${DEPS} $(opam show --file=${OFILE} -f depopts:,depends: |\
sed -e 's/[{][^}]*[}]\|[()|]\|^depopts:\|^depends://g' |\
sed -e 's/[^"]*["]\([^"]*\)["]/\1 /g' |\
xargs echo)"
else
echo "Error: cannot find opam file ${p}.opam in $(cd ${SCRIPT_PATH}/..; pwd)"
exit 2
fi
done
DEPS="$(for i in ${DEPS}; do echo "${i}"; done | sort -u | xargs echo)"
"$OPAM" pin -y --no-action add cduce-types "${GIT_REPO}#${BRANCH}"
"$OPAM" pin -y --no-action add cduce "${GIT_REPO}#${BRANCH}"
"$OPAM" install -y $DEPS
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment