Mon, 28 Mar 2011 19:41:02 +0200
Completely rework package including...
Simpify 64-bit -fPIC logic, instruct make to build in parallel,
force error condition on failed profile dependency, build the
standard 'bootstrap' target as suggested, correct grammar, wording,
and punctuation in general, upgrade to latest upstream vendor version,
rearrange package dependencies mpc, mpfr, and gmp, correct buildconf
thanks to new lto-plugin forced, avoid failed platform specific stage
comparison, adjust patch code to reflect new version update, and most
importantly adjust optimization flags to platform. Please note that
block 'correct hardcoded paths' is likely no yet complete.
michael@320 | 1 | ## |
michael@320 | 2 | ## gcc.spec -- OpenPKG RPM Package Specification |
michael@320 | 3 | ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@320 | 4 | ## |
michael@320 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@320 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@320 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@320 | 8 | ## copies. |
michael@320 | 9 | ## |
michael@320 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@320 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@320 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@320 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@320 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@320 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@320 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@320 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@320 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@320 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@320 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@320 | 21 | ## SUCH DAMAGE. |
michael@320 | 22 | ## |
michael@320 | 23 | |
michael@320 | 24 | # package version |
michael@332 | 25 | %define V_full 4.6.0 |
michael@320 | 26 | %define V_comp %nil |
michael@320 | 27 | |
michael@320 | 28 | # package information |
michael@320 | 29 | Name: gcc |
michael@320 | 30 | Summary: GNU Compiler Collection |
michael@320 | 31 | URL: http://gcc.gnu.org/ |
michael@320 | 32 | Vendor: Free Software Foundation |
michael@320 | 33 | Packager: OpenPKG Foundation e.V. |
michael@320 | 34 | Distribution: OpenPKG Community |
michael@320 | 35 | Class: CORE |
michael@320 | 36 | Group: Compiler |
michael@320 | 37 | License: GPL |
michael@320 | 38 | Version: %{V_full} |
michael@321 | 39 | Release: 20110320 |
michael@320 | 40 | |
michael@320 | 41 | # package options |
michael@320 | 42 | %option with_binutils yes |
michael@320 | 43 | %option with_cxx yes |
michael@320 | 44 | %option with_objc no |
michael@320 | 45 | %option with_java no |
michael@320 | 46 | %option with_fortran no |
michael@320 | 47 | %option with_optimize yes |
michael@320 | 48 | %option with_profile no |
michael@320 | 49 | %option with_threads yes |
michael@320 | 50 | %option with_multilib no |
michael@320 | 51 | |
michael@320 | 52 | # list of sources |
michael@320 | 53 | Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-core-%{V_full}.tar.bz2 |
michael@320 | 54 | Source1: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-g++-%{V_full}.tar.bz2 |
michael@320 | 55 | Source2: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-objc-%{V_full}.tar.bz2 |
michael@320 | 56 | Source3: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-java-%{V_full}.tar.bz2 |
michael@320 | 57 | Source4: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_full}/gcc-fortran-%{V_full}.tar.bz2 |
michael@320 | 58 | Patch0: gcc.patch |
michael@320 | 59 | |
michael@320 | 60 | # build information |
michael@321 | 61 | Prefix: %{l_prefix} |
michael@321 | 62 | BuildRoot: %{l_buildroot} |
michael@332 | 63 | BuildPreReq: OpenPKG, openpkg >= 20060823, make |
michael@322 | 64 | PreReq: OpenPKG, openpkg >= 20060823 |
michael@332 | 65 | BuildPreReq: mpc, mpfr, gmp |
michael@332 | 66 | PreReq: mpc, mpfr, gmp |
michael@320 | 67 | %if "%{with_binutils}" == "yes" |
michael@320 | 68 | BuildPreReq: binutils >= 2.14 |
michael@320 | 69 | PreReq: binutils >= 2.14 |
michael@320 | 70 | %endif |
michael@320 | 71 | %if "%{with_cxx}" == "yes" |
michael@320 | 72 | BuildPreReq: libiconv |
michael@320 | 73 | PreReq: libiconv |
michael@320 | 74 | %endif |
michael@320 | 75 | %if "%{with_java}" == "yes" |
michael@320 | 76 | BuildPreReq: zlib |
michael@320 | 77 | PreReq: zlib |
michael@320 | 78 | %endif |
michael@321 | 79 | AutoReq: no |
michael@321 | 80 | AutoReqProv: no |
michael@320 | 81 | |
michael@320 | 82 | %description |
michael@320 | 83 | The GNU Compiler Collection (GCC) provides standard conforming and |
michael@320 | 84 | highly portable compilers for the ISO C, ISO C++, Objective-C, |
michael@320 | 85 | Fortran and Java languages. |
michael@320 | 86 | |
michael@320 | 87 | %track |
michael@320 | 88 | prog gcc = { |
michael@320 | 89 | version = %{V_full} |
michael@320 | 90 | url = ftp://gcc.gnu.org/pub/gcc/releases/ |
michael@320 | 91 | regex = gcc-(4\.\d+\.\d+) |
michael@320 | 92 | url = ftp://gcc.gnu.org/pub/gcc/releases/gcc-__NEWVER__/ |
michael@320 | 93 | regex = gcc-core-(\d+\.\d+\.\d+)\.tar\.bz2 |
michael@320 | 94 | } |
michael@320 | 95 | |
michael@320 | 96 | %prep |
michael@320 | 97 | %setup -q |
michael@320 | 98 | %if "%{with_cxx}" == "yes" |
michael@320 | 99 | %setup -q -T -D -b 1 |
michael@320 | 100 | %endif |
michael@320 | 101 | %if "%{with_objc}" == "yes" |
michael@320 | 102 | %setup -q -T -D -b 2 |
michael@320 | 103 | %endif |
michael@320 | 104 | %if "%{with_java}" == "yes" |
michael@320 | 105 | %setup -q -T -D -b 3 |
michael@320 | 106 | %endif |
michael@320 | 107 | %if "%{with_fortran}" == "yes" |
michael@320 | 108 | %setup -q -T -D -b 4 |
michael@320 | 109 | %endif |
michael@320 | 110 | %patch -p0 |
michael@332 | 111 | %{l_shtool} subst \ |
michael@332 | 112 | -e 's;\(instname="\$dir/\$name"\)i;\1;' \ |
michael@332 | 113 | ltmain.sh |
michael@320 | 114 | %{l_shtool} subst -v -s \ |
michael@328 | 115 | -e 's;\(gmplibs="-lmpc\) \(-lmpfr -lgmp\);\1 -lm \2;' \ |
michael@328 | 116 | configure |
michael@328 | 117 | %{l_shtool} subst -v -s \ |
michael@320 | 118 | -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \ |
michael@320 | 119 | gcc/configure |
michael@332 | 120 | %{l_shtool} subst \ |
michael@332 | 121 | -e 's;[ \t]*-W[a-zA-Z0-9_\-][a-zA-Z0-9_\-]*,*;;g' \ |
michael@332 | 122 | lto-plugin/Makefile.in |
michael@332 | 123 | %{l_shtool} subst \ |
michael@332 | 124 | -e 's;-rpath *[^ \t][^ \t]*;;g' \ |
michael@332 | 125 | -e 's;--tag=disable-static;--tag=disable-shared;g' \ |
michael@332 | 126 | -e 's;\.\./libiberty/libiberty\.a;-L../libiberty -liberty;g' \ |
michael@332 | 127 | -e 's;\.\./libiberty/pic/libiberty\.a;-L../libiberty/pic -liberty;g' \ |
michael@332 | 128 | lto-plugin/Makefile.in |
michael@320 | 129 | if [ ".%{V_comp}" != . ]; then |
michael@320 | 130 | %{l_shtool} subst -v -s \ |
michael@320 | 131 | -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \ |
michael@320 | 132 | `find . -name Makefile.in -type f -print` |
michael@320 | 133 | fi |
michael@320 | 134 | case "%{l_platform -t}" in |
michael@320 | 135 | amd64*-linux* ) |
michael@320 | 136 | %{l_shtool} subst \ |
michael@320 | 137 | -e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \ |
michael@320 | 138 | -e 's/test x.gcc_no_link = xyes/false/g' \ |
michael@320 | 139 | libstdc++-v3/configure |
michael@320 | 140 | ;; |
michael@320 | 141 | esac |
michael@320 | 142 | %{l_shtool} subst \ |
michael@320 | 143 | -e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \ |
michael@320 | 144 | libstdc++-v3/include/ext/codecvt_specializations.h |
michael@320 | 145 | |
michael@320 | 146 | %build |
michael@320 | 147 | # create build sub-directory |
michael@320 | 148 | %{l_shtool} mkdir -p obj |
michael@320 | 149 | cd obj |
michael@320 | 150 | |
michael@322 | 151 | # solve strange compatability problems |
michael@328 | 152 | %if "%{with_binutils}" == "yes" |
michael@328 | 153 | # determine ld(1) and as(1) usage, allowing either |
michael@328 | 154 | # one to be from the GNU distribution of binutils |
michael@328 | 155 | LD=%{l_tool_locate ld ld} |
michael@328 | 156 | AS=%{l_tool_locate as as} |
michael@322 | 157 | %else |
michael@328 | 158 | # locate ld(1) and as(1), using the GNU assembler |
michael@328 | 159 | # but ignoring the presence of any OpenPKG linker |
michael@328 | 160 | LD=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin which ld` |
michael@328 | 161 | AS=`PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/bin:/opt/sbin which as` |
michael@322 | 162 | %endif |
michael@320 | 163 | l_with_gnu_ld_as="" |
michael@322 | 164 | echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="--with-ld=$LD" |
michael@320 | 165 | echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS" |
michael@322 | 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" |
michael@322 | 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" |
michael@320 | 168 | |
michael@320 | 169 | # determine threads usage |
michael@320 | 170 | %if "%{with_threads}" == "yes" |
michael@320 | 171 | l_enable_threads="posix" |
michael@320 | 172 | %else |
michael@320 | 173 | l_enable_threads="single" |
michael@320 | 174 | %endif |
michael@320 | 175 | |
michael@320 | 176 | # determine language usage |
michael@320 | 177 | l_enable_languages="c" |
michael@320 | 178 | %if "%{with_cxx}" == "yes" |
michael@320 | 179 | l_enable_languages="${l_enable_languages},c++" |
michael@320 | 180 | %endif |
michael@320 | 181 | %if "%{with_objc}" == "yes" |
michael@320 | 182 | l_enable_languages="${l_enable_languages},objc" |
michael@320 | 183 | %endif |
michael@320 | 184 | %if "%{with_java}" == "yes" |
michael@320 | 185 | l_enable_languages="${l_enable_languages},java" |
michael@320 | 186 | %endif |
michael@320 | 187 | %if "%{with_fortran}" == "yes" |
michael@320 | 188 | l_enable_languages="${l_enable_languages},f95" |
michael@320 | 189 | %endif |
michael@320 | 190 | |
michael@320 | 191 | # disable GNU iconv usage |
michael@320 | 192 | ( echo "am_cv_func_iconv=no" |
michael@320 | 193 | echo "am_cv_lib_iconv=no" |
michael@320 | 194 | ) >config.cache |
michael@320 | 195 | |
michael@332 | 196 | # platform specific config logic |
michael@332 | 197 | case "%{l_platform -t}" in |
michael@332 | 198 | *i?86-sunos* ) echo "gcc_cv_prog_cmp_skip=true" >>config.cache;; |
michael@332 | 199 | esac |
michael@332 | 200 | |
michael@320 | 201 | # configure the package |
michael@322 | 202 | LD="$LD" \ |
michael@322 | 203 | AS="$AS" \ |
michael@320 | 204 | CC="%{l_cc}" \ |
michael@320 | 205 | CFLAGS="%{l_cflags}" \ |
michael@320 | 206 | %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
michael@320 | 207 | CPPFLAGS="%{l_cppflags}" \ |
michael@320 | 208 | LDFLAGS="%{l_ldflags}" \ |
michael@320 | 209 | %endif |
michael@320 | 210 | CONFIG_SHELL="%{l_bash}" \ |
michael@332 | 211 | GREP="%{l_bash}" \ |
michael@320 | 212 | ../configure \ |
michael@320 | 213 | --with-bugurl="http://openpkg.org/" \ |
michael@320 | 214 | --with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \ |
michael@320 | 215 | --cache-file=./config.cache \ |
michael@320 | 216 | --srcdir=`pwd`/.. \ |
michael@320 | 217 | --prefix=%{l_prefix} \ |
michael@320 | 218 | --exec-prefix=%{l_prefix} \ |
michael@320 | 219 | --mandir=%{l_prefix}/man \ |
michael@320 | 220 | --infodir=%{l_prefix}/info \ |
michael@320 | 221 | --includedir=%{l_prefix}/include/gcc%{V_comp} \ |
michael@320 | 222 | --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \ |
michael@320 | 223 | --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \ |
michael@320 | 224 | --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \ |
michael@320 | 225 | --enable-languages="${l_enable_languages}" \ |
michael@320 | 226 | --enable-threads="${l_enable_threads}" \ |
michael@320 | 227 | --disable-maintainer-mode \ |
michael@320 | 228 | --disable-shared \ |
michael@320 | 229 | --disable-nls \ |
michael@320 | 230 | %if "%{with_java}" == "yes" |
michael@320 | 231 | --with-system-zlib \ |
michael@320 | 232 | %endif |
michael@320 | 233 | %if "%{with_multilib}" == "yes" |
michael@320 | 234 | --enable-multilib \ |
michael@320 | 235 | %else |
michael@320 | 236 | --disable-multilib \ |
michael@320 | 237 | %endif |
michael@320 | 238 | %if "%{with_cxx}" == "yes" |
michael@320 | 239 | --with-libiconv-prefix=%{l_prefix} \ |
michael@320 | 240 | %endif |
michael@320 | 241 | --with-gmp=%{l_prefix} \ |
michael@320 | 242 | --with-mpfr=%{l_prefix} \ |
michael@320 | 243 | --with-mpc=%{l_prefix} \ |
michael@320 | 244 | ${l_with_gnu_ld_as} |
michael@320 | 245 | |
michael@320 | 246 | # determine build flags |
michael@320 | 247 | l_ccisgcc=no |
michael@320 | 248 | if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then |
michael@320 | 249 | l_ccisgcc=yes |
michael@320 | 250 | fi |
michael@320 | 251 | l_cflags="" |
michael@320 | 252 | l_cxxflags="" |
michael@320 | 253 | l_boot_cflags="" |
michael@320 | 254 | l_libcflags="-g" |
michael@320 | 255 | l_libcxxflags="-g" |
michael@320 | 256 | # at least GNU as from GNU binutils supports -pipe always |
michael@332 | 257 | "$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler" >/dev/null && { |
michael@320 | 258 | l_boot_cflags="$l_boot_cflags -pipe" |
michael@320 | 259 | l_libcxxflags="$l_libcxxflags -pipe" |
michael@320 | 260 | } |
michael@320 | 261 | %if "%{with_optimize}" == "yes" |
michael@332 | 262 | if [ ".$l_ccisgcc" = .yes ]; then |
michael@332 | 263 | l_ia32=native |
michael@332 | 264 | else |
michael@332 | 265 | l_ia32=pentium3 |
michael@332 | 266 | fi |
michael@332 | 267 | case "%{l_platform -t}" in |
michael@332 | 268 | *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=$l_ia32" ;; |
michael@332 | 269 | *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;; |
michael@332 | 270 | esac |
michael@332 | 271 | l_cflags="$l_cflags -O" |
michael@332 | 272 | l_boot_cflags="$l_boot_cflags -O3 -fomit-frame-pointer" |
michael@332 | 273 | l_libcxxflags="$l_libcxxflags -O3 -fno-implicit-templates" |
michael@332 | 274 | %else |
michael@332 | 275 | %if "%{with_optimize}" == "port" |
michael@332 | 276 | # conservatively optimize the generated program code for portable use, |
michael@332 | 277 | # also _tune_ for particular CPUs, but _without_ requiring these CPUs! |
michael@332 | 278 | case "%{l_platform -t}" in |
michael@332 | 279 | *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=generic" ;; |
michael@332 | 280 | *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v8" ;; |
michael@332 | 281 | esac |
michael@320 | 282 | l_cflags="$l_cflags -O" |
michael@320 | 283 | l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer" |
michael@320 | 284 | l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates" |
michael@320 | 285 | %else |
michael@332 | 286 | # do not optimize at all to avoid problems |
michael@320 | 287 | l_boot_cflags="$l_boot_cflags -O0" |
michael@320 | 288 | l_libcxxflags="$l_libcxxflags -O0" |
michael@320 | 289 | %endif |
michael@332 | 290 | %endif |
michael@332 | 291 | maketarget="bootstrap" |
michael@320 | 292 | %if "%{with_profile}" == "yes" |
michael@320 | 293 | # GCC >= 3.4 supports a "profiledbootstrap" target to build an |
michael@320 | 294 | # optimized version of itself through profiling. Because this |
michael@320 | 295 | # requires a (bootstrapping) C compiler with 64-bit arithmetic, |
michael@320 | 296 | # the whole approach is currently supported only if already |
michael@320 | 297 | # building with GCC as the bootstrapping C compiler. |
michael@320 | 298 | if [ ".$l_ccisgcc" = .yes ]; then |
michael@320 | 299 | maketarget="profiledbootstrap" |
michael@332 | 300 | else |
michael@332 | 301 | ( echo "Building a profiled GCC requires GCC. Please install GCC" |
michael@332 | 302 | echo "first and then build again with the profile option enabled." |
michael@332 | 303 | ) | %{l_rpmtool} msg -b -t error |
michael@332 | 304 | exit 1 |
michael@320 | 305 | fi |
michael@320 | 306 | %endif |
michael@320 | 307 | case "%{l_platform -t}" in |
michael@332 | 308 | *64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC" ;; |
michael@320 | 309 | esac |
michael@320 | 310 | %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes" || "%{with_cxx}" == "yes" |
michael@320 | 311 | l_cflags="$l_cflags %{l_cppflags}" |
michael@320 | 312 | l_cxxflags="$l_cxxflags %{l_cppflags}" |
michael@320 | 313 | l_libcflags="$l_libcflags %{l_cppflags}" |
michael@320 | 314 | l_libcxxflags="$l_libcxxflags %{l_cppflags}" |
michael@320 | 315 | %endif |
michael@320 | 316 | |
michael@320 | 317 | # build the package |
michael@332 | 318 | MAKE="%{l_make} %{l_mflags -O}" \ |
michael@332 | 319 | %{l_make} %{l_mflags -O} \ |
michael@332 | 320 | GREP="grep" \ |
michael@332 | 321 | MAKE="%{l_make} %{l_mflags -O}" \ |
michael@320 | 322 | BOOT_CFLAGS="${l_boot_cflags}" \ |
michael@320 | 323 | CFLAGS="${l_cflags}" \ |
michael@320 | 324 | CXXFLAGS="${l_cxxflags}" \ |
michael@320 | 325 | LIBCFLAGS="${l_libcflags}" \ |
michael@320 | 326 | LIBCXXFLAGS="${l_libcxxflags}" \ |
michael@320 | 327 | $maketarget |
michael@320 | 328 | |
michael@320 | 329 | %install |
michael@321 | 330 | rm -rf $RPM_BUILD_ROOT |
michael@320 | 331 | |
michael@320 | 332 | # fetch GNU platform triple |
michael@320 | 333 | triple=`./config.guess` |
michael@320 | 334 | |
michael@320 | 335 | # perform the standard installation procedure |
michael@320 | 336 | ( cd obj |
michael@320 | 337 | %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
michael@320 | 338 | ) || exit $? |
michael@320 | 339 | |
michael@320 | 340 | # cleanup installation tree |
michael@320 | 341 | mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \ |
michael@320 | 342 | $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \ |
michael@320 | 343 | >/dev/null 2>&1 || true |
michael@320 | 344 | mv $RPM_BUILD_ROOT%{l_prefix}/lib64/{lib*.a,*.spec} \ |
michael@320 | 345 | $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/ \ |
michael@320 | 346 | >/dev/null 2>&1 || true |
michael@320 | 347 | dirs="" |
michael@320 | 348 | for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do |
michael@320 | 349 | subdir=`echo "$multilib" | sed -e 's/;.*$//'` |
michael@320 | 350 | [ ".$subdir" = .. ] && continue |
michael@320 | 351 | mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \ |
michael@320 | 352 | $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \ |
michael@320 | 353 | >/dev/null 2>&1 || true |
michael@320 | 354 | mv $RPM_BUILD_ROOT%{l_prefix}/lib64/$subdir/lib*.a \ |
michael@320 | 355 | $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/ \ |
michael@320 | 356 | >/dev/null 2>&1 || true |
michael@320 | 357 | dirs="$dirs $subdir" |
michael@320 | 358 | done |
michael@320 | 359 | for subdir in $dirs; do |
michael@320 | 360 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir >/dev/null 2>&1 || true |
michael@320 | 361 | done |
michael@320 | 362 | mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \ |
michael@320 | 363 | $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \ |
michael@320 | 364 | >/dev/null 2>&1 || true |
michael@320 | 365 | |
michael@332 | 366 | # correct hardcoded paths |
michael@332 | 367 | %{l_shtool} subst \ |
michael@332 | 368 | -e "s;\(dependency_libs='[ \t]*-L\).*;\1%{l_prefix}/lib -L%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]* -liberty';" \ |
michael@332 | 369 | $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/liblto_plugin.la |
michael@332 | 370 | |
michael@320 | 371 | # strip installation tree |
michael@320 | 372 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} |
michael@320 | 373 | rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir |
michael@320 | 374 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true |
michael@320 | 375 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true |
michael@320 | 376 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib64 >/dev/null 2>&1 || true |
michael@320 | 377 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true |
michael@320 | 378 | %if "%{with_cxx}" == "yes" |
michael@320 | 379 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true |
michael@320 | 380 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true |
michael@320 | 381 | %endif |
michael@320 | 382 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
michael@320 | 383 | for prog in cc1 cc1plus collect2 cpp; do |
michael@320 | 384 | strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \ |
michael@320 | 385 | >/dev/null 2>&1 || true |
michael@320 | 386 | done |
michael@320 | 387 | |
michael@320 | 388 | # bump up installation tree |
michael@320 | 389 | ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \ |
michael@320 | 390 | $RPM_BUILD_ROOT%{l_prefix}/bin/cc |
michael@320 | 391 | ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \ |
michael@320 | 392 | $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1 |
michael@320 | 393 | %if "%{with_cxx}" == "yes" |
michael@320 | 394 | ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \ |
michael@320 | 395 | $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1 |
michael@320 | 396 | %endif |
michael@320 | 397 | |
michael@320 | 398 | # determine installation file list |
michael@320 | 399 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
michael@320 | 400 | |
michael@320 | 401 | %files -f files |
michael@320 | 402 | |
michael@320 | 403 | %clean |
michael@321 | 404 | rm -rf $RPM_BUILD_ROOT |
michael@320 | 405 |