source: rtems-source-builder/source-builder/config/gcc-common-1.cfg @ fba2549

4.104.114.95
Last change on this file since fba2549 was fba2549, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 7, 2015 at 7:33:30 AM

rtems4.11: OpenMP support for ARM, PowerPC, SPARC

  • Property mode set to 100644
File size: 5.2 KB
Line 
1#
2# GCC Common Support.
3#
4# This configuration file configure's, make's and install's gcc. It uses
5# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
6#
7
8%include %{_configdir}/checks.cfg
9
10%ifn %{defined gcc_version_message}
11%error No GCC Version message defined.
12%endif
13
14#
15# The package description.
16#
17Name:      %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{_host}-%{release}
18Summary:   GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
19Version:   %{gcc_version}
20Release:   %{release}
21URL:       http://gcc.gnu.org/
22BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
23
24#
25# Supports Candian Cross (Cxc).
26#
27%define allow_cxc
28
29#
30# The GCC library directory
31#
32%global _gcclibdir %{_prefix}/lib
33
34#
35# Prepare the source code.
36#
37%prep
38  # save the build top directory and cd back to it rather than
39  # using 'cd ..' because some shells change $PWD to a symlink's
40  # target location and 'cd ..' fails.
41  build_top=$(pwd)
42
43  gcc_source=%{?gcc_external:%{gcc_expand_name}}%{!?gcc_external:"gcc-%{gcc_version}"}
44
45  # gcc and optional the g++ core if separate packages
46  source_dir_gcc=${gcc_source}
47  %source setup gcc -q -n ${gcc_source}
48
49  %patch setup gcc -p1
50  cd ${build_top}
51
52  # newlib
53  source_dir_newlib="newlib-%{newlib_version}"
54  %source setup newlib -q -D -n newlib-%{newlib_version}
55  %patch setup newlib -p1
56  cd ${build_top}
57
58  # Link newlib into the gcc source tree
59  %{__rmfile} ${source_dir_gcc}/newlib
60  %{__ln_s} $PWD/${source_dir_newlib}/newlib ${source_dir_gcc}/newlib
61
62  # MPFR
63  source_dir_mpfr="mpfr-%{mpfr_version}"
64  %source setup mpfr -q -D -n mpfr-%{mpfr_version}
65  %patch setup mpfr -p1
66  cd ${build_top}
67  # Build MPFR one-tree style
68  %{__rmfile} ${source_dir_gcc}/mpfr
69  %{__ln_s} $PWD/${source_dir_mpfr} ${source_dir_gcc}/mpfr
70
71  # MPC
72  source_dir_mpc="mpc-%{mpc_version}"
73  %source setup mpc -q -D -n mpc-%{mpc_version}
74  %patch setup mpc -p1
75  cd ${build_top}
76  # Build MPC one-tree style
77  %{__rmfile} ${source_dir_gcc}/mpc
78  %{__ln_s} $PWD/${source_dir_mpc} ${source_dir_gcc}/mpc
79
80  # GMP
81  source_dir_gmp="gmp-%{gmp_version}"
82  %source setup gmp -q -D -n gmp-%{gmp_version}
83  %patch setup gmp -p1
84  cd ${build_top}
85  # Build GMP one-tree style
86  %{__rmfile} ${source_dir_gcc}/gmp
87  %{__ln_s} $PWD/${source_dir_gmp} ${source_dir_gcc}/gmp
88
89  echo "%{gcc_version_message}" > ${source_dir_gcc}/gcc/DEV-PHASE
90
91  # Fix timestamps
92  cd ${source_dir_gcc}
93  contrib/gcc_update --touch
94  cd ${build_top}
95
96%build
97  build_top=$(pwd)
98
99  %{build_directory}
100
101  mkdir -p ${build_dir}
102  cd ${build_dir}
103
104  # Languages.
105  languages="c"
106%if %{enable_cxx}
107  languages="$languages,c++"
108%endif
109%if %{enable_ada}
110  languages="$languages,ada"
111%endif
112%if %{enable_go}
113  languages="$languages,go"
114%endif
115%if %{enable_fortran}
116  languages="$languages,fortran"
117%endif
118%if %{enable_java}
119  languages="$languages,java"
120%endif
121%if %{enable_objc}
122  languages="$languages,objc"
123%endif
124
125%if %{_host_os} == mingw32
126  zlib_option=""
127%else
128  zlib_option="--with-system-zlib"
129%endif
130
131  %{host_build_flags}
132
133  ../${source_dir_gcc}/configure \
134    --prefix=%{_prefix} \
135    --bindir=%{_bindir} \
136    --exec_prefix=%{_exec_prefix} \
137    --includedir=%{_includedir} \
138    --libdir=%{_gcclibdir} \
139    --libexecdir=%{_libexecdir} \
140    --mandir=%{_mandir} \
141    --infodir=%{_infodir} \
142    --datadir=%{_datadir} \
143    --build=%{_build} --host=%{_host} \
144    --target=%{_target} \
145    --disable-libstdcxx-pch \
146    --with-gnu-as --with-gnu-ld --verbose \
147    --with-newlib \
148    "$zlib_option" \
149    --disable-nls --without-included-gettext \
150    --disable-win32-registry \
151    --enable-version-specific-runtime-libs \
152    --disable-lto \
153    --enable-newlib-io-c99-formats \
154    %{?with_iconv:--enable-newlib-iconv} \
155    %{?with_iconv:--enable-newlib-iconv-encodings=%{_newlib_iconv_encodings}} \
156    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
157    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
158    %{?enable_obsolete:--enable-obsolete} \
159    %{?with_libgomp:--enable-libgomp} \
160    %{?gcc_configure_extra_options:%{gcc_configure_extra_options}} \
161    --enable-languages="$languages"
162
163  if test "%_host" != "%_build" ; then
164    # Bug in gcc-3.2.1:
165    # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
166    mkdir -p gcc/include
167    cp ../${source_dir_gcc}/gcc/gsyslimits.h gcc/include/syslimits.h
168  fi
169
170  %{__make} %{?_smp_mflags} all
171
172  cd ${build_top}
173
174%install
175  build_top=$(pwd)
176
177  %{__rmdir} $SB_BUILD_ROOT
178
179  cd ${build_dir}
180  %{__make} DESTDIR=$SB_BUILD_ROOT install
181  cd ${build_top}
182
183  # libiberty doesn't honor --libdir, but always installs to a
184  # magically guessed _libdir
185  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
186
187  # We use the version from binutils
188  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
189
190  # We don't ship info/dir
191  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
192
193  # Don't want libffi's man-pages
194  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
195
196  # Clean the symlinks away incase the source is a repo
197  # Note, delete as a directory because of MSYS2 support on Windows.
198  %{__rmdir} ${source_dir_gcc}/newlib
199  %{__rmdir} ${source_dir_gcc}/mpfr
200  %{__rmdir} ${source_dir_gcc}/mpc
201  %{__rmdir} ${source_dir_gcc}/gmp
202
203%testing
204  # Add testing here.
205  export RUNTESTFLAGS=--target_board=%{_target}-run
Note: See TracBrowser for help on using the repository browser.