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 |
unset PAM_CCO |
91 |
export PAM_CCO=1 |
92 |
unset PAM_MACROS |
93 |
export PAM_MACROS=${THISDIR}/target/macros |
94 |
unset PAM_YODA |
95 |
export PAM_YODA=$INDIR |
96 |
if [ $YODA ]; then |
97 |
unset PAM_YODA |
98 |
export PAM_YODA=$YODA |
99 |
fi; |
100 |
if [ ! -d $INDIR ]; then |
101 |
mkdir $INDIR |
102 |
fi |
103 |
if [ ! -d $INDIR/bin/ ]; then |
104 |
mkdir $INDIR/bin/ |
105 |
fi |
106 |
unset PAM_BIN |
107 |
export PAM_BIN=$INDIR/bin/ |
108 |
if [ ! -d $INDIR/lib/ ]; then |
109 |
mkdir $INDIR/lib/ |
110 |
fi |
111 |
unset PAM_LIB |
112 |
export PAM_LIB=$INDIR/lib/ |
113 |
if [ ! -d $INDIR/include/ ]; then |
114 |
mkdir $INDIR/include/ |
115 |
fi |
116 |
unset PAM_INC |
117 |
export PAM_INC=$INDIR/include/ |
118 |
if [ ! -d $INDIR/calib/ ]; then |
119 |
mkdir $INDIR/calib/ |
120 |
fi |
121 |
unset PAM_CALIB |
122 |
export PAM_CALIB=$INDIR/calib/ |
123 |
if [ ! -d $INDIR/doc/ ]; then |
124 |
mkdir $INDIR/doc/ |
125 |
fi |
126 |
unset PAM_DOC |
127 |
export PAM_DOC=$INDIR/doc/ |
128 |
fi |
129 |
fi; |
130 |
else |
131 |
echo "" |
132 |
echo " Compiling and installing software _USING_ the environmental setup " |
133 |
fi; |
134 |
else |
135 |
echo "" |
136 |
echo " Compiling and installing software _USING_ the environmental setup " |
137 |
fi; |
138 |
echo "" |
139 |
echo " WARNING: you will need to add ${PAM_LIB} " |
140 |
echo " to your LD_LIBRARY_PATH or to the /etc/ld.so.conf file" |
141 |
echo " You may also want to add ${PAM_BIN} to your PATH " |
142 |
echo "" |
143 |
sleep 5 |
144 |
# |
145 |
unset ARCH |
146 |
export ARCH=`uname` |
147 |
export THISDIR=`pwd` |
148 |
export LD_LIBRARY_PATH==$LD_LIBRARY_PATH:$PAM_LIB:$PAM_YODA/lib:$ROOTSYS/lib |
149 |
echo "" |
150 |
echo "" |
151 |
echo "============= COMPILING AND INSTALLING THE EVENTVIEWER PACKAGE =================" |
152 |
echo "" |
153 |
make distclean all upgrade |
154 |
cd $THISDIR &>/dev/null |
155 |
# |
156 |
rm -rf ${THISDIR}/target |