ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/gcc-toolfile.spec
Revision: 1.20
Committed: Tue Dec 8 23:32:49 2009 UTC (15 years, 4 months ago) by elmer
Branch: MAIN
CVS Tags: dsr20100209fwlite342, CMSSW_3_4_2_patch1, for342patch1, CMSSW_3_4_2, eskFor342, DQMGUI_5_1_7, for341op1-onl-slc5, CMSSW_3_4_1_ONLINE, sm100126, dsr20100107fwlite341, sm100107a, sm100106a, sm100105c, sm100105b, pe20100105a-for34X-for35X, ge20100105-pyqt-relocatable-build, sm100105a, pe20091227a-ports, CMSSW_3_5_0_pre2, CMSSW_3_4_1, apFor350pre2v2, apFor350pre2v1, apFor350pre2v0, eskFor341, pe20091216b-for34X-for35X, pe20091216a-for34X-for35X, CMSSW_3_4_0, ge20091214b-new-bootstrap, ge20091214a-new-bootstrap, ge20091214-new-bootstrap, ge20091214-fix-rh5x, CMSSW_3_5_0_pre1, apFor350pre1v0, eskFor340, pe20091209b-for34X-for35X, pe20091209a-for34X-for35X
Changes since 1.19: +1 -1 lines
Log Message:
  Add additional options to turn some compiler warnings into errors:
-Werror=overflow -Werror=return-type -Werror=format-contains-nul -fdiagnostics-show-option

File Contents

# Content
1 ### RPM cms gcc-toolfile 10.0
2
3 # gcc has a separate spec file for the generating a
4 # toolfile because gcc.spec could be not build because of the
5 # "--use-system-compiler" option.
6
7 Source: none
8
9 %prep
10 %build
11 %install
12 mkdir -p %i/etc/scram.d
13 if [ "X$GCC_ROOT" = X ]
14 then
15 GCC_PATH=`which gcc` || exit 1
16 GCC_ROOT=`echo $GCC_PATH | sed -e 's|/bin/gcc||'`
17 GCC_VERSION=`gcc -v 2>&1 | grep "gcc version" | sed 's|[^0-9]*\([0-9].[0-9].[0-9]\).*|\1|'` || exit 1
18 fi
19
20 COMPILER_VERSION=`echo %cmsplatf | sed -e 's|.*gcc\([0-9]*\).*|\1|'`
21 COMPILER_VERSION_MAJOR=`echo %cmsplatf | sed -e 's|.*gcc\([0-9]\).*|\1|'`
22
23 # Generate general template for the tool files. Note that on top of
24 # this template there are some additional cmsplatf-dependent substitutions
25 # and some overall general substitutions below
26 case %cmsplatf in
27 slc4_ia32_gcc4* | slc5_ia32_gcc4* | slc4_amd64_gcc4* | slc5_amd64_gcc4* | slc5onl_ia32_gcc4* )
28 cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler
29 <doc type=BuildSystem::ToolDoc version=1.1>
30 <tool name=cxxcompiler version=@GCC_VERSION@ type=compiler>
31 <client>
32 <Environment name=GCC_BASE default="@GCC_ROOT@"></Environment>
33 <Environment name=GCCBINDIR default="$GCC_BASE/bin"></Environment>
34 <Environment name=CXX value="$GCCBINDIR/c++"></Environment>
35 </client>
36 <Flags SCRAM_COMPILER_NAME="gcc@COMPILER_VERSION@">
37 <Flags CCcompiler="gcc@COMPILER_VERSION_MAJOR@">
38 <Flags MODULEFLAGS="-shared">
39 <Flags CXXDEBUGFLAG="-g">
40 <Flags CPPDEFINES="GNU_GCC">
41 <Flags CPPDEFINES="_GNU_SOURCE">
42 <Flags CXXSHAREDOBJECTFLAGS="-fPIC">
43 <Flags CXXFLAGS="-pedantic -ansi -pthread -pipe">
44 <Flags CXXFLAGS="@GXXOPT@">
45 <Flags CXXFLAGS="-felide-constructors -fmessage-length=0 -ftemplate-depth-300">
46 <Flags CXXFLAGS="-Wall -Wno-non-template-friend -Wno-long-long -Wimplicit -Wreturn-type -Wunused -Wparentheses -Werror=array-bounds -Wno-deprecated -Werror=overflow -Werror=return-type -Werror=format-contains-nul -fdiagnostics-show-option">
47 <Flags LDFLAGS="@LDOPT@">
48 <Flags CXXSHAREDFLAGS="-Wl,-E">
49 <Flags SHAREDSUFFIX="so">
50 <Flags SCRAM_LANGUAGE_TYPE="C++">
51 <Runtime name=LD_LIBRARY_PATH value="$GCC_BASE/@GXXLIB@" type=path>
52 <Runtime name=PATH value="$GCC_BASE/bin" type=path>
53 </tool>
54 EOF_TOOLFILE
55 cat << \EOF_TOOLFILE >%i/etc/scram.d/ccompiler
56 <doc type=BuildSystem::ToolDoc version=1.1>
57 <tool name=ccompiler version=@GCC_VERSION@ type=compiler>
58 <client>
59 <Environment name=GCC_BASE default="@GCC_ROOT@"></Environment>
60 <Environment name=GCCBINDIR value="$GCC_BASE/bin"></Environment>
61 <Environment name=CC value="$GCCBINDIR/gcc"></Environment>
62 </client>
63 <Flags CDEBUGFLAG="-g">
64 <Flags CSHAREDOBJECTFLAGS="-fPIC">
65 <Flags CFLAGS="-pthread">
66 <Flags CFLAGS="-O2">
67 <Flags LDFLAGS="-Wl,-E">
68 <Flags CSHAREDFLAGS="-Wl,-E">
69 <Flags SCRAM_COMPILER_NAME="gcc@COMPILER_VERSION@">
70 <Flags SCRAM_LANGUAGE_TYPE="C">
71 </tool>
72 EOF_TOOLFILE
73 cat << \EOF_TOOLFILE >%i/etc/scram.d/f77compiler
74 <doc type=BuildSystem::ToolDoc version=1.1>
75 <tool name=f77compiler version=@GCC_VERSION@ type=compiler>
76 <lib name=gfortran>
77 <lib name=m>
78 <client>
79 <Environment name=G77_BASE default="@GCC_ROOT@"></Environment>
80 <Environment name=FC default="$G77_BASE/bin/gfortran"></Environment>
81 </client>
82 <Flags SCRAM_COMPILER_NAME="gcc@COMPILER_VERSION@">
83 <Flags FFLAGS="-fno-second-underscore -Wunused -Wuninitialized -O2">
84 <Flags FCO2Flag="-O2">
85 <Flags FCOPTIMISED="-O2">
86 <Flags FCDEBUGFLAG="-g">
87 <Flags FCSHAREDOBJECTFLAGS="-fPIC">
88 <Flags SCRAM_LANGUAGE_TYPE="FORTRAN">
89 </tool>
90 EOF_TOOLFILE
91 ;;
92 osx104_ppc32_gcc40* | osx104_ia32_gcc40* | osx105* )
93 cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler
94 <doc type=BuildSystem::ToolDoc version=1.1>
95 <tool name=cxxcompiler version=@GCC_VERSION@ type=compiler>
96 <client>
97 <Environment name=GCC_BASE default="@GCC_ROOT@"></Environment>
98 <Environment name=GCCBINDIR default="$GCC_BASE/bin"></Environment>
99 <Environment name=CXX value="$GCCBINDIR/c++"></Environment>
100 </client>
101 <Flags SCRAM_COMPILER_NAME="gcc40">
102 <Flags CCcompiler="gcc40">
103 <Flags MODULEFLAGS=" ">
104 <Flags CXXDEBUGFLAG="-g">
105 <Flags CPPDEFINES="GNU_GCC">
106 <Flags CPPDEFINES="_GNU_SOURCE">
107 <Flags CXXSHAREDOBJECTFLAGS="-fPIC">
108 <Flags CXXFLAGS="-pedantic -ansi -pipe">
109 <Flags CXXFLAGS="-O2">
110 <Flags CXXFLAGS="-felide-constructors -fmessage-length=0 -ftemplate-depth-300">
111 <Flags CXXFLAGS="-Wall -Wno-non-template-friend -Wno-long-long -Wimplicit -Wreturn-type -Wunused -Wparentheses">
112 <Flags LDFLAGS=" ">
113 <Flags CXXSHAREDFLAGS="-dynamiclib -single_module">
114 <Flags SHAREDSUFFIX="dylib">
115 <Flags SCRAM_LANGUAGE_TYPE="C++">
116 <Runtime name=DYLD_LIBRARY_PATH value="$GCC_BASE/lib" type=path>
117 <Runtime name=PATH value="$GCC_BASE/bin" type=path>
118 </tool>
119 EOF_TOOLFILE
120 ;;
121 esac
122
123 # Specific substitutions to the templates above (default case needed?)
124 case %cmsplatf in
125 slc4_ia32_gcc4* )
126 perl -p -i -e "s|\@LDOPT\@|-Wl,-E|g" %i/etc/scram.d/cxxcompiler
127 perl -p -i -e "s|\@GXXLIB\@|lib|g" %i/etc/scram.d/cxxcompiler
128 perl -p -i -e "s|\@GXXOPT\@|-O2 -fvisibility-inlines-hidden|g" %i/etc/scram.d/cxxcompiler
129 ;;
130 slc5_ia32_gcc4* | slc5onl_ia32_gcc4* )
131 perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|g" %i/etc/scram.d/cxxcompiler
132 perl -p -i -e "s|\@GXXLIB\@|lib|g" %i/etc/scram.d/cxxcompiler
133 perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler
134 ;;
135 slc4_amd64_gcc4* )
136 perl -p -i -e "s|\@LDOPT\@|-Wl,-E|g" %i/etc/scram.d/cxxcompiler
137 perl -p -i -e "s|\@GXXLIB\@|lib64|g" %i/etc/scram.d/cxxcompiler
138 perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler
139 ;;
140 slc5_amd64_gcc4* )
141 perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|g" %i/etc/scram.d/cxxcompiler
142 perl -p -i -e "s|\@GXXLIB\@|lib64|g" %i/etc/scram.d/cxxcompiler
143 perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler
144 ;;
145 esac
146
147 # General substitutions
148 perl -p -i -e "s|\@GCC_ROOT\@|$GCC_ROOT|g;
149 s|\@GCC_VERSION\@|$GCC_VERSION|g;
150 s|\@COMPILER_VERSION\@|$COMPILER_VERSION|g;
151 s|\@COMPILER_VERSION_MAJOR\@|$COMPILER_VERSION_MAJOR|g;
152 " %i/etc/scram.d/cxxcompiler \
153 %i/etc/scram.d/ccompiler \
154 %i/etc/scram.d/f77compiler
155 %post
156 %{relocateConfig}etc/scram.d/cxxcompiler
157 %{relocateConfig}etc/scram.d/ccompiler
158 %{relocateConfig}etc/scram.d/f77compiler