ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.18
Committed: Wed Jul 19 12:12:32 2006 UTC (18 years, 9 months ago) by eulisse
Branch: MAIN
CVS Tags: nr_baran081_t1, for081
Changes since 1.17: +9 -1 lines
Log Message:
- Detects 64 bit platforms running in 32 bit mode as ia32
- Uses correct compilers for slc4 and slc3_amd64.

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 eulisse 1.18 slc3_amd64) compilerv=gcc344;;
27     slc4_ia32) compilerv=gcc345;;
28     slc4_amd64) compilerv=gcc345;;
29 eulisse 1.2 osx104_ia32) compilerv=gcc400;;
30     osx104_pcc32) compilerv=gcc400;;
31     esac
32     SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
33 eulisse 1.15
34     if [ $# -gt 0 ]
35     then
36     SCRAM_ARCH=$1
37     fi
38    
39 eulisse 1.4 export SCRAM_ARCH
40 eulisse 1.2
41 eulisse 1.16 here=%{instroot}
42    
43 eulisse 1.10 if [ "$VO_CMS_SW_DIR" != "" ]
44     then
45 eulisse 1.9 here=$VO_CMS_SW_DIR
46     else
47 eulisse 1.12 if [ "$OSG_APP" != "" ]
48     then
49     here=$OSG_APP/cmssoft/cms
50     fi
51 eulisse 1.10 fi
52 eulisse 1.9
53 eulisse 1.14 if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
54 eulisse 1.13 then
55     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"
56     exit 1
57     fi
58 eulisse 1.9
59 eulisse 1.15 for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
60 eulisse 1.5 do
61     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
62     done
63 eulisse 1.11 export CMS_PATH=$here
64 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
65    
66 eulisse 1.9
67     ### CSH code
68    
69 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
70 eulisse 1.7
71 eulisse 1.4 if (${?PATH}) then
72     setenv PATH %instroot/bin:$PATH
73     else
74     setenv PATH %instroot/bin
75     endif
76    
77     if (${?LD_LIBRARY_PATH}) then
78     setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
79     else
80     setenv LD_LIBRARY_PATH %instroot/lib
81     endif
82    
83     if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
84     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
85     else
86     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
87     endif
88    
89     setenv CMSOSCOMMAND `which cmsos`
90     setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
91     setenv compilerv gcc323
92     switch ( ${SCRAM_ARCH} )
93 eulisse 1.2 case slc3_ia32:
94     setenv compilerv gcc323
95     breaksw
96     case slc3_amd64:
97 eulisse 1.18 setenv compilerv gcc344
98     breaksw
99     case slc4_ia32:
100     setenv compilerv gcc345
101     breaksw
102     case slc4_amd64:
103 eulisse 1.2 setenv compilerv gcc345
104     breaksw
105     case osx104_ia32:
106     setenv compilerv gcc400
107     breaksw
108     case osx104_pcc32:
109     setenv compilerv gcc400
110     breaksw
111     endsw
112    
113 eulisse 1.4 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
114 eulisse 1.15
115 eulisse 1.17 if ( $# > 0 ) then
116 eulisse 1.15 setenv SCRAM_ARCH $1
117     endif
118    
119 eulisse 1.16 setenv here %instroot
120    
121 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
122     setenv here $VO_CMS_SW_DIR
123     else
124 eulisse 1.12 # OSG
125     if ( ${?OSG_APP} ) then
126     setenv here $OSG_APP/cmssoft/cms
127     endif
128     # OSG
129 eulisse 1.7 endif
130    
131     if ( ! -e $here/cmsset_default.csh ) then
132     echo "Please cd into the directory where cmsset_default.csh is."
133     endif
134 eulisse 1.5
135 eulisse 1.15 foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
136 eulisse 1.5 source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
137     end
138 eulisse 1.11 setenv CMS_PATH $here
139 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
140    
141 eulisse 1.8 %pre
142     [ -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`
143     [ -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`
144     [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
145 eulisse 1.1 %post
146     echo $RPM_INSTALL_PREFIX
147 eulisse 1.3 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
148     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
149     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
150     %files
151     %i
152     %instroot/cmsset_default.sh
153     %instroot/cmsset_default.csh
154     %instroot/bin/cmsos
155 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
156 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*