view etc/setup_as_dml.sh @ 17:0cf66a1e3919

Adding ILM stuff in progress.
author samer
date Mon, 26 Jan 2015 13:56:59 +0000
parents ef88a4afac7a
children 11e21255b404
line wrap: on
line source
#!/bin/sh
# ------------------ CONFIG ----------------

INSTALL_SWI=no
SS_USER=<DML_USER_NAME HERE>
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.29.tar.gz
	cd ~/src/pl-7.1.29
	cp build.templ build
	patch build ~/etc/swipl-build.patch
	./build
}

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=$SS_USER --ask-password "$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,prosqlite,memo,callgraph,swipe,sparkle,musicbrainz,plsmf,plumdrum,sindice]), halt'
	if [ $HAVE_MATLAB == yes ]; then
		swipl -g 'pack_install(plml), halt'
	end
fi

# DOWNLOADS FROM REPOs
get_repo_into ~/src/github git https://github.com/samer--/ClioPatria
cd ~/src/github/ClioPatria && git checkout dml
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

get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-cliopatria
get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/ishara
get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/kernscores-utf8
get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-datasets

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

mkdir -p ~/var/dml/memo_db