setup_externals.sh 3.21 KB
Newer Older
Tobias WEBER's avatar
Tobias WEBER committed
1
2
#!/bin/bash
#
3
# downloads external libraries
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
22
MAGDATA=https://stokes.byu.edu/iso/magnetic_data.txt
Tobias WEBER's avatar
Tobias WEBER committed
23
24
25
26

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


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

function clean_files()
{
	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
57
}
# -----------------------------------------------------------------------------


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


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

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


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
}
85
86
87
88
89
90
91
92
93
94
95
96


function dl_magdata()
{
	if ! ${WGET} ${MAGDATA}
	then
		echo -e "Error downloading magnetic space group data.";
		exit -1;
	fi

	mv ${MAGDATA_LOCAL} magsg.dat
}
Tobias WEBER's avatar
Tobias WEBER committed
97
98
99
# -----------------------------------------------------------------------------


100
101
mkdir -pv data
mkdir -pv ext
Tobias WEBER's avatar
Tobias WEBER committed
102
103
104
105
106
107
108
109
cd ext

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

110
#echo -e "\n--------------------------------------------------------------------------------"
111
112
#echo -e "Installing external qcustomplot library...\n"
#dl_qcp
113
#echo -e "--------------------------------------------------------------------------------\n"
Tobias WEBER's avatar
Tobias WEBER committed
114

Tobias WEBER's avatar
Tobias WEBER committed
115
116
117
118
119
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Installing external Gemmi library...\n"
dl_gemmi
echo -e "--------------------------------------------------------------------------------\n"

120
121
122
123
#echo -e "\n--------------------------------------------------------------------------------"
#echo -e "Downloading magnetic space group data...\n"
#dl_magdata
#echo -e "--------------------------------------------------------------------------------\n"
124

Tobias WEBER's avatar
Tobias WEBER committed
125
126
127
128
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Removing temporary files...\n"
clean_files
echo -e "--------------------------------------------------------------------------------\n"