Project

General

Profile

Support #1129 » 51xboa.bash

Rogers, Chris, 07 September 2012 15:40

 
1
#!/usr/bin/env bash
2

    
3
directory=xboa-0.14.0
4
filename=${directory}.tar.gz
5
url=http://sourceforge.net/projects/xboa/files/${filename}/download
6

    
7
my_prefix=/install
8
my_destdir=${MAUS_ROOT_DIR}/third_party
9

    
10
if [ -n "${MAUS_ROOT_DIR+x}" ]; then
11

    
12
    if [ -e "${MAUS_ROOT_DIR}/third_party/source/${filename}" ]
13
    then
14
	echo "INFO: Found source archive in 'source' directory"
15
    else
16
	echo "INFO: Source archive doesn't exist.  Downloading..."
17

    
18
	wget ${url} -O "${MAUS_ROOT_DIR}/third_party/source/${filename}"
19
    fi
20
	
21
    if [ -e "${MAUS_ROOT_DIR}/third_party/source/${filename}" ]
22
    then
23
	echo "INFO: Source archive exists."
24
        echo
25
        echo "INFO: Checking MD5 checksum (otherwise the file didn't"
26
        echo "INFO: download properly):"
27
        echo
28
        cd "${MAUS_ROOT_DIR}/third_party/source"
29
        md5sum -c ${filename}.md5 || { echo "FATAL: Failed to download:" >&2; echo "FATAL: ${filename}." >&2; echo "FATAL: MD5 checksum failed.">&2; echo "FATAL: Try rerunning this command to redownload, or check" >&2; echo "FATAL: internet connection"  >&2; rm -f ${filename}; exit 1; }
30
        sleep 1
31
        echo
32
        echo "INFO: Unpacking:"
33
        echo
34
	rm -Rf "${MAUS_ROOT_DIR}/third_party/build/${directory}"
35
        sleep 1
36
        tar xvfz "${MAUS_ROOT_DIR}/third_party/source/${filename}" -C "${MAUS_ROOT_DIR}/third_party/build" > /dev/null
37
        cd "${MAUS_ROOT_DIR}/third_party/build/${directory}"
38
        echo "INFO: Building:"
39
        sleep 1
40
        python setup.py build
41
        echo "INFO: Installing within MAUS's third party directory:"
42
        sleep 1
43
        python setup.py install --prefix=${my_prefix} --root=${my_destdir}
44
	echo
45
        echo "INFO: The package should be locally build now in your"
46
        echo "INFO: third_party directory, which the rest of MAUS will"
47
        echo "INFO: find."
48
    else
49
        echo "FATAL: Source archive still doesn't exist.  Please file a bug report with your operating system,">&2
50
        echo "FATAL: distribution, and any other useful information at:" >&2
51
        echo "FATAL: " >&2
52
        echo "FATAL: http://micewww.pp.rl.ac.uk:8080/projects/maus/issues/" >&2
53
        echo "FATAL:" >&2
54
        echo "FATAL: Giving up, sorry..." >&2
55
	exit 1;
56
    fi
57

    
58
else
59
echo
60
echo "FATAL: MAUS_ROOT_DIR is not set, which is required to" >&2
61
echo "FATAL: know where to install this package.  You have two" >&2
62
echo "FATAL: options:" >&2
63
echo "FATAL:" >&2
64
echo "FATAL: 1. Set the MAUS_ROOT_DIR from the command line by" >&2
65
echo "FATAL: (if XXX is the directory where MAUS is installed):" >&2
66
echo "FATAL:" >&2
67
echo "FATAL:        MAUS_ROOT_DIR=XXX ${0}" >&2
68
echo "FATAL:" >&2
69
echo "FATAL: 2. Run the './configure' script in the MAUS ROOT" >&2
70
echo "FATAL: directory, run 'source env.sh' then rerun this" >&2
71
echo "FATAL: command ">&2
72
exit 1
73
fi
(4-4/5)