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 " If this option is set it is mandatory to give also" |
47 |
echo " the --install-dir and --with-yoda options." |
48 |
echo "" |
49 |
echo " --install-dir=[directory] : the directory were to install programs." |
50 |
echo " If not existing the following subdirectories will be created:" |
51 |
echo " lib/ include/ calib/ doc/ bin/" |
52 |
echo " To be able to use the compiled program you will need to add" |
53 |
echo " the [directory]/lib/ directory to your ld.so.conf file or to" |
54 |
echo " the LD_CONFIG_PATH environmental variable." |
55 |
echo "" |
56 |
echo " --with-yoda=[directory] : path to the YODA source. To compile" |
57 |
echo " programs you need the YODA header files that must be found in" |
58 |
echo " [directory]/include/yoda/ and the YODA library that must be in" |
59 |
echo " [directory]/lib/ ." |
60 |
echo "" |
61 |
echo " To compile and install using the PAMELA environmental setup you do not" |
62 |
echo " need any option and, if given, they will not be considered." |
63 |
echo "" |
64 |
echo "" |
65 |
exit 0 |
66 |
fi |
67 |
TEST=`echo $INPUT | sed 's/--install-dir=//g'` |
68 |
if [ $TEST != $INPUT ]; then |
69 |
INDIR=$TEST |
70 |
fi |
71 |
TEST=`echo $INPUT | sed 's/--with-yoda=//g'` |
72 |
if [ $TEST != $INPUT ]; then |
73 |
YODA=$TEST |
74 |
fi |
75 |
let I=$I+1 |
76 |
done |
77 |
if [ $NOENV ]; then |
78 |
if [ $YODA ]; then |
79 |
if [ $INDIR ]; then |
80 |
echo "" |
81 |
echo " Compiling and installing software _WITHOUT_ environmental setup " |
82 |
echo "" |
83 |
echo " WARNING: only standalone programs will work " |
84 |
echo "" |
85 |
echo "" |
86 |
rm -rf ${THISDIR}/target |
87 |
mkdir ${THISDIR}/target |
88 |
mkdir ${THISDIR}/target/macros |
89 |
unset PAM_CCO |
90 |
export PAM_CCO=1 |
91 |
unset PAM_MACROS |
92 |
export PAM_MACROS=${THISDIR}/target/macros |
93 |
unset PAM_YODA |
94 |
export PAM_YODA=$INDIR |
95 |
if [ $YODA ]; then |
96 |
unset PAM_YODA |
97 |
export PAM_YODA=$YODA |
98 |
fi; |
99 |
if [ ! -d $INDIR ]; then |
100 |
mkdir $INDIR |
101 |
fi |
102 |
if [ ! -d $INDIR/bin/ ]; then |
103 |
mkdir $INDIR/bin/ |
104 |
fi |
105 |
unset PAM_BIN |
106 |
export PAM_BIN=$INDIR/bin/ |
107 |
if [ ! -d $INDIR/lib/ ]; then |
108 |
mkdir $INDIR/lib/ |
109 |
fi |
110 |
unset PAM_LIB |
111 |
export PAM_LIB=$INDIR/lib/ |
112 |
if [ ! -d $INDIR/include/ ]; then |
113 |
mkdir $INDIR/include/ |
114 |
fi |
115 |
unset PAM_INC |
116 |
export PAM_INC=$INDIR/include/ |
117 |
if [ ! -d $INDIR/doc/ ]; then |
118 |
mkdir $INDIR/doc/ |
119 |
fi |
120 |
unset PAM_DOC |
121 |
export PAM_DOC=$INDIR/doc/ |
122 |
unset PAM_CALIB |
123 |
export PAM_CALIB=$INDIR/calib/ |
124 |
fi |
125 |
fi; |
126 |
else |
127 |
echo "" |
128 |
echo " Compiling and installing software _USING_ the environmental setup " |
129 |
fi; |
130 |
else |
131 |
echo "" |
132 |
echo " Compiling and installing software _USING_ the environmental setup " |
133 |
fi; |
134 |
echo "" |
135 |
echo " WARNING: you will need to add ${PAM_LIB} " |
136 |
echo " to your LD_LIBRARY_PATH or to the /etc/ld.so.conf file" |
137 |
echo " You may also want to add ${PAM_BIN} to your PATH " |
138 |
echo "" |
139 |
# |
140 |
unset ARCH |
141 |
export ARCH=`uname` |
142 |
export THISDIR=`pwd` |
143 |
export LD_LIBRARY_PATH==$LD_LIBRARY_PATH:$PAM_LIB:$PAM_YODA/lib:$ROOTSYS/lib |
144 |
echo "" |
145 |
echo "" |
146 |
echo "============= COMPILING AND INSTALLING THE ToFQLOOK PACKAGE =================" |
147 |
echo "" |
148 |
make distclean all upgrade |
149 |
cd $THISDIR &>/dev/null |
150 |
# |
151 |
rm -rf ${THISDIR}/target |