ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/fwlite.spec
Revision: 1.5
Committed: Fri Jun 22 19:15:24 2007 UTC (17 years, 10 months ago) by ratnik
Branch: MAIN
Changes since 1.4: +3 -0 lines
Log Message:
Merge in changes from scramv1-build.file (rev. 1.60) for CMSSW_1_5_0

File Contents

# User Rev Content
1 ratnik 1.3 ### RPM cms fwlite CMSSW_1_5_0_pre5_FWLITE
2 ratnik 1.1 ## IMPORT configurations
3     Provides: /bin/zsh
4     Requires: SCRAMV1
5     Requires: fwlite-tool-conf
6     Requires: gcc-wrapper
7     %define gccwrapperarch slc4_ia32_gcc345
8    
9     # Take source from CMSSW base release:
10 ratnik 1.2 %define application %n
11     # Assuming release name convention for FWLite release based on CMSSW_X_Y_Z is CMSSW_X_Y_Z_FWLITE .
12     %define cmssw_release %(perl -e '$_="%v"; s/_FWLITE//; print;')
13 ratnik 1.1 %define cmsswsrc http://cmsdoc.cern.ch/cms/cpt/Software/download/cms/SOURCES/cms/cmssw/%{cmssw_release}
14     Source0: %{cmsswsrc}/toolbox.tar.gz
15     Source1: %{cmsswsrc}/config.tar.gz
16     Source2: %{cmsswsrc}/src.tar.gz
17    
18     %define toolconf ${FWLITE_TOOL_CONF_ROOT}/configurations/tools-STANDALONE.conf
19     %define prebuildtarget gindices
20     %define buildtarget release-build
21     %define postbuildtarget doc
22    
23 ratnik 1.2 # Following dependencies were not detected by ignominy, but required in the BuildFiles:
24     # boost_program_options boost_regex bz2lib pcre root rootcintex uuid zlib
25 ratnik 1.1
26 ratnik 1.4 %define externals "cxxcompiler ccompiler clhep sockets boost boost_filesystem rootrflx rootcore rootmath gccxml boost_python elementtree sigcpp hepmc gsl boost_regex boost_program_options boost_program_options boost_regex bz2lib pcre root rootcintex zlib"
27 ratnik 1.2
28 ratnik 1.4 %define packages "CondFormats/JetMETObjects DataFormats/BTauReco DataFormats/CLHEP DataFormats/CaloRecHit DataFormats/CaloTowers DataFormats/Candidate DataFormats/Common DataFormats/DetId DataFormats/EcalDetId DataFormats/EcalRecHit DataFormats/EgammaCandidates DataFormats/EgammaReco DataFormats/EgammaTrackReco DataFormats/FEDRawData DataFormats/GeometryCommonDetAlgo DataFormats/GeometrySurface DataFormats/GeometryVector DataFormats/GsfTrackReco DataFormats/HcalDetId DataFormats/HcalRecHit DataFormats/HepMCCandidate DataFormats/JetReco DataFormats/L1CaloTrigger DataFormats/L1GlobalCaloTrigger DataFormats/L1GlobalMuonTrigger DataFormats/L1Trigger DataFormats/METReco DataFormats/Math DataFormats/MuonDetId DataFormats/MuonReco DataFormats/ParticleFlowCandidate DataFormats/ParticleFlowReco DataFormats/Provenance DataFormats/RecoCandidate DataFormats/SiPixelCluster DataFormats/SiPixelDetId DataFormats/SiPixelDigi DataFormats/SiStripCluster DataFormats/SiStripCommon DataFormats/SiStripDetId DataFormats/SiStripDigi DataFormats/TrackCandidate DataFormats/TrackReco DataFormats/TrackerRecHit2D DataFormats/TrackingRecHit DataFormats/TrajectorySeed DataFormats/TrajectoryState DataFormats/VertexReco FWCore/FWLite FWCore/MessageLogger FWCore/PluginManager FWCore/RootAutoLibraryLoader FWCore/Utilities SimDataFormats/HepMCProduct"
29 ratnik 1.1
30     %prep
31    
32     # Create a SCRAM project area, but using the already extracted
33     # sources. In other words, pick up the files from the project config
34     # area, but munge all instances of <base url="cvs:*"> into a local
35     # reference so SCRAM won't try to download stuff from the network.
36    
37     %setup -T -b 0 -n SCRAMToolBox
38     %setup -D -T -b 1 -n config
39     %setup -D -T -b 2 -n src
40    
41    
42     # Update requirements:
43    
44     %if "%{buildarch:set}" != "set"
45     %define buildarch :
46     %endif
47    
48     # NR: Allow to define bootstrap and requirements file names
49 ratnik 1.2 %define bootstrapfile config/%{application}_bootsrc
50     %define reqfile config/%{application}_requirements
51 ratnik 1.1
52    
53     cd %_builddir
54    
55     # Create bootstrap file for fwlite:
56     cp config/bootsrc %bootstrapfile
57     perl -p -i -e '
58 ratnik 1.2 # s!(<project.*name=)CMSSW(.*version=)CMSSW(.*)!$1%projectname$2%projectname$3!;
59     s!(<project.*name=CMSSW.*version=)%cmssw_release(.*)!$1%v$2!;
60 ratnik 1.1 s!config/requirements!%{reqfile}!;
61     if (s/(<download.*)(module=)CMSSW(.*)(name="src)(">)/#$1$2$3$4$5/) {
62     foreach $p (split / /, %{packages}) {
63     print "$1$2src/$p$3$4/$p$5\n"
64     }
65     }
66     ' %bootstrapfile
67    
68     # Create requirements file:
69     cp config/requirements %reqfile
70     perl -p -i -e '
71     if (m/(<select name=)(.*)(>)/) {
72     foreach $t (split / /, %externals) {
73     if ( $t eq lc($2) ) { $matches=1; last; }
74     }
75     if ( $matches != 1 ) { s/(.*)$/#$1/ };
76     $matches=0;
77     }
78     ' %reqfile
79    
80     # Create build templates:
81 ratnik 1.2 # for file in config/CMSSW_*.tmpl; do cat $file > `echo $file | sed s'/CMSSW/%{projectname}/'`; done
82 ratnik 1.1
83     # Switch off building tests:
84     perl -p -i -e ' s!(<ClassPath.*test\+test>)!#$1!;' config/BuildFile
85    
86     # Munging algorithm from scramv1-build.file:
87     perl -p -i -e '
88     # Keep track whether we are in a toolbox area or not
89     if ($. == 1) { $intbx = 1; }
90     if (/<base/) { $intbx = /SPITOOLS|SCRAMToolBox|scramtoolbox/; }
91    
92     # Replace base locations
93     s!cvs://.*/(SPITOOLS|SCRAMToolBox|scramtoolbox)\?[^">]+!file:%_builddir/SCRAMToolBox/!;
94     s!cvs://.*/(CMSSW)\?[^">]+!file:%_builddir/!;
95    
96     # Replace relative references depending on whether this is in
97     # toolbox, or for project itself; configuration is always in
98     # toolbox. In toolbox keep cvs module name but drop the leading
99     # SCRAMToolBox if there is one. In project always replace with
100     # rewritten paths. (FIXME: produce source archive in cvs order?)
101     if ($intbx) {
102     s!url="cvs:\?module="?([^">]+)"?\s+name="?([^">]+)"?>!url="file:$1" name="$2">!;
103     s!url="(cvs:\?module=|file:)SCRAMToolBox/(.*)">!url="file:$2">!;
104     s!url="(cvs:\?module=|file:)scramtoolbox/(.*)">!url="file:$2">!;
105     } else {
106     #s!url="cvs:\?module="?([^">]+)"?\s+name="?([^">]+)"?>!url="file:$2" name="$2">!;
107     s!<download\s+url="cvs:\?module=LCGAAwrappers/%cvsproj/[^"]+?"\s+name=.+>!!;
108     s!url="cvs:\?module="?%cvssrc/([^">]+)"?\s+name="?([^">]+)"?>!url="file:src/$1" name="$2">!;
109     s!url="cvs:\?module="?([^">]+)"?\s+name="?([^">]+)"?>!url="file:$1" name="$2">!;
110     }
111     ' %{bootstrapfile} \
112     %{reqfile} \
113     SCRAMToolBox/CMS/Configuration/CMSconfiguration
114    
115     # Handle toolbox
116     pwd
117     perl -p -i -e '
118     # Replace base locations
119     s!cvs://.*/(SPITOOLS|SCRAMToolBox)\?[^">]+!file:%_builddir/SCRAMToolBox/!;
120     s!cvs://.*/(SPITOOLS|scramtoolbox)\?[^">]+!file:%_builddir/SCRAMToolBox/!;
121     s!cvs://.*/%cvsdir\?[^">]+!file:%_builddir/!;
122     s!url="cvs:\?module="?([^">]+)"?\s+name="?([^">]+)"?>!url="file:$1" name="$2">!;
123     s!url="(cvs:\?module=|file:)SCRAMToolBox/(.*)">!url="file:$2">!;
124     s!url="(cvs:\?module=|file:)scramtoolbox/(.*)">!url="file:$2">!;
125     ' SCRAMToolBox/CMS/Configuration/CMSconfiguration
126     echo $PERL5LIB
127     echo rm -rf %i
128     mkdir -p $(dirname %i)
129    
130     %{?buildarch:%buildarch}
131     %define realVersion %(echo %v | cut -f1 -d-)
132     perl -p -i -e 's|%{realVersion}([^-])|%{v}$1|g' %{bootstrapfile}
133     cp -f %toolconf ./tmpconf
134     %if "%{cmsplatf}" == "%{gccwrapperarch}"
135     echo "Using gcc wrapper for %cmsplatf"
136     perl -p -i -e '$gccpath=$ENV{GCC_ROOT};$wrapperpath=$ENV{GCC_WRAPPER_ROOT};s|$gccpath|$wrapperpath|' ./tmpconf
137     %endif
138     scramv1 project -d $(dirname %i) -b %{bootstrapfile} -f ./tmpconf;
139     mv -f ./tmpconf %{i}/config/site
140    
141     %build
142     pwd
143     # Remove cmt stuff that brings unwanted dependencies:
144     rm -rf `find %{i}/src -type d -name cmt`
145     echo `scramv1 arch`
146     cd %i
147     echo %toolconf | sed 's|.*tools-||;s|.conf||' > config/site/sitename
148     cd src
149    
150     %{?buildarch:%buildarch}
151    
152 ratnik 1.4 # Skip library checks to avoid dependency on seal:
153     export SCRAM_NOLOADCHECK=true
154     export SCRAM_NOSYMCHECK=true
155 ratnik 1.1
156     if [ $(uname) = Darwin ]; then
157     # scramv1 doesn't know the rpath variable on darwin...
158     scramv1 b echo_null # ensure lib, bin exist
159     eval `scramv1 runtime -sh`
160     export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
161     fi
162    
163     %if "%{?preBuildCommand:set}" == "set"
164     echo "executing %preBuildCommand"
165     %preBuildCommand
166     %endif
167    
168     %if "%{?buildtarget:set}" != "set"
169     %define buildtarget %{nil}
170     %endif
171    
172 ratnik 1.5 #organize log file, turn off plugin building..
173     export BUILD_LOG yes
174     export SCRAM_NOPLUGINREFRESH yes
175 ratnik 1.4
176 ratnik 1.1 scramv1 b -r echo_CXX </dev/null
177     %if "%{?prebuildtarget:set}" == "set"
178     scramv1 b --verbose -f %{prebuildtarget} </dev/null
179     %endif
180 ratnik 1.3 scramv1 b --verbose -f %{compileOptions} %{makeprocesses} %{buildtarget} </dev/null
181 ratnik 1.1 %if "%{?additionalBuildTarget0:set}" == "set"
182     scramv1 b --verbose -f %{additionalBuildTarget0} < /dev/null
183     %endif
184     %if "%{?postbuildtarget:set}" == "set"
185     scramv1 b --verbose -f %{postbuildtarget} </dev/null
186     %endif
187    
188     rm -rf %i/tmp
189     chmod -R 755 %i %i/.SCRAM
190     (eval `scramv1 run -sh` ; SealPluginRefresh) || true
191 ratnik 1.3 rm -fR %i/lib/%cmsplatf/.edmplugincache
192     (eval `scramv1 run -sh` ; EdmPluginRefresh) || true
193 ratnik 1.1
194     %install
195     cd %i
196     %{?buildarch:%buildarch}
197     perl -p -i -e "s|^#!.*perl(.*)|#!/usr/bin/env perl$1|" $(grep -r -e "^#!.*perl.*" . | cut -d: -f1)
198     # need writeable directory for profile stuff
199     mkdir etc
200     yes | scramv1 install # FIXME: do by hand?
201    
202     %post
203     %initenv
204     source $RPM_INSTALL_PREFIX/%cmsplatf/lcg/SCRAMV1/V1_0_3-p1/etc/profile.d/init.sh
205     cd $RPM_INSTALL_PREFIX/%cmsplatf/cms/%n/%v
206     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $(find config -type f) $(find .SCRAM -type f)
207     %{?buildarch:%buildarch}
208     yes | scramv1 install
209     (rm -rf external/%cmsplatf; ./config/linkexternal.pl --arch %cmsplatf --nolink INCLUDE) || true