1 |
muzaffar |
1.18 |
### RPM cms gcc-toolfile 10.0
|
2 |
eulisse |
1.1 |
|
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 |
eulisse |
1.3 |
GCC_VERSION=`gcc -v 2>&1 | grep "gcc version" | sed 's|[^0-9]*\([0-9].[0-9].[0-9]\).*|\1|'` || exit 1
|
18 |
eulisse |
1.1 |
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 |
elmer |
1.15 |
# 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 |
eulisse |
1.1 |
case %cmsplatf in
|
27 |
andreasp |
1.17 |
slc4_ia32_gcc4* | slc5_ia32_gcc4* | slc4_amd64_gcc4* | slc5_amd64_gcc4* | slc5onl_ia32_gcc4* )
|
28 |
muzaffar |
1.22 |
cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler.xml
|
29 |
|
|
<tool name="cxxcompiler" version="@GCC_VERSION@" type="compiler">
|
30 |
|
|
<client>
|
31 |
|
|
<environment name="GCC_BASE" default="@GCC_ROOT@"/>
|
32 |
|
|
<environment name="GCCBINDIR" default="$GCC_BASE/bin"/>
|
33 |
|
|
<environment name="CXX" value="$GCCBINDIR/c++"/>
|
34 |
|
|
</client>
|
35 |
|
|
<flags scram_compiler_name="gcc@COMPILER_VERSION@"/>
|
36 |
|
|
<flags cccompiler="gcc@COMPILER_VERSION_MAJOR@"/>
|
37 |
|
|
<flags moduleflags="-shared"/>
|
38 |
|
|
<flags cxxdebugflag="-g"/>
|
39 |
|
|
<flags cppdefines="GNU_GCC"/>
|
40 |
|
|
<flags cppdefines="_GNU_SOURCE"/>
|
41 |
|
|
<flags cxxsharedobjectflags="-fPIC"/>
|
42 |
|
|
<flags cxxflags="-pedantic -ansi -pthread -pipe"/>
|
43 |
|
|
<flags cxxflags="@GXXOPT@"/>
|
44 |
|
|
<flags cxxflags="-felide-constructors -fmessage-length=0 -ftemplate-depth-300"/>
|
45 |
|
|
<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 -Werror=missing-braces -Werror=unused-value -Werror=address -fdiagnostics-show-option"/>
|
46 |
|
|
<flags ldflags="@LDOPT@"/>
|
47 |
|
|
<flags cxxsharedflags="-Wl,-E"/>
|
48 |
|
|
<flags sharedsuffix="so"/>
|
49 |
|
|
<flags scram_language_type="C++"/>
|
50 |
|
|
<runtime name="LD_LIBRARY_PATH" value="$GCC_BASE/@GXXLIB@" type="path"/>
|
51 |
|
|
<runtime name="PATH" value="$GCC_BASE/bin" type="path"/>
|
52 |
|
|
</tool>
|
53 |
elmer |
1.7 |
EOF_TOOLFILE
|
54 |
muzaffar |
1.22 |
cat << \EOF_TOOLFILE >%i/etc/scram.d/ccompiler.xml
|
55 |
|
|
<tool name="ccompiler" version="@GCC_VERSION@" type="compiler">
|
56 |
|
|
<client>
|
57 |
|
|
<environment name="GCC_BASE" default="@GCC_ROOT@"/>
|
58 |
|
|
<environment name="GCCBINDIR" value="$GCC_BASE/bin"/>
|
59 |
|
|
<environment name="CC" value="$GCCBINDIR/gcc"/>
|
60 |
|
|
</client>
|
61 |
|
|
<flags cdebugflag="-g"/>
|
62 |
|
|
<flags csharedobjectflags="-fPIC"/>
|
63 |
|
|
<flags cflags="-pthread"/>
|
64 |
|
|
<flags cflags="-O2"/>
|
65 |
|
|
<flags ldflags="-Wl,-E"/>
|
66 |
|
|
<flags csharedflags="-Wl,-E"/>
|
67 |
|
|
<flags scram_compiler_name="gcc@COMPILER_VERSION@"/>
|
68 |
|
|
<flags scram_language_type="C"/>
|
69 |
|
|
</tool>
|
70 |
elmer |
1.7 |
EOF_TOOLFILE
|
71 |
muzaffar |
1.22 |
cat << \EOF_TOOLFILE >%i/etc/scram.d/f77compiler.xml
|
72 |
|
|
<tool name="f77compiler" version="@GCC_VERSION@" type="compiler">
|
73 |
|
|
<lib name="gfortran"/>
|
74 |
|
|
<lib name="m"/>
|
75 |
|
|
<client>
|
76 |
|
|
<environment name="G77_BASE" default="@GCC_ROOT@"/>
|
77 |
|
|
<environment name="FC" default="$G77_BASE/bin/gfortran"/>
|
78 |
|
|
</client>
|
79 |
|
|
<flags scram_compiler_name="gcc@COMPILER_VERSION@"/>
|
80 |
|
|
<flags fflags="-fno-second-underscore -Wunused -Wuninitialized -O2"/>
|
81 |
|
|
<flags fco2flag="-O2"/>
|
82 |
|
|
<flags fcoptimised="-O2"/>
|
83 |
|
|
<flags fcdebugflag="-g"/>
|
84 |
|
|
<flags fcsharedobjectflags="-fPIC"/>
|
85 |
|
|
<flags scram_language_type="FORTRAN"/>
|
86 |
|
|
</tool>
|
87 |
elmer |
1.7 |
EOF_TOOLFILE
|
88 |
|
|
;;
|
89 |
elmer |
1.13 |
osx104_ppc32_gcc40* | osx104_ia32_gcc40* | osx105* )
|
90 |
muzaffar |
1.22 |
cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler.xml
|
91 |
|
|
<tool name="cxxcompiler" version="@GCC_VERSION@" type="compiler">
|
92 |
|
|
<client>
|
93 |
|
|
<environment name="GCC_BASE" default="@GCC_ROOT@"/>
|
94 |
|
|
<environment name="GCCBINDIR" default="$GCC_BASE/bin"/>
|
95 |
|
|
<environment name="CXX" value="$GCCBINDIR/c++"/>
|
96 |
|
|
</client>
|
97 |
|
|
<flags SCRAM_COMPILER_NAME="gcc40"/>
|
98 |
|
|
<flags CCcompiler="gcc40"/>
|
99 |
|
|
<flags MODULEFLAGS=" "/>
|
100 |
|
|
<flags CXXDEBUGFLAG="-g"/>
|
101 |
|
|
<flags CPPDEFINES="GNU_GCC"/>
|
102 |
|
|
<flags CPPDEFINES="_GNU_SOURCE"/>
|
103 |
|
|
<flags CXXSHAREDOBJECTFLAGS="-fPIC"/>
|
104 |
|
|
<flags CXXFLAGS="-pedantic -ansi -pipe"/>
|
105 |
|
|
<flags CXXFLAGS="-O2"/>
|
106 |
|
|
<flags CXXFLAGS="-felide-constructors -fmessage-length=0 -ftemplate-depth-300"/>
|
107 |
|
|
<flags CXXFLAGS="-Wall -Wno-non-template-friend -Wno-long-long -Wimplicit -Wreturn-type -Wunused -Wparentheses"/>
|
108 |
|
|
<flags LDFLAGS=" "/>
|
109 |
|
|
<flags CXXSHAREDFLAGS="-dynamiclib -single_module"/>
|
110 |
|
|
<flags SHAREDSUFFIX="dylib"/>
|
111 |
|
|
<flags SCRAM_LANGUAGE_TYPE="C++"/>
|
112 |
|
|
<runtime name=DYLD_LIBRARY_PATH value="$GCC_BASE/lib" type="path"/>
|
113 |
|
|
<runtime name=PATH value="$GCC_BASE/bin" type="path"/>
|
114 |
|
|
</tool>
|
115 |
eulisse |
1.1 |
EOF_TOOLFILE
|
116 |
|
|
;;
|
117 |
|
|
esac
|
118 |
|
|
|
119 |
elmer |
1.15 |
# Specific substitutions to the templates above (default case needed?)
|
120 |
|
|
case %cmsplatf in
|
121 |
|
|
slc4_ia32_gcc4* )
|
122 |
muzaffar |
1.22 |
perl -p -i -e "s|\@LDOPT\@|-Wl,-E|g" %i/etc/scram.d/cxxcompiler.xml
|
123 |
|
|
perl -p -i -e "s|\@GXXLIB\@|lib|g" %i/etc/scram.d/cxxcompiler.xml
|
124 |
|
|
perl -p -i -e "s|\@GXXOPT\@|-O2 -fvisibility-inlines-hidden|g" %i/etc/scram.d/cxxcompiler.xml
|
125 |
elmer |
1.15 |
;;
|
126 |
andreasp |
1.17 |
slc5_ia32_gcc4* | slc5onl_ia32_gcc4* )
|
127 |
muzaffar |
1.22 |
perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|g" %i/etc/scram.d/cxxcompiler.xml
|
128 |
|
|
perl -p -i -e "s|\@GXXLIB\@|lib|g" %i/etc/scram.d/cxxcompiler.xml
|
129 |
|
|
perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler.xml
|
130 |
elmer |
1.15 |
;;
|
131 |
elmer |
1.19 |
slc4_amd64_gcc4* )
|
132 |
muzaffar |
1.22 |
perl -p -i -e "s|\@LDOPT\@|-Wl,-E|g" %i/etc/scram.d/cxxcompiler.xml
|
133 |
|
|
perl -p -i -e "s|\@GXXLIB\@|lib64|g" %i/etc/scram.d/cxxcompiler.xml
|
134 |
|
|
perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler.xml
|
135 |
elmer |
1.19 |
;;
|
136 |
|
|
slc5_amd64_gcc4* )
|
137 |
muzaffar |
1.22 |
perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|g" %i/etc/scram.d/cxxcompiler.xml
|
138 |
|
|
perl -p -i -e "s|\@GXXLIB\@|lib64|g" %i/etc/scram.d/cxxcompiler.xml
|
139 |
|
|
perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler.xml
|
140 |
elmer |
1.15 |
;;
|
141 |
|
|
esac
|
142 |
|
|
|
143 |
|
|
# General substitutions
|
144 |
eulisse |
1.1 |
perl -p -i -e "s|\@GCC_ROOT\@|$GCC_ROOT|g;
|
145 |
|
|
s|\@GCC_VERSION\@|$GCC_VERSION|g;
|
146 |
|
|
s|\@COMPILER_VERSION\@|$COMPILER_VERSION|g;
|
147 |
|
|
s|\@COMPILER_VERSION_MAJOR\@|$COMPILER_VERSION_MAJOR|g;
|
148 |
muzaffar |
1.22 |
" %i/etc/scram.d/cxxcompiler.xml \
|
149 |
|
|
%i/etc/scram.d/ccompiler.xml \
|
150 |
|
|
%i/etc/scram.d/f77compiler.xml
|
151 |
eulisse |
1.1 |
%post
|
152 |
muzaffar |
1.22 |
%{relocateConfig}etc/scram.d/cxxcompiler.xml
|
153 |
|
|
%{relocateConfig}etc/scram.d/ccompiler.xml
|
154 |
|
|
%{relocateConfig}etc/scram.d/f77compiler.xml
|