-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·108 lines (93 loc) · 2.04 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
function show_help {
echo "usage: $(basename "$0") $USAGE"
echo
echo "$LONG_USAGE"
exit 0
}
function check_okay {
if [ $? -ne 0 ]; then
echo
echo "installation failed..."
exit 1
fi
}
USAGE="[(-d|--directory) </path/to/top-level>]"
LONG_USAGE="With -d or --directory option, installs netJina libraries in </path/to/top-level/lib> and Fortran include (*.mod) files in </path/to/top-level/include>. If no option is given, the <top-level> directory is taken to be the current one."
THISDIR=`pwd`
ROOTDIR=$THISDIR
LIBDIR=""
MODDIR=""
DATADIR=""
LIBS="libnetJina.a"
MODS=( netjina_bdat.mod
netjina_def.mod
netjina_io.mod
netjina_lib.mod
netjina_storage.mod )
DATA_DBS=( reaclib_db
nuclib_db
starlib_db )
# process options
case "$1" in
-h|--help)
show_help
esac
while case "$#" in 0) break ;; esac
do
case "$1" in
-d|--directory)
shift
ROOTDIR="$1"
;;
esac
shift
done
LIBDIR=$ROOTDIR/lib
MODDIR=$ROOTDIR/include
DATADIR=$ROOTDIR/data
./build_and_test
echo
echo "Installing files"
echo "----------------"
if [ ! -d $LIBDIR ]; then
echo "making $LIBDIR"
mkdir -p $LIBDIR
check_okay
fi
echo "installing $LIBS to $LIBDIR..."
cp make/$LIBS $LIBDIR
check_okay
if [ ! -d $MODDIR ]; then
echo "making $MODDIR"
mkdir -p $MODDIR
check_okay
fi
echo "installing ${MODS[*]} to $MODDIR"
for src in ${MODS[*]}; do
cp make/$src $MODDIR
check_okay
done
if [ $ROOTDIR != $THISDIR ]; then
echo "installing ${DATA_DBS[*]} to $DATADIR"
if [ ! -d $DATADIR ]; then
echo "making $DATADIR"
mkdir -p $DATADIR
check_okay
fi
for src in ${DATA_DBS[*]}; do
cp data/$src $DATADIR
check_okay
done
mkdir -p $DATADIR/cache
check_okay
for src in ${DATA_DBS[*]}; do
cp data/cache/${src}.bin $DATADIR/cache
check_okay
done
fi
echo
echo "======================"
echo "Installation finished."
echo "======================"
echo