############################################################################### # IPFire.org - An Open Source Firewall Solution # # Copyright (C) - IPFire Development Team # ############################################################################### # Configure build to compile with cloog and ppl. build_cloog_ppl = 1 name = gcc version = 4.6.2 release = 3 maintainer = Michael Tremer groups = Development/Compilers url = http://gcc.gnu.org/ license = GPLv3+ and GPLv2+ with exceptions summary = Various compilers (C, C++, Objective-C, Java, ...). description The gcc package contains the GNU Compiler Collection. \ You'll need this package in order to compile C code. end # This is the at least required version of binutils. required_binutils_version = 2.21.51.0.8-1 source_dl = http://ftp.gnu.org/gnu/gcc/%{thisapp}/ sources = %{thisapp}.tar.gz patches gcc46-hack.patch0 gcc46-c++-builtin-redecl.patch0 gcc46-pr33763.patch0 gcc46-libgomp-omp_h-multilib.patch0 gcc46-libtool-no-rpath.patch0 gcc46-cloog-dl.patch0 gcc46-pr38757.patch0 gcc46-no-add-needed.patch0 gcc46-unwind-debughook-sdt.patch0 gcc46-ppl-0.10.patch gcc46-Woverlength-string.patch0 gcc46-Woverlength-string-asm.patch0 gcc-4.6.0-piepatches-20110407.patch end build requires autogen binutils>=%{required_binutils_version} dejagnu elfutils-devel expect flex glibc-devel gmp-devel libffi-devel mpc-devel mpfr-devel texinfo zlib-devel end # If cloog support is enabled, we require the devel packages for build. if "%{build_cloog_ppl}" == "1" requires += cloog-ppl-devel ppl-devel end # A couple of configure arguments depending on the architecture and # configuration. configure_options = if "%{DISTRO_ARCH}" == "x86_64" configure_options = --disable-multilib end if "%{DISTRO_ARCH}" == "i686" configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic end if "%{DISTRO_ARCH}" == "armv5tel" configure_options += --with-float=soft end if "%{build_cloog_ppl}" == "1" configure_options += --with-cloog --with-ppl end # CFLAGS for hardening. HARD_CFLAGS = -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW prepare_cmds mkdir -v %{DIR_SRC}/gcc-build # Remove unneeded features that will save some compile time rm -rf lib{gfortran,java,objc} gcc/{fortran,java,objc,objcp} # Apply a sed substitution that will suppress the installation of # libiberty.a. The version of libiberty.a provided by Binutils will be used # instead: sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in # Branding gcc echo "%{DISTRO_NAME} %{version}-%{release}" > gcc/DEV-PHASE # Libgomp uses -Werror regardless of --disable-werror, and this will cause a # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings: sed -e "s/-Werror//" -i libgomp/configure # The fixincludes script is known to occasionally erroneously attempt to # "fix" the system headers installed so far. As the headers up to this point # are known to not require fixing, issue the following command to prevent # the fixincludes script from running: sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in sed -i gcc/Makefile.in \ -e "s/-fno-exceptions/& -fno-asynchronous-unwind-tables/" # we want to be able to control the pie patch logic via something other # than ALL_CFLAGS... sed -i gcc/Makefile.in \ -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' # Enable the GCC hardening by default. sed -i gcc/Makefile.in \ -e "s|^HARD_CFLAGS = |HARD_CFLAGS = %{HARD_CFLAGS} |" # Compile the compiler with -fPIC as well. sed -i gcc/Makefile.in \ -e "s|^ESP_NOPIE_CFLAGS = .*|ESP_NOPIE_CFLAGS =|" ./contrib/gcc_update --touch end build cd %{DIR_SRC}/gcc-build # Modify CFLAGS OPT_FLAGS="%{CFLAGS}" CFLAGS="%{CFLAGS}" CFLAGS=$(echo ${CFLAGS} | sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g') CFLAGS=$(echo ${CFLAGS} | sed -e 's/-m64//g;s/-m32//g;s/-m31//g') CFLAGS=$(echo ${CFLAGS} | sed -e 's/-march=i.86//g') #CFLAGS=$(echo ${CFLAGS} | sed -e 's/ -pipe / /g') CFLAGS=$(echo "${CFLAGS}" | sed -e 's/[[:blank:]]\+/ /g') CXXFLAGS=$(echo ${CFLAGS} | sed -e 's/ -Wall//g') CFLAGS="${CFLAGS}" \ CXXFLAGS="${CXXFLAGS}" \ XCFLAGS="${CFLAGS}" \ TCFLAGS="${CFLAGS}" \ ../%{thisapp}/configure \ --build=%{DISTRO_BUILDTARGET} \ --prefix=/usr \ --libexecdir=/usr/lib \ --mandir=/usr/share/man \ --enable-esp \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-clocale=gnu \ --enable-languages=c,c++,lto \ --enable-bootstrap \ --enable-checking=release \ --disable-werror \ --disable-libssp \ --disable-static \ --with-system-zlib \ --with-bugurl=http://bugtracker.ipfire.org \ --disable-libunwind-exceptions \ --enable-gnu-unique-object \ --enable-linker-build-id \ %{configure_options} # GCC does not support a parallel build. make profiledbootstrap BOOT_CFLAGS="${OPT_FLAGS}" #%{PARALLELISMFLAGS} end #test # cd %{DIR_SRC}/gcc-build && make check # cd %{DIR_APP} && ./contrib/test_summary #end install cd %{DIR_SRC}/gcc-build make install DESTDIR=%{BUILDROOT} mkdir -pv %{BUILDROOT}/lib ln -sfv ../usr/bin/cpp %{BUILDROOT}/lib/cpp ln -sfv gcc %{BUILDROOT}/usr/bin/cc # Move libgcc_s to /lib mv -vf %{BUILDROOT}/usr/lib/libgcc_s.so.1 %{BUILDROOT}/lib/ ln -svf ../../lib/libgcc_s.so.1 %{BUILDROOT}/usr/lib/libgcc_s.so # Remove some GNU debugger stuff. rm -vf %{BUILDROOT}/usr/lib/lib*.py end keep_libraries /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a /usr/lib/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a end end packages package %{name} groups += Build requires binutils>=%{required_binutils_version} glibc-devel gmp-devel libgcc-devel end if "%{build_cloog_ppl}" == "1" requires += cloog-ppl>=0.15 end end # XXX add package descriptions package %{name}-c++ requires = gcc=%{thisver} libstdc++-devel files /usr/bin/*++ /usr/lib/gcc/*/*/cc1plus /usr/share/man/man*/*++* end end package libgcc files /lib/libgcc*.so.* end end package libgcc-devel requires = libgcc=%{thisver} files /usr/lib/libgcc*.so end end package libstdc++ files /usr/lib/libstdc++*.so.* end end package libstdc++-devel files /usr/include/c++ /usr/lib/libstdc++*.so end end package libgomp files /usr/lib/libgomp*.so.* end end package libgomp files /usr/lib/libgomp*.so /usr/lib/libgomp.spec end end package libmudflap files /usr/lib/libmudflap*.so.* end end package libmudflap-devel files /usr/lib/libmudflap*.so end end package libquadmath files /usr/lib/libquadmath*.so.* end end package libquadmath-devel files /usr/lib/libquadmath*.so end end package %{name}-debuginfo template DEBUGINFO end end