setup_externals.sh 2.71 KB
Newer Older
Tobias WEBER's avatar
Tobias WEBER committed
1
2
#!/bin/bash
#
Tobias WEBER's avatar
Tobias WEBER committed
3
# downloads external libraries for in20tools
Tobias WEBER's avatar
Tobias WEBER committed
4
5
# @author Tobias Weber <tweber@ill.fr>
# @date 6-apr-18
Tobias WEBER's avatar
Tobias WEBER committed
6
# @license GPLv3, see 'LICENSE' file
Tobias WEBER's avatar
Tobias WEBER committed
7
8
9
10
11
#

# -----------------------------------------------------------------------------
# tools
WGET=wget
Tobias WEBER's avatar
Tobias WEBER committed
12
TAR=tar
Tobias WEBER's avatar
Tobias WEBER committed
13
UZIP=unzip
Tobias WEBER's avatar
Tobias WEBER committed
14
15
16
17
18
19
# -----------------------------------------------------------------------------


# -----------------------------------------------------------------------------
# URLs for external libs
TLIBS=https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/tlibs.git/snapshot/tlibs-master.tar.bz2
Tobias WEBER's avatar
Tobias WEBER committed
20
QCP=https://www.qcustomplot.com/release/2.0.1/QCustomPlot-source.tar.gz
Tobias WEBER's avatar
Tobias WEBER committed
21
GEMMI=https://github.com/project-gemmi/gemmi/archive/master.zip
Tobias WEBER's avatar
Tobias WEBER committed
22
23
24
25

# local file names
TLIBS_LOCAL=${TLIBS##*[/\\]}
QCP_LOCAL=${QCP##*[/\\]}
Tobias WEBER's avatar
Tobias WEBER committed
26
GEMMI_LOCAL=${GEMMI##*[/\\]}
Tobias WEBER's avatar
Tobias WEBER committed
27
28
29
30
31
32
33
34
# -----------------------------------------------------------------------------


# -----------------------------------------------------------------------------
# cleans externals
function clean_dirs()
{
	rm -rf qcp
Tobias WEBER's avatar
Tobias WEBER committed
35
	rm -rf gemmi
Tobias WEBER's avatar
Tobias WEBER committed
36
37
38
39
40
}

function clean_files()
{
	rm -f ${QCP_LOCAL}
Tobias WEBER's avatar
Tobias WEBER committed
41
	rm -f ${GEMMI_LOCAL}
Tobias WEBER's avatar
Tobias WEBER committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
}
# -----------------------------------------------------------------------------


# -----------------------------------------------------------------------------
function dl_qcp()
{
	if ! ${WGET} ${QCP}
	then
		echo -e "Error downloading qcp.";
		exit -1;
	fi


Tobias WEBER's avatar
Tobias WEBER committed
56
	if ! ${TAR} xzvf ${QCP_LOCAL}
Tobias WEBER's avatar
Tobias WEBER committed
57
58
59
60
61
62
63
	then
		echo -e "Error extracting qcp.";
		exit -1;
	fi

	mv qcustomplot-source qcp
}
Tobias WEBER's avatar
Tobias WEBER committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


function dl_gemmi()
{
	if ! ${WGET} ${GEMMI}
	then
		echo -e "Error downloading gemmi.";
		exit -1;
	fi


	if ! ${UZIP} ${GEMMI_LOCAL}
	then
		echo -e "Error extracting gemmi.";
		exit -1;
	fi

	mv gemmi-master gemmi
}
Tobias WEBER's avatar
Tobias WEBER committed
83
84
85
# -----------------------------------------------------------------------------


Tobias WEBER's avatar
Tobias WEBER committed
86
mkdir -p ext
Tobias WEBER's avatar
Tobias WEBER committed
87
88
89
90
91
92
93
94
cd ext

echo -e "\n--------------------------------------------------------------------------------"
echo -e "Removing old libs...\n"
clean_dirs
clean_files
echo -e "--------------------------------------------------------------------------------\n"

95
#echo -e "\n--------------------------------------------------------------------------------"
96
97
#echo -e "Installing external qcustomplot library...\n"
#dl_qcp
98
#echo -e "--------------------------------------------------------------------------------\n"
Tobias WEBER's avatar
Tobias WEBER committed
99

Tobias WEBER's avatar
Tobias WEBER committed
100
101
102
103
104
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Installing external Gemmi library...\n"
dl_gemmi
echo -e "--------------------------------------------------------------------------------\n"

Tobias WEBER's avatar
Tobias WEBER committed
105
106
107
108
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Removing temporary files...\n"
clean_files
echo -e "--------------------------------------------------------------------------------\n"