ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/fwlite.spec
Revision: 1.1
Committed: Fri Apr 20 20:52:47 2007 UTC (18 years ago) by ratnik
Branch: MAIN
Log Message:
Initial version of FWLite build/packaging stuff.

File Contents

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