setup_externals.sh 3.21 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
35
# -----------------------------------------------------------------------------


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

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


# -----------------------------------------------------------------------------
function dl_tlibs()
{
	if ! ${WGET} ${TLIBS}
	then
		echo -e "Error downloading tlibs.";
		exit -1;
	fi

Tobias WEBER's avatar
Tobias WEBER committed
57
	if ! ${TAR} xjvf ${TLIBS_LOCAL}
Tobias WEBER's avatar
Tobias WEBER committed
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	then
		echo -e "Error extracting tlibs.";
		exit -1;
	fi

	mv tlibs-master tlibs
}


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


Tobias WEBER's avatar
Tobias WEBER committed
76
	if ! ${TAR} xzvf ${QCP_LOCAL}
Tobias WEBER's avatar
Tobias WEBER committed
77
78
79
80
81
82
83
	then
		echo -e "Error extracting qcp.";
		exit -1;
	fi

	mv qcustomplot-source qcp
}
Tobias WEBER's avatar
Tobias WEBER committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102


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
103
104
105
# -----------------------------------------------------------------------------


Tobias WEBER's avatar
Tobias WEBER committed
106
mkdir -p ext
Tobias WEBER's avatar
Tobias WEBER committed
107
108
109
110
111
112
113
114
cd ext

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

115
116
117
118
#echo -e "\n--------------------------------------------------------------------------------"
#echo -e "Installing external tlibs library...\n"
#dl_tlibs
#echo -e "--------------------------------------------------------------------------------\n"
Tobias WEBER's avatar
Tobias WEBER committed
119
120
121
122
123
124

echo -e "\n--------------------------------------------------------------------------------"
echo -e "Installing external qcustomplot library...\n"
dl_qcp
echo -e "--------------------------------------------------------------------------------\n"

Tobias WEBER's avatar
Tobias WEBER committed
125
126
127
128
129
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Installing external Gemmi library...\n"
dl_gemmi
echo -e "--------------------------------------------------------------------------------\n"

Tobias WEBER's avatar
Tobias WEBER committed
130
131
132
133
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Removing temporary files...\n"
clean_files
echo -e "--------------------------------------------------------------------------------\n"