forked from CNRGH/annotwg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·84 lines (70 loc) · 2.17 KB
/
install.sh
File metadata and controls
executable file
·84 lines (70 loc) · 2.17 KB
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
#!/usr/bin/env bash
err_report() {
echo "Error on ${BASH_SOURCE[0]} line $1" >&2
exit 1
}
trap 'err_report $LINENO' ERR
set -eo pipefail
declare NAME
NAME="$(basename "$0")"
readonly NAME
display_usage(){
echo "
USAGE:
${NAME} [options]
-p, --prefix Set prefix directory to install annotwg. Default: /usr/local
-d, --destdir Set destdir directory for a staged build. Default: ''
--home-install User installation in ${HOME}/.local (Incompatible with --prefix and --destdir options)
-h, --help Print this help message
DECRIPTION
${NAME} is for the installation of AnnotWG.
"
}
install_annotwg(){
local script
for script in bin/*; do
install -m755 "${script}" "${destdir}/${prefix}/bin"
done
#cp -r share "${destdir}/${prefix}"
}
main(){
local prefix='/usr/local'
local destdir
if (( $# == 0 )); then
echo 'Error any parameters provided!' 1>&2
display_usage
exit 1
fi
while (( $# > 0 )); do
case "$1" in
--home-install)
prefix="${HOME}/.local";;
-p|--prefix) prefix="$2"; shift ;;
-d|--destdir) destdir=$(readlink -m "$2"); shift ;;
-h|--help) display_usage; exit 0;;
*)
echo 'Error unknown parameter: '"$1" 1>&2
display_usage
exit 1 ;;
esac
shift
done
for dir_system in bin; do
if [[ ! -d "${destdir}/${prefix}/${dir_system}" ]]; then
mkdir -p "${destdir}/${prefix}/${dir_system}"
fi
done
#export CFLAGS+='-O3 -g -Wall -Wformat-security -Wp,-D_GLIBCXX_ASSERTIONS -fPIC -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables'
#export LD_LIBRARY_PATH="${destdir}/${prefix}/lib64/:${LD_LIBRARY_PATH}"
export PATH="${destdir}/${prefix}/bin:${PATH}"
echo '====================== Build and install AnnotWG ======================'
install_annotwg
if [[ -n ${destdir} ]]; then
echo '====================== File Hierarchy ======================'
tree "${destdir}";
fi
echo '====================== Environment variables ======================'
#echo -e "\tLD_LIBRARY_PATH: ${prefix}/lib64/"
echo -e "\tPATH: ${prefix}/bin"
}
main "$@"