view etc/setup_as_dml.sh @ 100:a4cd935561d4 dml-dockerised tip

small updates and version pin for cliopatria
author wolffd <wolffd.mail@googlemail.com>
date Fri, 29 Jun 2018 17:48:41 +0100
parents 81d8cac0a8b9
children
line wrap: on
line source
#!/bin/bash

# ------------------ CONFIG ----------------

INSTALL_SWI=yes
INSTALL_SWI_PACKS=yes
SS_USER=$DML_WGET_USER
SS_PASS=$DML_WGET_PASS
MAKE_HUMDRUM=yes

if [ -x matlab ]; then
	HAVE_MATLAB=yes
else
	HAVE_MATLAB=no
fi

# ------------------ END OF CONFIG ---------

function install_swi {
	# cd ~/downloads
	# wget http://www.swi-prolog.org/download/devel/src/pl-7.1.29.tar.gz
	# cd ~/src
	# tar xzf pl-7.1.29.tar.gz
	unpack_into ~/src http://www.swi-prolog.org/download/devel/src/pl-7.1.30.tar.gz
	cd ~/src/pl-7.1.30
	cp build.templ build
	patch build ~/etc/swipl-build.patch
	./build
	cd ~/src/swipl
        ./upgrade_swipl 7.3.9
}

function unpack_into {
	arname=$(basename "$2")
	wget_into ~/downloads "$2" && cd "$1" && tar xzf ~/downloads/$arname
}

function cp_into {
	name=$(basename "$2")
	mkdir -p "$1"
	wget_into ~/downloads "$2" && cp -p "$name" "$1"
}

function wget_into {
	name=$(basename "$2")
	mkdir -p "$1"
	cd "$1"
	if [ -a "$name" ]; then
		echo "Aready existing in $1: $2."
	else
#		echo "Please download from $2 and put it in $1."
#		exit 1
		echo "I am going to download into $1 from $2."
#		echo "You may be asked for a password."
#		wget --user=$DML_WGET_USER --password=$DML_WGET_PASS "$2"
		wget "$2"
	fi
}

function get_repo_into {
	dest="$1"
	repo="$3"
	cmd=$2
	shift 3

	name=$(basename "$repo")
	mkdir -p "$dest"
	cd "$dest"
	if [ -d $name ]; then
		echo "$name repository alread present in $dest"
	else
		$cmd clone "$repo" $* 
	fi
}

if [ $INSTALL_SWI == yes ]; then
	install_swi
fi

if [ $INSTALL_SWI_PACKS == yes ]; then
	swipl -g 'maplist(pack_install,[lambda,real,prosqlite,memo,callgraph,swipe,sparkle,musicbrainz,plsmf,plumdrum,sindice]), halt'
	if [ $HAVE_MATLAB == yes ]; then
		swipl -g 'pack_install(plml), halt'
	fi
fi

# DOWNLOADS FROM REPOs
get_repo_into ~/src/github git https://github.com/samer--/ClioPatria
cd ~/src/github/ClioPatria 
# git checkout dml
git checkout d868d5f978d665d2acb07ee83b640f05f2e9eaef #current dev cliopatria version (2016)
# git checkout 9f657262a4612748a5ef374d96a0257344e4032d #current VM clio version (2015)
get_repo_into ~/src/github git https://github.com/humdrum-tools/humdrum-tools --recursive
if [ $MAKE_HUMDRUM == yes ]; then
	cd ~/src/github/humdrum-tools && make
fi
# Added isearch - is this the correct source ? 
get_repo_into ~/src/github git https://github.com/samer--/isearch

# get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-cliopatria # private repo 
get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-open-cliopatria dml-cliopatria # public corresponding
get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/ishara # public repo
get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/kernscores-utf8 # public repo
# get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-datasets # private data

# cp_into ~/lib/beets https://code.soundsoftware.ac.uk/attachments/download/1284/music-ro.db

mkdir -p ~/var/dml/memo_db
cd ~/var/dml && tar xzf var-dml-cpack.tar.gz