ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.17
Committed: Tue Jul 18 08:44:46 2006 UTC (18 years, 9 months ago) by eulisse
Branch: MAIN
CVS Tags: for080_amd64
Changes since 1.16: +1 -1 lines
Log Message:
bashism in csh code.

File Contents

# User Rev Content
1 eulisse 1.1 ### RPM cms cms-env 1.0
2     Source: cmsos
3     %prep
4     %build
5     echo $SCRAM_ROOT
6     %install
7     %define scramroot %(echo $SCRAM_ROOT)
8     %define scramv1root %(echo $SCRAMV1_ROOT)
9    
10     mkdir -p %instroot/bin
11     install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
12 eulisse 1.5 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
13    
14 eulisse 1.9 ### BASH code
15    
16 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
17     export PATH=%instroot/bin:$PATH
18     export LD_LIBRARY_PATH=%instroot/lib:$LD_LIBRARY_PATH
19     export DYLD_FALLBACK_LIBRARY_PATH=%instroot/lib:$DYLD_FALLBACK_LIBRARY
20 eulisse 1.4 SCRAM_ARCH=$(cmsos)
21 eulisse 1.2
22     # We need to assume 1 compiler per platform.
23     # There is no other way around this.
24     case $SCRAM_ARCH in
25     slc3_ia32) compilerv=gcc323;;
26     slc3_amd64) compilerv=gcc345;;
27     osx104_ia32) compilerv=gcc400;;
28     osx104_pcc32) compilerv=gcc400;;
29     esac
30     SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
31 eulisse 1.15
32     if [ $# -gt 0 ]
33     then
34     SCRAM_ARCH=$1
35     fi
36    
37 eulisse 1.4 export SCRAM_ARCH
38 eulisse 1.2
39 eulisse 1.16 here=%{instroot}
40    
41 eulisse 1.10 if [ "$VO_CMS_SW_DIR" != "" ]
42     then
43 eulisse 1.9 here=$VO_CMS_SW_DIR
44     else
45 eulisse 1.12 if [ "$OSG_APP" != "" ]
46     then
47     here=$OSG_APP/cmssoft/cms
48     fi
49 eulisse 1.10 fi
50 eulisse 1.9
51 eulisse 1.14 if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
52 eulisse 1.13 then
53     echo "Your shell is not able to find where cmsset_default.sh is. Either cd into the directory where it is or move to zsh"
54     exit 1
55     fi
56 eulisse 1.9
57 eulisse 1.15 for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
58 eulisse 1.5 do
59     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
60     done
61 eulisse 1.11 export CMS_PATH=$here
62 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
63    
64 eulisse 1.9
65     ### CSH code
66    
67 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
68 eulisse 1.7
69 eulisse 1.4 if (${?PATH}) then
70     setenv PATH %instroot/bin:$PATH
71     else
72     setenv PATH %instroot/bin
73     endif
74    
75     if (${?LD_LIBRARY_PATH}) then
76     setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
77     else
78     setenv LD_LIBRARY_PATH %instroot/lib
79     endif
80    
81     if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
82     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
83     else
84     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
85     endif
86    
87     setenv CMSOSCOMMAND `which cmsos`
88     setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
89     setenv compilerv gcc323
90     switch ( ${SCRAM_ARCH} )
91 eulisse 1.2 case slc3_ia32:
92     setenv compilerv gcc323
93     breaksw
94     case slc3_amd64:
95     setenv compilerv gcc345
96     breaksw
97     case osx104_ia32:
98     setenv compilerv gcc400
99     breaksw
100     case osx104_pcc32:
101     setenv compilerv gcc400
102     breaksw
103     endsw
104    
105 eulisse 1.4 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
106 eulisse 1.15
107 eulisse 1.17 if ( $# > 0 ) then
108 eulisse 1.15 setenv SCRAM_ARCH $1
109     endif
110    
111 eulisse 1.16 setenv here %instroot
112    
113 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
114     setenv here $VO_CMS_SW_DIR
115     else
116 eulisse 1.12 # OSG
117     if ( ${?OSG_APP} ) then
118     setenv here $OSG_APP/cmssoft/cms
119     endif
120     # OSG
121 eulisse 1.7 endif
122    
123     if ( ! -e $here/cmsset_default.csh ) then
124     echo "Please cd into the directory where cmsset_default.csh is."
125     endif
126 eulisse 1.5
127 eulisse 1.15 foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
128 eulisse 1.5 source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
129     end
130 eulisse 1.11 setenv CMS_PATH $here
131 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
132    
133 eulisse 1.8 %pre
134     [ -f $RPM_INSTALL_PREFIX/cmsset_default.sh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.sh $RPM_INSTALL_PREFIX/cmsset_default.sh.old`date +%Y%m%d`
135     [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.csh $RPM_INSTALL_PREFIX/cmsset_default.csh.old`date +%Y%m%d`
136     [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
137 eulisse 1.1 %post
138     echo $RPM_INSTALL_PREFIX
139 eulisse 1.3 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
140     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
141     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
142     %files
143     %i
144     %instroot/cmsset_default.sh
145     %instroot/cmsset_default.csh
146     %instroot/bin/cmsos
147 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
148 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*