ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/gcc-toolfile.spec
Revision: 1.29
Committed: Tue Aug 10 09:10:48 2010 UTC (14 years, 8 months ago) by eulisse
Branch: MAIN
Changes since 1.28: +28 -1 lines
Log Message:
Force c++-4.0 for osx10[56]*gcc40* architecture.

File Contents

# User Rev Content
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 elmer 1.25 slc5_ia32_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 elmer 1.28 <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 -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=strict-overflow -fdiagnostics-show-option"/>
46 muzaffar 1.22 <flags ldflags="@LDOPT@"/>
47     <flags cxxsharedflags="-Wl,-E"/>
48     <flags sharedsuffix="so"/>
49     <flags scram_language_type="C++"/>
50 elmer 1.28 <runtime name="LD_LIBRARY_PATH" value="$GCC_BASE/lib64" type="path"/>
51     <runtime name="LD_LIBRARY_PATH" value="$GCC_BASE/lib" type="path"/>
52 muzaffar 1.22 <runtime name="PATH" value="$GCC_BASE/bin" type="path"/>
53     </tool>
54 elmer 1.7 EOF_TOOLFILE
55 muzaffar 1.22 cat << \EOF_TOOLFILE >%i/etc/scram.d/ccompiler.xml
56     <tool name="ccompiler" version="@GCC_VERSION@" type="compiler">
57     <client>
58     <environment name="GCC_BASE" default="@GCC_ROOT@"/>
59     <environment name="GCCBINDIR" value="$GCC_BASE/bin"/>
60     <environment name="CC" value="$GCCBINDIR/gcc"/>
61     </client>
62     <flags cdebugflag="-g"/>
63     <flags csharedobjectflags="-fPIC"/>
64     <flags cflags="-pthread"/>
65     <flags cflags="-O2"/>
66     <flags ldflags="-Wl,-E"/>
67     <flags csharedflags="-Wl,-E"/>
68     <flags scram_compiler_name="gcc@COMPILER_VERSION@"/>
69     <flags scram_language_type="C"/>
70     </tool>
71 elmer 1.7 EOF_TOOLFILE
72 muzaffar 1.22 cat << \EOF_TOOLFILE >%i/etc/scram.d/f77compiler.xml
73     <tool name="f77compiler" version="@GCC_VERSION@" type="compiler">
74     <lib name="gfortran"/>
75     <lib name="m"/>
76     <client>
77     <environment name="G77_BASE" default="@GCC_ROOT@"/>
78     <environment name="FC" default="$G77_BASE/bin/gfortran"/>
79     </client>
80     <flags scram_compiler_name="gcc@COMPILER_VERSION@"/>
81     <flags fflags="-fno-second-underscore -Wunused -Wuninitialized -O2"/>
82     <flags fco2flag="-O2"/>
83     <flags fcoptimised="-O2"/>
84     <flags fcdebugflag="-g"/>
85     <flags fcsharedobjectflags="-fPIC"/>
86     <flags scram_language_type="FORTRAN"/>
87     </tool>
88 elmer 1.7 EOF_TOOLFILE
89     ;;
90 eulisse 1.29 osx104_ppc32_gcc40* | osx104_ia32_gcc40* | osx10[56]*_gcc42* )
91 muzaffar 1.22 cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler.xml
92     <tool name="cxxcompiler" version="@GCC_VERSION@" type="compiler">
93     <client>
94     <environment name="GCC_BASE" default="@GCC_ROOT@"/>
95     <environment name="GCCBINDIR" default="$GCC_BASE/bin"/>
96     <environment name="CXX" value="$GCCBINDIR/c++"/>
97     </client>
98     <flags SCRAM_COMPILER_NAME="gcc40"/>
99     <flags CCcompiler="gcc40"/>
100     <flags MODULEFLAGS=" "/>
101     <flags CXXDEBUGFLAG="-g"/>
102     <flags CPPDEFINES="GNU_GCC"/>
103     <flags CPPDEFINES="_GNU_SOURCE"/>
104     <flags CXXSHAREDOBJECTFLAGS="-fPIC"/>
105 dsr 1.24 <flags CXXFLAGS="@OSXARCH@ -pedantic -ansi -pipe"/>
106 muzaffar 1.22 <flags CXXFLAGS="-O2"/>
107     <flags CXXFLAGS="-felide-constructors -fmessage-length=0 -ftemplate-depth-300"/>
108     <flags CXXFLAGS="-Wall -Wno-non-template-friend -Wno-long-long -Wimplicit -Wreturn-type -Wunused -Wparentheses"/>
109     <flags LDFLAGS=" "/>
110 dsr 1.24 <flags CXXSHAREDFLAGS="@OSXARCH@ -dynamiclib -single_module"/>
111 muzaffar 1.22 <flags SHAREDSUFFIX="dylib"/>
112     <flags SCRAM_LANGUAGE_TYPE="C++"/>
113 dsr 1.23 <runtime name="DYLD_LIBRARY_PATH" value="$GCC_BASE/lib" type="path"/>
114     <runtime name="PATH" value="$GCC_BASE/bin" type="path"/>
115 muzaffar 1.22 </tool>
116 eulisse 1.1 EOF_TOOLFILE
117 eulisse 1.29 osx10[56]*_gcc40* )
118     cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler.xml
119     <tool name="cxxcompiler" version="@GCC_VERSION@" type="compiler">
120     <client>
121     <environment name="GCC_BASE" default="@GCC_ROOT@"/>
122     <environment name="GCCBINDIR" default="$GCC_BASE/bin"/>
123     <environment name="CXX" value="$GCCBINDIR/c++-4.0"/>
124     </client>
125     <flags SCRAM_COMPILER_NAME="gcc40"/>
126     <flags CCcompiler="gcc40"/>
127     <flags MODULEFLAGS=" "/>
128     <flags CXXDEBUGFLAG="-g"/>
129     <flags CPPDEFINES="GNU_GCC"/>
130     <flags CPPDEFINES="_GNU_SOURCE"/>
131     <flags CXXSHAREDOBJECTFLAGS="-fPIC"/>
132     <flags CXXFLAGS="@OSXARCH@ -pedantic -ansi -pipe"/>
133     <flags CXXFLAGS="-O2"/>
134     <flags CXXFLAGS="-felide-constructors -fmessage-length=0 -ftemplate-depth-300"/>
135     <flags CXXFLAGS="-Wall -Wno-non-template-friend -Wno-long-long -Wimplicit -Wreturn-type -Wunused -Wparentheses"/>
136     <flags LDFLAGS=" "/>
137     <flags CXXSHAREDFLAGS="@OSXARCH@ -dynamiclib -single_module"/>
138     <flags SHAREDSUFFIX="dylib"/>
139     <flags SCRAM_LANGUAGE_TYPE="C++"/>
140     <runtime name="DYLD_LIBRARY_PATH" value="$GCC_BASE/lib" type="path"/>
141     <runtime name="PATH" value="$GCC_BASE/bin" type="path"/>
142     </tool>
143     EOF_TOOLFILE
144 eulisse 1.1 ;;
145     esac
146    
147 elmer 1.15 # Specific substitutions to the templates above (default case needed?)
148     case %cmsplatf in
149 andreasp 1.17 slc5_ia32_gcc4* | slc5onl_ia32_gcc4* )
150 muzaffar 1.22 perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|g" %i/etc/scram.d/cxxcompiler.xml
151     perl -p -i -e "s|\@GXXOPT\@|-O2|g" %i/etc/scram.d/cxxcompiler.xml
152 elmer 1.15 ;;
153 elmer 1.19 slc5_amd64_gcc4* )
154 muzaffar 1.22 perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|g" %i/etc/scram.d/cxxcompiler.xml
155 elmer 1.25 perl -p -i -e "s|\@GXXOPT\@|-O2 -ftree-vectorize|g" %i/etc/scram.d/cxxcompiler.xml
156 elmer 1.15 ;;
157 dsr 1.24 osx*_ia32_gcc4* )
158     perl -p -i -e "s|\@OSXARCH\@|-arch i386|g" %i/etc/scram.d/cxxcompiler.xml
159     ;;
160     osx*_amd64_gcc4* )
161     perl -p -i -e "s|\@OSXARCH\@|-arch x86_64|g" %i/etc/scram.d/cxxcompiler.xml
162     ;;
163     osx*_ppc32_gcc4* )
164     perl -p -i -e "s|\@OSXARCH\@|-arch ppc|g" %i/etc/scram.d/cxxcompiler.xml
165     ;;
166 elmer 1.15 esac
167    
168     # General substitutions
169 eulisse 1.1 perl -p -i -e "s|\@GCC_ROOT\@|$GCC_ROOT|g;
170     s|\@GCC_VERSION\@|$GCC_VERSION|g;
171     s|\@COMPILER_VERSION\@|$COMPILER_VERSION|g;
172     s|\@COMPILER_VERSION_MAJOR\@|$COMPILER_VERSION_MAJOR|g;
173 muzaffar 1.22 " %i/etc/scram.d/cxxcompiler.xml \
174     %i/etc/scram.d/ccompiler.xml \
175     %i/etc/scram.d/f77compiler.xml
176 eulisse 1.1 %post
177 muzaffar 1.22 %{relocateConfig}etc/scram.d/cxxcompiler.xml
178     %{relocateConfig}etc/scram.d/ccompiler.xml
179     %{relocateConfig}etc/scram.d/f77compiler.xml