ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/gcc-toolfile.spec
Revision: 1.79
Committed: Fri Mar 29 14:13:43 2013 UTC (12 years, 1 month ago) by davidlt
Branch: MAIN
CVS Tags: eulisse_20130330_1130-62X-armv7hl-dev, davidlt_20130330_1130-62X-armv7hl-dev, davidlt_arm_6, davidlt_arm_5, davidlt_arm_4, davidlt_arm_3, davidlt_arm_2, davidlt_arm_1, HEAD
Changes since 1.78: +19 -46 lines
Error occurred while calculating annotation data.
Log Message:
- Drop osx*_421.
- Add support for ARM builds:
  - Use NEON as FPU unit.
  - Force bit-fields to be signed.
  - Force char to be signed.
  - Temporarely change abi-version to 6 until GCC on ARM is recompiled.

File Contents

# Content
1 ### RPM cms gcc-toolfile 12.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
14 # Determine the GCC_ROOT if "use system compiler" is used.
15 if [ "X$GCC_ROOT" = X ]
16 then
17 export GCC_PATH=`which gcc` || exit 1
18 export GCC_ROOT=`echo $GCC_PATH | sed -e 's|/bin/gcc||'`
19 export GCC_VERSION=`gcc -v 2>&1 | grep "gcc version" | sed 's|[^0-9]*\([0-9].[0-9].[0-9]\).*|\1|'` || exit 1
20 export G77_ROOT=$GCC_ROOT
21 else
22 export GCC_PATH
23 export GCC_ROOT
24 export GCC_VERSION
25 export G77_ROOT=$GCC_ROOT
26 fi
27
28 case %cmsplatf in
29 slc*_*_gcc4[012345]*) ;;
30 *) export ARCH_FFLAGS="-cpp" ;;
31 esac
32
33 export COMPILER_VERSION=`echo %cmsplatf | sed -e 's|.*gcc\([0-9]*\).*|\1|'`
34 export COMPILER_VERSION_MAJOR=`echo %cmsplatf | sed -e 's|.*gcc\([0-9]\).*|\1|'`
35 export COMPILER_VERSION_MINOR=`echo %cmsplatf | sed -e 's|.*gcc[0-9]\([0-9]\).*|\1|'`
36
37 # Generic template for the toolfiles.
38 # *** USE @VARIABLE@ plus associated environment variable to customize. ***
39 # DO NOT DUPLICATE the toolfile template.
40
41 cat << \EOF_TOOLFILE >%i/etc/scram.d/gcc-cxxcompiler.xml
42 <tool name="gcc-cxxcompiler" version="@GCC_VERSION@" type="compiler">
43 <client>
44 <environment name="GCC_CXXCOMPILER_BASE" default="@GCC_ROOT@"/>
45 <environment name="CXX" value="$GCC_CXXCOMPILER_BASE/bin/c++@COMPILER_NAME_SUFFIX@"/>
46 </client>
47 <flags CPPDEFINES="GNU_GCC _GNU_SOURCE @OS_CPPDEFINES@ @ARCH_CPPDEFINES@ @COMPILER_CPPDEFINES@"/>
48 <flags CXXSHAREDOBJECTFLAGS="-fPIC @OS_CXXSHAREDOBJECTFLAGS@ @ARCH_CXXSHAREDOBJECTFLAGS@ @COMPILER_CXXSHAREDOBJECTFLAGS@"/>
49 <flags CXXFLAGS="-O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla @OS_CXXFLAGS@ @ARCH_CXXFLAGS@ @COMPILER_CXXFLAGS@"/>
50 <flags CXXFLAGS="-felide-constructors -fmessage-length=0 -ftemplate-depth-300"/>
51 <flags CXXFLAGS="-Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=maybe-uninitialized -Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wabi"/>
52 <flags LDFLAGS="@OS_LDFLAGS@ @ARCH_LDFLAGS@ @COMPILER_LDFLAGS@"/>
53 <flags CXXSHAREDFLAGS="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@ @COMPILER_SHAREDFLAGS@"/>
54 <flags LD_UNIT="@OS_LD_UNIT@ @ARCH_LD_UNIT@ @COMPILER_LD_UNIT@"/>
55 <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="$GCC_CXXCOMPILER_BASE/@ARCH_LIB64DIR@" type="path"/>
56 <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="$GCC_CXXCOMPILER_BASE/lib" type="path"/>
57 <runtime name="PATH" value="$GCC_CXXCOMPILER_BASE/bin" type="path"/>
58 </tool>
59 EOF_TOOLFILE
60
61 cat << \EOF_TOOLFILE >%i/etc/scram.d/gcc-ccompiler.xml
62 <tool name="gcc-ccompiler" version="@GCC_VERSION@" type="compiler">
63 <client>
64 <environment name="GCC_CCOMPILER_BASE" default="@GCC_ROOT@"/>
65 <environment name="CC" value="$GCC_CCOMPILER_BASE/bin/gcc@COMPILER_NAME_SUFFIX@"/>
66 </client>
67 <flags CSHAREDOBJECTFLAGS="-fPIC @OS_CSHAREDOBJECTFLAGS@ @ARCH_CSHAREDOBJECTFLAGS@ @COMPILER_CSHAREDOBJECTFLAGS@"/>
68 <flags CFLAGS="-O2 -pthread @OS_CFLAGS@ @ARCH_CFLAGS@ @COMPILER_CFLAGS@"/>
69 </tool>
70 EOF_TOOLFILE
71
72 # Notice that on OSX we have a LIBDIR defined for f77compiler because gcc C++
73 # compiler (which comes from the system) does not know about where to find
74 # libgfortran.
75 cat << \EOF_TOOLFILE >%i/etc/scram.d/gcc-f77compiler.xml
76 <tool name="gcc-f77compiler" version="@GCC_VERSION@" type="compiler">
77 <lib name="gfortran"/>
78 <lib name="m"/>
79 <client>
80 <environment name="GCC_F77COMPILER_BASE" default="@G77_ROOT@"/>
81 <environment name="FC" default="$GCC_F77COMPILER_BASE/bin/gfortran"/>
82 @ARCH_FORTRAN_LIBDIR@
83 </client>
84 <flags FFLAGS="-fno-second-underscore -Wunused -Wuninitialized -O2 @OS_FFLAGS@ @ARCH_FFLAGS@ @COMPILER_FFLAGS@"/>
85 <flags FOPTIMISEDFLAGS="-O2 @OS_FOPTIMISEDFLAGS@ @ARCH_FOPTIMISEDFLAGS@ @COMPILER_FOPTIMISEDFLAGS@"/>
86 <flags FSHAREDOBJECTFLAGS="-fPIC @OS_FSHAREDOBJECTFLAGS@ @ARCH_FSHAREDOBJECTFLAGS@ @COMPILER_FSHAREDOBJECTFLAGS@"/>
87 </tool>
88 EOF_TOOLFILE
89
90 # NON-empty defaults
91 # First of all handle OS specific options.
92 %ifos linux
93 export OS_SHAREDFLAGS="-shared -Wl,-E"
94 export OS_LDFLAGS="-Wl,-E -Wl,--hash-style=gnu"
95 export OS_RUNTIME_LDPATH_NAME="LD_LIBRARY_PATH"
96 export OS_CXXFLAGS="-Werror=overflow"
97 %endif
98 %ifos darwin
99 export OS_SHAREDFLAGS="-shared -dynamic -single_module"
100 export OS_LDFLAGS="-Wl,-commons -Wl,use_dylibs"
101 export OS_RUNTIME_LDPATH_NAME="DYLD_LIBRARY_PATH"
102 %endif
103
104 # Then handle OS + architecture specific options (maybe we should enable more
105 # aggressive optimizations for amd64 as well??)
106 case %cmsplatf in
107 osx*)
108 export ARCH_CXXFLAGS="-arch x86_64"
109 export ARCH_SHAREDFLAGS="-arch x86_64"
110 export ARCH_LIB64DIR="lib"
111 ;;
112 slc*)
113 # For some reason on mac, some of the header do not compile if this is
114 # defined. Ignore for now.
115 export ARCH_LIB64DIR="lib64"
116 export ARCH_LD_UNIT="-r -m elf_x86_64"
117 ;;
118 *_armv7hl_*)
119 export ARCH_LIB64DIR="lib"
120 ;;
121 *)
122 echo "Unsupported."
123 exit 1
124 ;;
125 esac
126
127 # Then handle compiler specific options. E.g. enable
128 # optimizations as they become available in gcc.
129 COMPILER_CXXFLAGS=
130
131 # Set the following for all gcc < 4.6. gcc46 claims it is no longer needed
132 # This is perhaps the case also for the earlier versions, but leave it
133 # there for now.
134 case %cmsplatf in
135 *_gcc4[2345]* )
136 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -Wimplicit"
137 ;;
138 esac
139
140 # The following causes problems for gcc46 and boost 1.45.0 so downgrade it
141 case %cmsplatf in
142 *_gcc4[2345]* )
143 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -Werror=strict-overflow"
144 ;;
145 *_gcc4[6789]* )
146 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -Wstrict-overflow"
147 ;;
148 esac
149
150
151 case %cmsplatf in
152 *_amd64_gcc4[56789]* )
153 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -std=c++11 -msse3 -ftree-vectorize -Wno-strict-overflow"
154 ;;
155 *_armv7hl_* )
156 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -std=c++11 -mfpu=neon -ftree-vectorize -Wno-strict-overflow -fsigned-char -fsigned-bitfields -fabi-version=6"
157 ;;
158 esac
159
160 case %cmsplatf in
161 *_gcc4[3456789]* )
162 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits"
163 ;;
164 esac
165
166 # Enable visibility inlines hidden. Should drastically remove
167 # the amount of symbols due to templates.
168 # FIXME: not enabled on linux, yet, change the case statement
169 # to *_gcc4[23456789]* when stable.
170 case %cmsplatf in
171 osx* )
172 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fvisibility-inlines-hidden"
173 ;;
174 *_gcc4[56789]* )
175 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fvisibility-inlines-hidden"
176 ;;
177 esac
178
179 # More customizations when using gcc 4.7.x
180 # See: https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/2955.html
181 case %cmsplatf in
182 *_gcc4[789]*)
183 COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fno-math-errno --param vect-max-version-for-alias-checks=50 -fipa-pta"
184 ;;
185 esac
186
187 export COMPILER_CXXFLAGS
188
189 # General substitutions
190 perl -p -i -e 's|\@([^@]*)\@|$ENV{$1}|g' %i/etc/scram.d/*.xml
191
192 %post
193 %{relocateConfig}etc/scram.d/*.xml
194 echo "GCC_TOOLFILE_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'; export GCC_TOOLFILE_ROOT" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh
195 echo "setenv GCC_TOOLFILE_ROOT '$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh