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
|