ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.10
Committed: Wed Jul 12 20:47:39 2006 UTC (18 years, 9 months ago) by eulisse
Branch: MAIN
Changes since 1.9: +4 -3 lines
Log Message:
Exits if it cannot understand where it is...

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.4 export SCRAM_ARCH
32 eulisse 1.2
33 eulisse 1.10 if [ "$VO_CMS_SW_DIR" != "" ]
34     then
35 eulisse 1.9 here=$VO_CMS_SW_DIR
36     else
37     here=`dirname $0`
38 eulisse 1.10 fi
39 eulisse 1.9
40 eulisse 1.10 [ -d $here/${SCRAM_ARCH}/etc/profile.d ] || {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".; exit 1}
41 eulisse 1.9
42 eulisse 1.5 for pkg in `ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
43     do
44     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
45     done
46    
47 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
48    
49 eulisse 1.9
50     ### CSH code
51    
52 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
53 eulisse 1.7
54 eulisse 1.4 if (${?PATH}) then
55     setenv PATH %instroot/bin:$PATH
56     else
57     setenv PATH %instroot/bin
58     endif
59    
60     if (${?LD_LIBRARY_PATH}) then
61     setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
62     else
63     setenv LD_LIBRARY_PATH %instroot/lib
64     endif
65    
66     if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
67     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
68     else
69     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
70     endif
71    
72     setenv CMSOSCOMMAND `which cmsos`
73     setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
74     setenv compilerv gcc323
75     switch ( ${SCRAM_ARCH} )
76 eulisse 1.2 case slc3_ia32:
77     setenv compilerv gcc323
78     breaksw
79     case slc3_amd64:
80     setenv compilerv gcc345
81     breaksw
82     case osx104_ia32:
83     setenv compilerv gcc400
84     breaksw
85     case osx104_pcc32:
86     setenv compilerv gcc400
87     breaksw
88     endsw
89    
90 eulisse 1.4 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
91 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
92     setenv here $VO_CMS_SW_DIR
93     else
94     setenv here .
95     endif
96    
97     if ( ! -e $here/cmsset_default.csh ) then
98     echo "Please cd into the directory where cmsset_default.csh is."
99     endif
100 eulisse 1.5
101     foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
102     source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
103     end
104 eulisse 1.4
105 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
106    
107 eulisse 1.8 %pre
108     [ -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`
109     [ -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`
110     [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
111 eulisse 1.1 %post
112     echo $RPM_INSTALL_PREFIX
113 eulisse 1.3 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
114     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
115     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
116     %files
117     %i
118     %instroot/cmsset_default.sh
119     %instroot/cmsset_default.csh
120     %instroot/bin/cmsos
121 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
122 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*