1 |
#!/bin/bash --norc |
2 |
THISDIR=`pwd` |
3 |
if [ $# -gt 0 ]; then |
4 |
I=1 |
5 |
NOENV="" |
6 |
INDIR="" |
7 |
YODA="" |
8 |
while [ $I -le $# ]; do |
9 |
if [ $I -eq 1 ]; then |
10 |
INPUT=$1 |
11 |
fi |
12 |
if [ $I -eq 2 ]; then |
13 |
INPUT=$2 |
14 |
fi |
15 |
if [ $I -eq 3 ]; then |
16 |
INPUT=$3 |
17 |
fi |
18 |
if [ $I -eq 4 ]; then |
19 |
INPUT=$4 |
20 |
fi |
21 |
if [ $I -eq 5 ]; then |
22 |
INPUT=$5 |
23 |
fi |
24 |
if [ $INPUT == "--clean" ]; then |
25 |
echo "" |
26 |
echo "" |
27 |
echo "============= MAKE DISTCLEAN ==================" |
28 |
echo "" |
29 |
make distclean |
30 |
cd $THISDIR &>/dev/null |
31 |
exit 0; |
32 |
fi |
33 |
if [ $INPUT == "--no-env" ]; then |
34 |
NOENV="1" |
35 |
fi |
36 |
if [ $INPUT == "--help" ] || [ $INPUT == "-h" ]; then |
37 |
echo "" |
38 |
echo " Usage: ./install.sh [options] " |
39 |
echo "" |
40 |
echo " Options: " |
41 |
echo "" |
42 |
echo " --no-env : compile and install without PAMELA environmental setup. " |
43 |
echo " In this case only standalone program will work and it will" |
44 |
echo " not possible to use the ROOT macros (they will NOT be " |
45 |
echo " installed). Notice that the executables will statically " |
46 |
echo " search for the calibration files in the given path." |
47 |
echo " If this option is set it is mandatory to give also" |
48 |
echo " the --install-dir and --with-yoda options." |
49 |
echo "" |
50 |
echo " --install-dir=[directory] : the directory were to install programs." |
51 |
echo " If not existing the following subdirectories will be created:" |
52 |
echo " lib/ include/ calib/ doc/ bin/" |
53 |
echo " To be able to use the compiled program you will need to add" |
54 |
echo " the [directory]/lib/ directory to your ld.so.conf file or to" |
55 |
echo " the LD_CONFIG_PATH environmental variable." |
56 |
echo "" |
57 |
echo " --with-yoda=[directory] : path to the YODA source. To compile" |
58 |
echo " programs you need the YODA header files that must be found in" |
59 |
echo " [directory]/include/yoda/ and the YODA library that must be in" |
60 |
echo " [directory]/lib/ ." |
61 |
echo "" |
62 |
echo " To compile and install using the PAMELA environmental setup you do not" |
63 |
echo " need any option and, if given, they will not be considered." |
64 |
echo "" |
65 |
echo "" |
66 |
exit 0 |
67 |
fi |
68 |
TEST=`echo $INPUT | sed 's/--install-dir=//g'` |
69 |
if [ $TEST != $INPUT ]; then |
70 |
INDIR=$TEST |
71 |
fi |
72 |
TEST=`echo $INPUT | sed 's/--with-yoda=//g'` |
73 |
if [ $TEST != $INPUT ]; then |
74 |
YODA=$TEST |
75 |
fi |
76 |
let I=$I+1 |
77 |
done |
78 |
if [ $NOENV ]; then |
79 |
if [ $YODA ]; then |
80 |
if [ $INDIR ]; then |
81 |
echo "" |
82 |
echo " Compiling and installing software _WITHOUT_ environmental setup " |
83 |
echo "" |
84 |
echo " WARNING: only standalone programs will work " |
85 |
echo "" |
86 |
echo "" |
87 |
rm -rf ${THISDIR}/target |
88 |
mkdir ${THISDIR}/target |
89 |
mkdir ${THISDIR}/target/macros |
90 |
mkdir ${THISDIR}/target/calib |
91 |
unset PAM_CCO |
92 |
export PAM_CCO=1 |
93 |
unset PAM_MACROS |
94 |
export PAM_MACROS=${THISDIR}/target/macros |
95 |
unset PAM_CALIB |
96 |
export PAM_CALIB=${THISDIR}/target/calib |
97 |
unset PAM_YODA |
98 |
export PAM_YODA=$INDIR |
99 |
if [ $YODA ]; then |
100 |
unset PAM_YODA |
101 |
export PAM_YODA=$YODA |
102 |
fi; |
103 |
if [ ! -d $INDIR ]; then |
104 |
mkdir $INDIR |
105 |
fi |
106 |
if [ ! -d $INDIR/bin/ ]; then |
107 |
mkdir $INDIR/bin/ |
108 |
fi |
109 |
unset PAM_BIN |
110 |
export PAM_BIN=$INDIR/bin/ |
111 |
if [ ! -d $INDIR/lib/ ]; then |
112 |
mkdir $INDIR/lib/ |
113 |
fi |
114 |
unset PAM_LIB |
115 |
export PAM_LIB=$INDIR/lib/ |
116 |
if [ ! -d $INDIR/include/ ]; then |
117 |
mkdir $INDIR/include/ |
118 |
fi |
119 |
unset PAM_INC |
120 |
export PAM_INC=$INDIR/include/ |
121 |
if [ ! -d $INDIR/doc/ ]; then |
122 |
mkdir $INDIR/doc/ |
123 |
fi |
124 |
unset PAM_DOC |
125 |
export PAM_DOC=$INDIR/doc/ |
126 |
fi |
127 |
fi; |
128 |
else |
129 |
echo "" |
130 |
echo " Compiling and installing software _USING_ the environmental setup " |
131 |
fi; |
132 |
else |
133 |
echo "" |
134 |
echo " Compiling and installing software _USING_ the environmental setup " |
135 |
fi; |
136 |
echo "" |
137 |
echo " WARNING: you will need to add ${PAM_LIB} " |
138 |
echo " to your LD_LIBRARY_PATH or to the /etc/ld.so.conf file" |
139 |
echo " You may also want to add ${PAM_BIN} to your PATH " |
140 |
echo "" |
141 |
sleep 5 |
142 |
# |
143 |
unset ARCH |
144 |
export ARCH=`uname` |
145 |
export THISDIR=`pwd` |
146 |
export LD_LIBRARY_PATH==$LD_LIBRARY_PATH:$PAM_LIB:$PAM_YODA/lib:$ROOTSYS/lib |
147 |
echo "" |
148 |
echo "" |
149 |
echo "============= COMPILING AND INSTALLING THE FLIGHT TRACKER QUICK LOOK PACKAGE =================" |
150 |
echo "" |
151 |
make distclean all upgrade |
152 |
cd $THISDIR &>/dev/null |
153 |
# |
154 |
rm -rf ${THISDIR}/target |