142 %{l_shtool} subst \ |
145 %{l_shtool} subst \ |
143 -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \ |
146 -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \ |
144 libstdc++-v3/include/ext/codecvt_specializations.h |
147 libstdc++-v3/include/ext/codecvt_specializations.h |
145 |
148 |
146 %build |
149 %build |
147 # create build sub-directory |
150 # create build subdirectory |
148 %{l_shtool} mkdir -p obj |
151 %{l_shtool} mkdir -p obj |
149 cd obj |
152 cd obj |
150 |
153 |
151 # solve strange compatability problems |
154 # locate ld(1) and as(1) accordingly |
152 %if "%{with_binutils}" == "yes" |
155 %if "%{with_binutils}" == "yes" |
153 # determine ld(1) and as(1) usage, allowing either |
156 # allow OpenPKG binutils |
154 # one to be from the GNU distribution of binutils |
|
155 LD=%{l_tool_locate ld ld} |
157 LD=%{l_tool_locate ld ld} |
156 AS=%{l_tool_locate as as} |
158 AS=%{l_tool_locate as as} |
157 %else |
159 %else |
158 # locate ld(1) and as(1), using the GNU assembler |
160 # ignore OpenPKG binutils |
159 # but ignoring the presence of any OpenPKG linker |
161 LD=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin:/usr/local/bin:/usr/local/sbin which ld` |
160 LD=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin which ld` |
162 AS=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin:/usr/local/bin:/usr/local/sbin which as` |
161 AS=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin which as` |
|
162 %endif |
163 %endif |
163 l_with_gnu_ld_as="" |
164 l_with_gnu_ld_as="" |
164 echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD" |
165 echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD" |
165 echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS" |
166 echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS" |
166 $LD --version </dev/null 2>/dev/null | grep "^GNU ld " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-ld" |
167 $LD --version </dev/null 2>/dev/null | grep "^GNU ld " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-ld" |
167 $AS --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-as" |
168 $AS --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as" || l_with_gnu_ld_as="${l_with_gnu_ld_as} --without-gnu-as" |
168 |
169 |
169 # determine threads usage |
170 # determine threads use |
170 %if "%{with_threads}" == "yes" |
171 %if "%{with_threads}" == "yes" |
171 l_enable_threads="posix" |
172 l_enable_threads="posix" |
172 %else |
173 %else |
173 l_enable_threads="single" |
174 l_enable_threads="single" |
174 %endif |
175 %endif |
175 |
176 |
176 # determine language usage |
177 # determine language use |
177 l_enable_languages="c" |
178 l_enable_languages="c" |
178 %if "%{with_cxx}" == "yes" |
179 %if "%{with_cxx}" == "yes" |
179 l_enable_languages="${l_enable_languages},c++" |
180 l_enable_languages="${l_enable_languages},c++" |
180 %endif |
181 %endif |
181 %if "%{with_objc}" == "yes" |
182 %if "%{with_objc}" == "yes" |
257 "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && { |
258 "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && { |
258 l_boot_cflags="$l_boot_cflags -pipe" |
259 l_boot_cflags="$l_boot_cflags -pipe" |
259 l_libcxxflags="$l_libcxxflags -pipe" |
260 l_libcxxflags="$l_libcxxflags -pipe" |
260 } |
261 } |
261 %if "%{with_optimize}" == "yes" |
262 %if "%{with_optimize}" == "yes" |
|
263 # GCC authors are not keeping up with optimized portability expectations |
|
264 ( echo "As GCC advances its optimization logic becomes increasingly complex (and" |
|
265 echo "buggy?) Since at least GCC 4.5, problems have been reported using arguments" |
|
266 echo "-O, -mtune, or -march implicitly or explicitly during different bootstrap" |
|
267 echo "stages as well as stage comparison and even the final installation." |
|
268 echo "" |
|
269 echo "Pay attention when building on one computer and installing on another as" |
|
270 echo "problems may be platform specific. If in doubt, disable optimization." |
|
271 ) | %{l_rpmtool} msg -b -t warn |
262 if [ ".$l_ccisgcc" = .yes ]; then |
272 if [ ".$l_ccisgcc" = .yes ]; then |
263 l_ia32=native |
273 l_archia32=native; l_archia64=native; l_archamd64=native |
264 else |
274 else |
265 l_ia32=pentium3 |
275 # CPU native detection only works with GCC (see driver-i386.c) |
|
276 ( echo "Platform specific optimization is enabled, but detection of appropriate" |
|
277 echo "native architecture is only possible when bootstrapping GCC using a pre-" |
|
278 echo "installed GCC. The current build is using a different compiler, so to" |
|
279 echo "provide any optimization at all a wild guess is made and a CPU type" |
|
280 echo "hardcoded instead of using accurate native detection." |
|
281 echo "" |
|
282 echo "To achieve accurate optimization of GCC please install GCC first. Then" |
|
283 echo "build this package a second time which will use GCC to bootstrap itself." |
|
284 ) | %{l_rpmtool} msg -b -t notice |
|
285 |
|
286 # guess lowest common denominator CPU types |
|
287 # http://en.wikipedia.org/wiki/(X86|X64-64) |
|
288 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html |
|
289 l_archia32=pentium3; l_archia64=nocona; l_archamd64=k8 |
266 fi |
290 fi |
|
291 # this optimization logic is unportable and could cause problems |
|
292 # if installing the resulting binary package on a different host! |
267 case "%{l_platform -t}" in |
293 case "%{l_platform -t}" in |
268 *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=$l_ia32" ;; |
|
269 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; |
294 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; |
|
295 *sun-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; |
|
296 *i?86-* ) l_boot_cflags="$l_boot_cflags -march=$l_archia32" ;; |
|
297 *ia64-* ) l_boot_cflags="$l_boot_cflags -march=$l_archia64" ;; |
|
298 *amd64-* ) l_boot_cflags="$l_boot_cflags -march=$l_archamd64" ;; |
|
299 * ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; |
270 esac |
300 esac |
271 l_cflags="$l_cflags -O" |
301 l_cflags="$l_cflags -O" |
272 l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" |
302 l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" |
273 l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" |
303 l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" |
274 %else |
304 %else |
275 %if "%{with_optimize}" == "port" |
305 # don't optimize at all to avoid problems |
276 # conservatively optimize the generated program code for portable use, |
|
277 # also _tune_ for particular CPUs, but _without_ requiring these CPUs! |
|
278 case "%{l_platform -t}" in |
|
279 *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; |
|
280 *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; |
|
281 esac |
|
282 l_cflags="$l_cflags -O" |
|
283 l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer" |
|
284 l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates" |
|
285 %else |
|
286 # do not optimize at all to avoid problems |
|
287 l_boot_cflags="$l_boot_cflags -O0" |
306 l_boot_cflags="$l_boot_cflags -O0" |
288 l_libcxxflags="$l_libcxxflags -O0" |
307 l_libcxxflags="$l_libcxxflags -O0" |
289 %endif |
308 %endif |
290 %endif |
309 %if "%{with_profile}" == "yes" |
|
310 maketarget="profiledbootstrap" |
|
311 loc_makeflags="%{l_mflags}" |
|
312 if [ ".$l_ccisgcc" != .yes ]; then |
|
313 ( echo "A preinstalled GCC is recommended when bootstrapping a profiled GCC. If the" |
|
314 echo "compiler used to bootstrap GCC doesn't support 64-bit arithmetic, then" |
|
315 echo "either runtime or buildtime errors could occur. Regardless of this," |
|
316 echo "parallel make logic is disabled according to profiling requirements." |
|
317 echo "" |
|
318 echo "If in doubt, stop now and start the build again with profiling disabled." |
|
319 ) | %{l_rpmtool} msg -b -t warn |
|
320 fi |
|
321 %else |
291 maketarget="bootstrap" |
322 maketarget="bootstrap" |
292 %if "%{with_profile}" == "yes" |
323 loc_makeflags="%{l_mflags -O}" |
293 # GCC >= 3.4 supports a "profiledbootstrap" target to build an |
|
294 # optimized version of itself through profiling. Because this |
|
295 # requires a (bootstrapping) C compiler with 64-bit arithmetic, |
|
296 # the whole approach is currently supported only if already |
|
297 # building with GCC as the bootstrapping C compiler. |
|
298 if [ ".$l_ccisgcc" = .yes ]; then |
|
299 maketarget="profiledbootstrap" |
|
300 else |
|
301 ( echo "Building a profiled GCC requires GCC. Please install GCC" |
|
302 echo "first and then build again with the profile option enabled." |
|
303 ) | %{l_rpmtool} msg -b -t error |
|
304 exit 1 |
|
305 fi |
|
306 %endif |
324 %endif |
307 case "%{l_platform -t}" in |
325 case "%{l_platform -t}" in |
308 *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
326 *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
309 esac |
327 esac |
310 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
328 %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |