ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/llvm-gcc-toolfile.spec
Revision: 1.4
Committed: Wed Jan 26 11:23:18 2011 UTC (14 years, 3 months ago) by eulisse
Branch: MAIN
CVS Tags: CMSSW_4_2_0_pre1-ports, CMSSW_4_2_0_pre1, azFor420pre1gcc451, azFor420pre1g451n, azFor420pre1g434, azFor420pre1g451, azFor420pre1, fw20110127a-311X, pe20110126a-for311X-ports, pe20110126a-for311X
Changes since 1.3: +3 -2 lines
Log Message:
Misc fixes.

* Removes -felide-constructors since it's default and it generates a warning
  when used to compile as it is a link-time option.
* Remove -Wno-non-template-friend since it's not implemented.

File Contents

# User Rev Content
1 eulisse 1.1 ### RPM cms llvm-gcc-toolfile 11.0
2    
3     Requires: llvm
4     %if "%(echo %cmsos | grep osx >/dev/null && echo true)" == "true"
5     Requires: gfortran-macosx
6     %endif
7     Source: none
8    
9     %if "%(echo %cmsos | grep osx >/dev/null && echo true)" == "true"
10     Requires: gfortran-macosx
11     %else
12     Requires: gcc
13     %endif
14    
15     %prep
16     %build
17     %install
18     mkdir -p %i/etc/scram.d
19    
20     export LLVM_PATH
21     export LLVM_ROOT
22     export LLVM_VERSION
23    
24     # Determine the GCC_ROOT if "use system compiler is used. We still need this
25     # because we need to pick up libstdc++ from the gcc installation since clang
26     # does not ship its own and because clang does not provide a fortran compiler.
27     if [ "X$GCC_ROOT" = X ]
28     then
29     export GCC_PATH=`which gcc` || exit 1
30     export GCC_ROOT=`echo $GCC_PATH | sed -e 's|/bin/gcc||'`
31     export GCC_VERSION=`gcc -v 2>&1 | grep "gcc version" | sed 's|[^0-9]*\([0-9].[0-9].[0-9]\).*|\1|'` || exit 1
32     export G77_ROOT=$GFORTRAN_MACOSX_ROOT
33     else
34     export GCC_PATH
35     export GCC_ROOT
36     export GCC_VERSION
37     export G77_ROOT=$GCC_ROOT
38     fi
39    
40     export GCC_REALVERSION=`echo $GCC_VERSION | sed -e's|-.*||'`
41     export COMPILER_VERSION=`echo $LLVM_VERSION`
42     export COMPILER_VERSION_MAJOR=`echo $LLVM_VERSION | sed -e 's|\([0-9]\).*|\1|'`
43     export COMPILER_VERSION_MINOR=`echo $LLVM_VERSION | sed -e 's|[0-9].\([0-9]\).*|\1|'`
44    
45 eulisse 1.2 export GCC_ARCH=$(basename $(dirname `find $GCC_ROOT/include -mindepth 4 -maxdepth 4 -name bits`))
46    
47 eulisse 1.1 # Generic template for the toolfiles.
48     # *** USE @VARIABLE@ plus associated environment variable to customize. ***
49     # DO NOT DUPLICATE the toolfile template.
50    
51     cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler.xml
52     <tool name="cxxcompiler" version="@LLVM_VERSION@" type="compiler">
53     <client>
54     <environment name="CXXCOMPILER_BASE" default="@LLVM_ROOT@"/>
55     <environment name="GCCBINDIR" default="$CXXCOMPILER_BASE/bin"/>
56     <environment name="CXX" value="$GCCBINDIR/clang++@COMPILER_NAME_SUFFIX@"/>
57     </client>
58     <flags SCRAM_COMPILER_NAME="clang@COMPILER_VERSION@"/>
59     <flags CCCOMPILER="clang@COMPILER_VERSION_MAJOR@"/>
60     <flags MODULEFLAGS="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@"/>
61     <flags CXXDEBUGFLAG="-g"/>
62     <flags CPPDEFINES="GNU_GCC"/>
63     <flags CPPDEFINES="_GNU_SOURCE"/>
64     <flags CXXSHAREDOBJECTFLAGS="-fPIC"/>
65     <flags CPPFLAGS="-I@GCC_ROOT@/include/c++/@GCC_REALVERSION@"/>
66 eulisse 1.2 <flags CPPFLAGS="-I@GCC_ROOT@/include/c++/@GCC_REALVERSION@/@GCC_ARCH@"/>
67 eulisse 1.1 <flags CPPFLAGS="-I@GCC_ROOT@/include/c++/@GCC_REALVERSION@/backward"/>
68     <flags CXXFLAGS="-O2 -pedantic -ansi -pthread -pipe"/>
69     <flags CXXFLAGS="@ARCH_CXXFLAGS@ @COMPILER_CXXFLAGS@"/>
70 eulisse 1.4 <flags CXXFLAGS="-fmessage-length=0 -ftemplate-depth-300"/>
71     # -Wno-non-template-friend removed since it's not supported, yet, by llvm.
72     <flags CXXFLAGS="-Wall -Wno-long-long -Wimplicit -Wreturn-type -Wunused -Wparentheses -Wsign-compare -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=write-strings -Werror=strict-overflow -fdiagnostics-show-option"/>
73 eulisse 1.1 <flags LDFLAGS="@OS_LDFLAGS@"/>
74     <flags CXXSHAREDFLAGS="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@"/>
75     <flags SHAREDSUFFIX="@OS_SHAREDSUFFIX@"/>
76     <flags LD_UNIT="@OS_LD_UNIT@ @ARCH_LD_UNIT@"/>
77     <flags SCRAM_LANGUAGE_TYPE="C++"/>
78     <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="$CXXCOMPILER_BASE/lib" type="path"/>
79     <runtime name="PATH" value="$CXXCOMPILER_BASE/bin" type="path"/>
80     <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="@GCC_ROOT@/@ARCH_LIB64DIR@" type="path"/>
81     <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="@GCC_ROOT@/lib" type="path"/>
82     <runtime name="PATH" value="@GCC_ROOT@/bin" type="path"/>
83     </tool>
84     EOF_TOOLFILE
85    
86     cat << \EOF_TOOLFILE >%i/etc/scram.d/ccompiler.xml
87     <tool name="ccompiler" version="@LLVM_VERSION@" type="compiler">
88     <client>
89     <environment name="CCOMPILER_BASE" default="@LLVM_ROOT@"/>
90     <environment name="GCCBINDIR" value="$CCOMPILER_BASE/bin"/>
91     <environment name="CC" value="$GCCBINDIR/clang@COMPILER_NAME_SUFFIX@"/>
92     </client>
93     <flags CDEBUGFLAG="-g"/>
94     <flags CSHAREDOBJECTFLAGS="-fPIC"/>
95     <flags CFLAGS="-pthread"/>
96     <flags CFLAGS="-O2"/>
97     <flags LDFLAGS="@OS_LDFLAGS@"/>
98     <flags CSHAREDFLAGS="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@"/>
99     <flags SCRAM_COMPILER_NAME="clangc@COMPILER_VERSION@"/>
100     <flags SCRAM_LANGUAGE_TYPE="C"/>
101     </tool>
102     EOF_TOOLFILE
103    
104     # Notice that on OSX we have a LIBDIR defined for f77compiler because gcc C++
105     # compiler (which comes from the system) does not know about where to find
106     # libgfortran.
107     cat << \EOF_TOOLFILE >%i/etc/scram.d/f77compiler.xml
108     <tool name="f77compiler" version="@GCC_VERSION@" type="compiler">
109     <lib name="gfortran"/>
110     <lib name="m"/>
111     <client>
112     <environment name="F77COMPILER_BASE" default="@G77_ROOT@"/>
113     <environment name="FC" default="$F77COMPILER_BASE/bin/gfortran"/>
114     @ARCH_FORTRAN_LIBDIR@
115     </client>
116     <flags SCRAM_COMPILER_NAME="clang@COMPILER_VERSION@"/>
117     <flags FFLAGS="-fno-second-underscore -Wunused -Wuninitialized -O2"/>
118     <flags FCO2FLAG="-O2"/>
119     <flags FCOPTIMISED="-O2"/>
120     <flags FCDEBUGFLAG="-g"/>
121     <flags FCSHAREDOBJECTFLAGS="-fPIC"/>
122     <flags SCRAM_LANGUAGE_TYPE="FORTRAN"/>
123     </tool>
124     EOF_TOOLFILE
125    
126     # NON-empty defaults
127     export COMPILER_EXEC_NAME="clang++"
128    
129     # First of all handle OS specific options.
130     case %cmsplatf in
131     slc* )
132     export OS_SHAREDFLAGS="-shared -Wl,-E"
133     export OS_SHAREDSUFFIX="so"
134     export OS_LDFLAGS="-Wl,-E -Wl,--hash-style=gnu"
135     export OS_RUNTIME_LDPATH_NAME="LD_LIBRARY_PATH"
136     ;;
137     osx* )
138     export OS_SHAREDFLAGS="-shared -dynamic -single_module"
139     export OS_SHAREDSUFFIX="dylib"
140     export OS_LDFLAGS="-Wl,-commons -Wl,use_dylibs"
141     export OS_RUNTIME_LDPATH_NAME="DYLD_LIBRARY_PATH"
142     ;;
143     esac
144    
145     # Then handle OS + architecture specific options (maybe we should enable more
146     # aggressive optimizations for amd64 as well??)
147     case %cmsplatf in
148     osx*_ia32_* )
149     export ARCH_CXXFLAGS="-arch i386"
150     export ARCH_SHAREDFLAGS="-arch i386"
151     export ARCH_LIB64DIR="lib"
152     export ARCH_FORTRAN_LIBDIR='<environment name="LIBDIR" default="$F77COMPILER_BASE/lib/gcc/i686-apple-darwin10/4.2.1"/>'
153     ;;
154     osx*_amd64_* )
155     export ARCH_CXXFLAGS="-arch x86_64"
156     export ARCH_SHAREDFLAGS="-arch x86_64"
157     export ARCH_LIB64DIR="lib"
158     export ARCH_FORTRAN_LIBDIR='<environment name="LIBDIR" default="$F77COMPILER_BASE/lib/gcc/i686-apple-darwin10/4.2.1/x86_64"/>'
159     ;;
160     osx*_ppc32_* )
161     export ARCH_CXXFLAGS="-arch ppc"
162     export ARCH_SHAREDFLAGS="-arch ppc"
163     export ARCH_LIB64DIR="lib"
164     ;;
165     slc*_amd64_* )
166     # For some reason on mac, some of the header do not compile if this is
167     # defined. Ignore for now.
168     export ARCH_CXXFLAGS="-Werror=overflow"
169     export ARCH_LIB64DIR="lib64"
170     export ARCH_LD_UNIT="-r -m elf_x86_64"
171     ;;
172     slc*_ia32_* )
173     # For some reason on mac, some of the header do not compile if this is
174     # defined. Ignore for now.
175     export ARCH_CXXFLAGS="-Werror=overflow"
176     export ARCH_LIB64DIR="lib"
177     export ARCH_LD_UNIT="-r -m elf_i386"
178     ;;
179     *)
180     echo "Unsupported."
181     exit 1
182     ;;
183     esac
184    
185     # Then handle compiler specific options. E.g. enable
186     # optimizations as they become available in gcc.
187     COMPILER_CXXFLAGS=
188     case %cmsplatf in
189     *_gcc4[56789]* )
190     COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -std=c++0x -ftree-vectorize"
191     F77_MMD="-cpp -MMD"
192     ;;
193     esac
194    
195     case %cmsplatf in
196     *_gcc4[3456789]* )
197     COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -Werror=type-limits"
198     ;;
199     esac
200    
201     # Enable visibility inlines hidden. Should drastically remove
202     # the amount of symbols due to templates.
203     # FIXME: not enabled on linux, yet, change the case statement
204     # to *_gcc4[23456789]* when stable.
205     case %cmsplatf in
206     osx* )
207     COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fvisibility-inlines-hidden"
208     ;;
209     esac
210    
211     export COMPILER_CXXFLAGS
212    
213     # Handle here platform specific overrides. In case we
214     # want to tune something for a specific architecture.
215     case %cmsplatf in
216     osx10[56]*)
217     # On macosx we explicitly pick up a compiler version so that there is
218     # actually matching between the platform specified to cmsBuild and the
219     # compiler.
220     export COMPILER_NAME_SUFFIX="-$COMPILER_VERSION_MAJOR.$COMPILER_VERSION_MINOR"
221     ;;
222     esac
223    
224     # General substitutions
225     perl -p -i -e 's|\@([^@]*)\@|$ENV{$1}|g' %i/etc/scram.d/*.xml
226    
227     %post
228 eulisse 1.3 %{relocateConfig}etc/scram.d/*.xml
229 eulisse 1.1 echo "LLVM_GCC_TOOLFILE_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'; export GCC_TOOLFILE_ROOT" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh
230     echo "setenv LLVM_GCC_TOOLFILE_ROOT '$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh