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.8 by eulisse, Mon Jul 10 17:28:11 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 cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
15 export PATH=%instroot/bin:$PATH
16 export LD_LIBRARY_PATH=%instroot/lib:$LD_LIBRARY_PATH
17 export DYLD_FALLBACK_LIBRARY_PATH=%instroot/lib:$DYLD_FALLBACK_LIBRARY
18 SCRAM_ARCH=$(cmsos)
19
20 # We need to assume 1 compiler per platform.
21 # There is no other way around this.
22 case $SCRAM_ARCH in
23    slc3_ia32) compilerv=gcc323;;
24    slc3_amd64) compilerv=gcc345;;
25    osx104_ia32) compilerv=gcc400;;
26    osx104_pcc32) compilerv=gcc400;;
27 esac
28 SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
29 export SCRAM_ARCH
30
31 here=`dirname $0`
32 for pkg in `ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
33 do
34        source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
35 done
36
37 EOF_CMSSET_DEFAULT_SH
38
39 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
40
41 if (${?PATH}) then
42    setenv PATH %instroot/bin:$PATH
43 else
44    setenv PATH %instroot/bin
45 endif
46
47 if (${?LD_LIBRARY_PATH}) then
48    setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
49 else
50    setenv LD_LIBRARY_PATH %instroot/lib
51 endif
52
53 if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
54    setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
55 else
56    setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
57 endif
58
59 setenv CMSOSCOMMAND `which cmsos`
60 setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
61 setenv compilerv gcc323
62 switch ( ${SCRAM_ARCH} )
63    case slc3_ia32:
64        setenv compilerv gcc323
65    breaksw
66    case slc3_amd64:
67        setenv compilerv gcc345
68    breaksw
69    case osx104_ia32:
70        setenv compilerv gcc400
71    breaksw
72    case osx104_pcc32:
73        setenv compilerv gcc400
74    breaksw
75 endsw
76
77 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
78 if ( ${?VO_CMS_SW_DIR} ) then
79    setenv here $VO_CMS_SW_DIR
80 else
81    setenv here .
82 endif
83
84 if ( ! -e $here/cmsset_default.csh ) then
85    echo "Please cd into the directory where cmsset_default.csh is."
86 endif
87
88 foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
89        source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
90 end
91
92 EOF_CMSSET_DEFAULT_CSH
93
94 %pre
95 [ -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`
96 [ -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`
97 [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
98 %post
99 echo $RPM_INSTALL_PREFIX
100 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
101 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
102 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
103 %files
104 %i
105 %instroot/cmsset_default.sh
106 %instroot/cmsset_default.csh
107 %instroot/bin/cmsos
108 %instroot/%cmsplatf/etc/profile.d
109 %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines