1 |
#!/bin/bash |
2 |
# |
3 |
# ccf-setup.sh |
4 |
# |
5 |
# Setup to build CCF from user's home |
6 |
# |
7 |
# $Id: ccf-setup.sh,v 1.8 2017/12/22 10:44:11 ccflib Exp $ |
8 |
|
9 |
|
10 |
host=`hostname | cut -d. -f1` |
11 |
|
12 |
# We can produce CCF on |
13 |
# 1) a user's workstation |
14 |
# 2) a SAS builder |
15 |
# 3) the XMM-Newton external web server xvsoc01 |
16 |
# |
17 |
# For SAS we take for all cases the latest SAS, unless is not working |
18 |
|
19 |
GNUVER="6.2" |
20 |
|
21 |
case "$host" in |
22 |
sasbld0[1,4]n) |
23 |
refhost=$host |
24 |
export CCFLIB_HOME=/home/ccflib |
25 |
;; |
26 |
xmac01|xmac03|xmc04) |
27 |
refhost=$host |
28 |
export CCFLIB_HOME=/xdata/ccflib |
29 |
;; |
30 |
xvsoc01) |
31 |
refhost=$host |
32 |
export CCFLIB_HOME=/data/xmm/ccflib |
33 |
;; |
34 |
*) |
35 |
refhost="sasbld01n" |
36 |
# Check that /ccfbuild is in fact available |
37 |
where=`pwd` |
38 |
cd /ccfbuild 2> /dev/null |
39 |
if [ "$?" != "0" ] ; then |
40 |
export CCFLIB_HOME=/xdata/ccflib |
41 |
else |
42 |
export CCFLIB_HOME=/ccfbuild |
43 |
fi |
44 |
cd $where |
45 |
;; |
46 |
esac |
47 |
|
48 |
if [ -z "$CCFLIB_HOME" ] ; then |
49 |
echo "Error: Undefined $CCFLIB_HOME - Fix your environment!" |
50 |
return |
51 |
fi |
52 |
|
53 |
# Define where is the CCF development software |
54 |
|
55 |
export CCFDEV=${CCFLIB_HOME}/ccfdev |
56 |
|
57 |
if [ ! -d "${CCFDEV}" ] ; then |
58 |
echo "Error: ccf-setup.sh: ${CCFDEV} not found ! - Abort" |
59 |
return |
60 |
fi |
61 |
|
62 |
# Set the CVS access to CCF package repository |
63 |
|
64 |
export CVSROOT=${CCFLIB_HOME}/ccfcvs |
65 |
|
66 |
|
67 |
# Heasoft |
68 |
|
69 |
case "$host" in |
70 |
|
71 |
# Heasoft is not available in xvsoc01 |
72 |
|
73 |
xvsoc01) export LHEASOFT=1 |
74 |
;; |
75 |
|
76 |
|
77 |
# For the time being we force to use the Heasoft installation used for SAS 15 |
78 |
|
79 |
xmac01|xmac03|xmac04) |
80 |
export PATH=/sasbuild/local/${host}/GNU_CC_CXX_4.8.5_Yosemite/perl/bin:$PATH |
81 |
unset PERL5LIB |
82 |
export HEADAS=/sasbuild/local/${host}/GNU_CC_CXX_4.8.5_Yosemite/headas/architecture |
83 |
if [ ! -d "$HEADAS" ] ; then |
84 |
echo "ccf-setup.sh: ${HEADAS} does not exist - Abort" |
85 |
return |
86 |
fi |
87 |
. ${HEADAS}/headas-init.sh ;; |
88 |
|
89 |
|
90 |
# Temporary fix: The SAS 16 and 16.1 deceit and ccfextseq tasks do not work |
91 |
# We must use SAS 15 which is not depending on GNUVER |
92 |
|
93 |
*) |
94 |
|
95 |
#export HEADAS=/sasbuild/local/${refhost}/GNU_CC_CXX_${GNUVER}/headas/architecture |
96 |
export PATH=${CCFLIB_HOME}/perl5/perlbrew/perls/perl-5.18.4/bin:${PATH} |
97 |
unset PERL5LIB |
98 |
export HEADAS="/sasbuild/local/sasbld02/headas/architecture" |
99 |
if [ ! -d "$HEADAS" ] ; then |
100 |
echo "ccf-setup.sh: ${HEADAS} does not exist - Abort" |
101 |
return |
102 |
fi |
103 |
. ${HEADAS}/headas-init.sh |
104 |
;; |
105 |
|
106 |
esac |
107 |
|
108 |
# SAS |
109 |
|
110 |
|
111 |
case "$refhost" in |
112 |
# Use an old SAS which still works fine! |
113 |
xvsoc01) export SAS_DIR=${CCFLIB_HOME}/xmmsas_20020413_2031 |
114 |
export SAS_PATH=$SAS_DIR |
115 |
. $SAS_DIR/sas-setup.sh |
116 |
;; |
117 |
|
118 |
# For the time being we force to use SAS 15 given that deceit does not work on SAS 16 |
119 |
# For Linux, the installation of SAS is local to CCFLIB_HOME under local/SAS |
120 |
# This installation has been made with perl 5.18.4 as SAS_PERL so we use it. |
121 |
|
122 |
sasbld01n|sasbld02n|sasbld03n|sasbld04n) |
123 |
|
124 |
#/sas/bin/confsas |
125 |
#. $HOME/setsas.sh 1> /dev/null |
126 |
# For the time being we force to use SAS 15 given that deceit does not work on SAS 16 |
127 |
# The installation of SAS is local to CCFLIB_HOME under local/SAS |
128 |
# This installation has been made with perl 5.18.4 as SAS_PERL so we use it. |
129 |
|
130 |
. ${CCFLIB_HOME}/local/SAS/xmmsas_20160201_1833/setsas.sh 1> /dev/null |
131 |
;; |
132 |
|
133 |
xmac01) |
134 |
. |
135 |
;; |
136 |
|
137 |
*) |
138 |
echo "Please use a Linux workstation to process CCF!" |
139 |
return |
140 |
;; |
141 |
|
142 |
esac |
143 |
|
144 |
export SAS_MEMORY_MODEL=Low |
145 |
|
146 |
# Adds some useful perl modules. |
147 |
# |
148 |
# PERL5LIB includes so far the HEADAS and SAS perl5 subdirs |
149 |
|
150 |
if [ ! -z $PERL5LIB ]; then |
151 |
export PERL5LIB=${CCFLIB_HOME}/perl:${PERL5LIB} |
152 |
else |
153 |
export PERL5LIB=${CCFLIB_HOME}/perl |
154 |
fi |
155 |
|
156 |
# From CCFDEV/setup.sh |
157 |
|
158 |
export PERL5LIB=${CCFDEV}/lib/perl5:${PERL5LIB} |
159 |
|
160 |
|
161 |
# Add the scripts in $CCFLIB_HOME/bin and $CCFLIB_HOME/lib (for example uploadccf) to PATH |
162 |
|
163 |
export PATH=${CCFLIB_HOME}/bin:${CCFLIB_HOME}/ccfdev/bin:${CCFLIB_HOME}/ccfdev/lib:${PATH} |
164 |
|
165 |
# Unset MAKE if set |
166 |
|
167 |
if [ ! -z "$MAKE" ] ; then |
168 |
echo "ccf-setup.sh, WARNING: Your environment sets MAKE=$MAKE. It will be unset." |
169 |
unset MAKE |
170 |
fi |
171 |
|
172 |
# Show it |
173 |
|
174 |
echo |
175 |
echo "Heasoft & SAS reference information" |
176 |
echo "===================================" |
177 |
echo |
178 |
echo "HEADAS = $HEADAS" |
179 |
echo "Heasoft version = "`fversion` |
180 |
echo |
181 |
echo |
182 |
sasversion -V 2 |
183 |
|
184 |
echo |
185 |
echo "CCF building tools" |
186 |
echo "==================" |
187 |
echo |
188 |
deceit -v |
189 |
ccfextseq -v |
190 |
echo |
191 |
echo "CCF development environment" |
192 |
echo "===========================" |
193 |
echo |
194 |
echo "CCFLIB_HOME = $CCFLIB_HOME" |
195 |
echo "CCFDEV = $CCFDEV" |
196 |
echo "CCF repository = $CVSROOT" |
197 |
echo |
198 |
echo "*** Ready !" |
199 |
echo |