ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/gcc-toolfile.spec
(Generate patch)

Comparing COMP/CMSDIST/gcc-toolfile.spec (file contents):
Revision 1.41 by elmer, Wed Nov 3 23:33:52 2010 UTC vs.
Revision 1.46 by muzaffar, Mon Dec 6 11:50:49 2010 UTC

# Line 1 | Line 1
1 < ### RPM cms gcc-toolfile 11.0
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
# Line 6 | Line 6
6  
7   Source: none
8  
9 %if "%(echo %cmsos | grep osx >/dev/null && echo true)" == "true"
10 Requires: gfortran-macosx
11 %endif
12
9   %prep
10   %build
11   %install
12   mkdir -p %i/etc/scram.d
17
18 # Determine the GCC_ROOT if "use system compiler is used.
13   if [ "X$GCC_ROOT" = X ]
14   then
15 <    export GCC_PATH=`which gcc` || exit 1
16 <    export GCC_ROOT=`echo $GCC_PATH | sed -e 's|/bin/gcc||'`
17 <    export GCC_VERSION=`gcc -v 2>&1 | grep "gcc version" | sed 's|[^0-9]*\([0-9].[0-9].[0-9]\).*|\1|'` || exit 1
24 <    export G77_ROOT=$GFORTRAN_MACOSX_ROOT
25 < else
26 <    export GCC_PATH
27 <    export GCC_ROOT
28 <    export GCC_VERSION
29 <    export G77_ROOT=$GCC_ROOT
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 < export COMPILER_VERSION=`echo %cmsplatf | sed -e 's|.*gcc\([0-9]*\).*|\1|'`
21 < export COMPILER_VERSION_MAJOR=`echo %cmsplatf | sed -e 's|.*gcc\([0-9]\).*|\1|'`
34 < export COMPILER_VERSION_MINOR=`echo %cmsplatf | sed -e 's|.*gcc[0-9]\([0-9]\).*|\1|'`
35 <
36 < # Generic template for the toolfiles.
37 < # *** USE @VARIABLE@ plus associated environment variable to customize. ***
38 < # DO NOT DUPLICATE the toolfile template.
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 + slc5_ia32_gcc4* | slc5_amd64_gcc4* | slc5onl_ia32_gcc4* )
28   cat << \EOF_TOOLFILE >%i/etc/scram.d/cxxcompiler.xml
29    <tool name="cxxcompiler" version="@GCC_VERSION@" type="compiler">
30      <client>
31 <      <environment name="CXXCOMPILER_BASE" default="@GCC_ROOT@"/>
32 <      <environment name="GCCBINDIR" default="$CXXCOMPILER_BASE/bin"/>
33 <      <environment name="CXX" value="$GCCBINDIR/c++@COMPILER_NAME_SUFFIX@"/>
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="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@"/>
38 <    <flags CXXDEBUGFLAG="-g"/>
39 <    <flags CPPDEFINES="GNU_GCC"/>
40 <    <flags CPPDEFINES="_GNU_SOURCE"/>
41 <    <flags CXXSHAREDOBJECTFLAGS="-fPIC"/>
42 <    <flags CXXFLAGS="-O2 -pedantic -ansi -pthread -pipe"/>
43 <    <flags CXXFLAGS="@ARCH_CXXFLAGS@ @COMPILER_CXXFLAGS@"/>
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 -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=strict-overflow -fdiagnostics-show-option"/>
46 <    <flags LDFLAGS="@OS_LDFLAGS@"/>
47 <    <flags CXXSHAREDFLAGS="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@"/>
48 <    <flags SHAREDSUFFIX="@OS_SHAREDSUFFIX@"/>
49 <    <flags LD_UNIT="@OS_LD_UNIT@ @ARCH_LD_UNIT@"/>
50 <    <flags SCRAM_LANGUAGE_TYPE="C++"/>
51 <    <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="$CXXCOMPILER_BASE/@ARCH_LIB64DIR@" type="path"/>
64 <    <runtime name="@OS_RUNTIME_LDPATH_NAME@" value="$CXXCOMPILER_BASE/lib" type="path"/>
65 <    <runtime name="PATH" value="$CXXCOMPILER_BASE/bin" type="path"/>
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 -Wtype-limits -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 >    <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   EOF_TOOLFILE
68
54   cat << \EOF_TOOLFILE >%i/etc/scram.d/ccompiler.xml
55    <tool name="ccompiler" version="@GCC_VERSION@" type="compiler">
56      <client>
57 <      <environment name="CCOMPILER_BASE" default="@GCC_ROOT@"/>
58 <      <environment name="GCCBINDIR" value="$CCOMPILER_BASE/bin"/>
59 <      <environment name="CC" value="$GCCBINDIR/gcc@COMPILER_NAME_SUFFIX@"/>
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="@OS_LDFLAGS@"/>
66 <    <flags CSHAREDFLAGS="@OS_SHAREDFLAGS@ @ARCH_SHAREDFLAGS@"/>
67 <    <flags SCRAM_COMPILER_NAME="gcc@COMPILER_VERSION@"/>
68 <    <flags SCRAM_LANGUAGE_TYPE="C"/>
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   EOF_TOOLFILE
86
87 # Notice that on OSX we have a LIBDIR defined for f77compiler because gcc C++
88 # compiler (which comes from the system) does not know about where to find
89 # libgfortran.
71   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="F77COMPILER_BASE" default="@G77_ROOT@"/>
77 <      <environment name="FC" default="$F77COMPILER_BASE/bin/gfortran"/>
97 <      @OS_FORTRAN_LIBDIR@
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"/>
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   EOF_TOOLFILE
88 <
89 < # NON-empty defaults
90 < export COMPILER_EXEC_NAME="c++"
91 <
92 < # First of all handle OS specific options.
93 < case %cmsplatf in
94 <  slc* )
95 <    export OS_SHAREDFLAGS="-shared -Wl,-E"
96 <    export OS_SHAREDSUFFIX="so"
97 <    export OS_LDFLAGS="-Wl,-E -Wl,--hash-style=gnu"
98 <    export OS_RUNTIME_LDPATH_NAME="LD_LIBRARY_PATH"
99 <  ;;
100 <  osx* )
101 <    export OS_SHAREDFLAGS="-shared -dynamic -single_module"
102 <    export OS_SHAREDSUFFIX="dylib"
103 <    export OS_RUNTIME_LDPATH_NAME="DYLD_LIBRARY_PATH"
104 <    export OS_FORTRAN_LIBDIR='<environment name="LIBDIR" default="$F77COMPILER_BASE/lib/gcc/i686-apple-darwin10/4.2.1"/>'
105 <  ;;
88 > ;;
89 > osx104_ppc32_gcc40* | osx104_ia32_gcc40* | osx10[56]* )
90 > 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="@OSXARCH@ -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="@OSXARCH@ -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 > EOF_TOOLFILE
116 > ;;
117   esac
118  
119 < # Then handle OS + architecture specific options (maybe we should enable more
129 < # aggressive optimizations for amd64 as well??)
119 > # Specific substitutions to the templates above (default case needed?)
120   case %cmsplatf in
121 <  osx*_ia32_* )
122 <    export ARCH_CXXFLAGS="-arch i386"
123 <    export ARCH_SHAREDFLAGS="-arch i386"
124 <    export ARCH_LIB64DIR="lib"
125 <  ;;
126 <  osx*_amd64_* )
127 <    export ARCH_CXXFLAGS="-arch x86_64"
128 <    export ARCH_SHAREDFLAGS="-arch x86_64"
129 <    export ARCH_LIB64DIR="lib"
140 <  ;;
141 <  osx*_ppc32_* )
142 <    export ARCH_CXXFLAGS="-arch ppc"
143 <    export ARCH_SHAREDFLAGS="-arch ppc"
144 <    export ARCH_LIB64DIR="lib"
145 <  ;;
146 <  slc*_amd64_* )
147 <    # For some reason on mac, some of the header do not compile if this is
148 <    # defined.  Ignore for now.
149 <    export ARCH_CXXFLAGS="-Werror=overflow"
150 <    export ARCH_LIB64DIR="lib64"
151 <    export ARCH_LD_UNIT="-r -m elf_x86_64"
121 >  slc5_ia32_gcc4* | slc5onl_ia32_gcc4* )
122 >    perl -p -i -e "s|\@LDOPT\@|-Wl,-E -Wl,--hash-style=gnu|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|g"   %i/etc/scram.d/cxxcompiler.xml
125 >  ;;
126 >  slc5_amd64_gcc4* )
127 >    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\@|lib64|g" %i/etc/scram.d/cxxcompiler.xml
129 >    perl -p -i -e "s|\@GXXOPT\@|-O2 -ftree-vectorize|g"   %i/etc/scram.d/cxxcompiler.xml
130    ;;
131 <  slc*_ia32_* )
132 <    # For some reason on mac, some of the header do not compile if this is
155 <    # defined.  Ignore for now.
156 <    export ARCH_CXXFLAGS="-Werror=overflow"
157 <    export ARCH_LIB64DIR="lib"
158 <    export ARCH_LD_UNIT="-r -m elf_i386"
131 >  osx*_ia32_gcc4* )
132 >    perl -p -i -e "s|\@OSXARCH\@|-arch i386|g"   %i/etc/scram.d/cxxcompiler.xml
133    ;;
134 <  *)
135 <    echo "Unsupported."
162 <    exit 1
134 >  osx*_amd64_gcc4* )
135 >    perl -p -i -e "s|\@OSXARCH\@|-arch x86_64|g"   %i/etc/scram.d/cxxcompiler.xml
136    ;;
137 < esac
138 <
166 < # Then handle compiler specific options. E.g. enable
167 < # optimizations as they become available in gcc.
168 < COMPILER_CXXFLAGS=
169 < case %cmsplatf in
170 <   *_gcc4[56789]* )
171 <     COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -std=c++0x -ftree-vectorize"
172 <     export COMPILER_CXXFLAGS
173 <   ;;
174 < esac
175 <
176 < case %cmsplatf in
177 <   *_gcc4[3456789]* )
178 <     COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -Werror=array-bounds -Werror=format-contains-nul"
179 <     export COMPILER_CXXFLAGS
180 <   ;;
181 < esac
182 <
183 < # Handle here platform specific overrides. In case we
184 < # want to tune something for a specific architecture.
185 < case %cmsplatf in
186 <  osx10[56]*)
187 <     # On macosx we explicitly pick up a compiler version so that there is
188 <     # actually matching between the platform specified to cmsBuild and the
189 <     # compiler.
190 <     export COMPILER_NAME_SUFFIX="-$COMPILER_VERSION_MAJOR.$COMPILER_VERSION_MINOR"
137 >  osx*_ppc32_gcc4* )
138 >    perl -p -i -e "s|\@OSXARCH\@|-arch ppc|g"   %i/etc/scram.d/cxxcompiler.xml
139    ;;
140   esac
141  
142   # General substitutions
143 < perl -p -i -e 's|\@([^@]*)\@|$ENV{$1}|g' %i/etc/scram.d/*.xml
144 <
143 > perl -p -i -e "s|\@GCC_ROOT\@|$GCC_ROOT|g;
144 >               s|\@GCC_VERSION\@|$GCC_VERSION|g;
145 >               s|\@COMPILER_VERSION\@|$COMPILER_VERSION|g;
146 >               s|\@COMPILER_VERSION_MAJOR\@|$COMPILER_VERSION_MAJOR|g;                                        
147 >                                        " %i/etc/scram.d/cxxcompiler.xml \
148 >                                          %i/etc/scram.d/ccompiler.xml  \
149 >                                          %i/etc/scram.d/f77compiler.xml
150   %post
151 < [ "X$RPM_INSTALL_PREFIX" == "X$CMS_INSTALL_PREFIX" ] || perl -p -i -e "s|$RPM_INSTALL_PREFIX|$CMS_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/%{pkgrel}/etc/scram.d/*.xml
152 < echo "GCC_TOOLFILE_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'; export GCC_TOOLFILE_ROOT" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh
153 < echo "setenv GCC_TOOLFILE_ROOT '$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh
151 > %{relocateConfig}etc/scram.d/cxxcompiler.xml
152 > %{relocateConfig}etc/scram.d/ccompiler.xml
153 > %{relocateConfig}etc/scram.d/f77compiler.xml

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines