ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
(Generate patch)

Comparing COMP/CMSDIST/cms-env.spec (file contents):
Revision 1.10 by eulisse, Wed Jul 12 20:47:39 2006 UTC vs.
Revision 1.52 by muzaffar, Tue Jan 1 11:01:22 2008 UTC

# Line 1 | Line 1
1 < ### RPM cms cms-env 1.0
2 < Source: cmsos
1 > ### RPM cms cms-env 1.0
2 > Source: none
3   %prep
4   %build
5 echo $SCRAM_ROOT
5   %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 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
13
14 ### BASH code
15
16 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 SCRAM_ARCH=$(cmsos)
21
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 export SCRAM_ARCH
32
33 if [ "$VO_CMS_SW_DIR" != ""  ]
34 then
35    here=$VO_CMS_SW_DIR
36 else
37    here=`dirname $0`
38 fi
39
40 [ -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
42 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 EOF_CMSSET_DEFAULT_SH
48
49
50 ### CSH code
51
52 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
53
54 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    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 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
91 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
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
105 EOF_CMSSET_DEFAULT_CSH
106
107 %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 %post
112 echo $RPM_INSTALL_PREFIX
113 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 %instroot/%cmsplatf/etc/profile.d
122 %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines