############################################################################### # 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.3 release = 6 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.3-piepatches-20120408.patch build requires autogen binutils>=%{required_binutils_version} dejagnu elfutils-devel expect filesystem >= 002 flex glibc-devel gmp-devel libffi-devel libmpc-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 requires += ppl-devel end # Build libquadmath (only on x86). build_libquadmath = 0 # A couple of configure arguments depending on the architecture and # configuration. configure_options = make_bootstrap = profiledbootstrap if "%{DISTRO_ARCH}" == "x86_64" configure_options = --disable-multilib build_libquadmath = 1 end if "%{DISTRO_ARCH}" == "i686" configure_options = --with-arch=%{DISTRO_ARCH} --with-tune=generic build_libquadmath = 1 end if "%{DISTRO_ARCH}" == "armv5tel" make_bootstrap = bootstrap configure_options += --disable-sjlj-exceptions configure_options += --with-float=soft end if "%{DISTRO_ARCH}" == "armv7hl" make_bootstrap = bootstrap configure_options += --disable-sjlj-exceptions configure_options += \ --with-cpu=cortex-a8 \ --with-tune=cortex-a8 \ --with-arch=armv7-a \ --with-float=hard \ --with-fpu=vfpv3-d16 \ --with-abi=aapcs-linux end if "%{build_cloog_ppl}" == "1" configure_options += --with-cloog --with-ppl end # CFLAGS for hardening. HARD_CFLAGS = -DEFAULT_PIE -DEFAULT_SSP -DEFAULT_PIE_SSP -DEFAULT_ESP_SPP \ -DENABLE_ESP_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 =|" # Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2 sed -i gcc/common.opt \ -e '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' \ -e '/flag_debug_types_section/s/Init(1)/Init(0)/' \ -e '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' \ -e 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./' ./contrib/gcc_update --touch end build cd %{DIR_SRC}/gcc-build # Modify 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 \ --libdir=%{libdir} \ --libexecdir=%{libdir} \ --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 %{make_bootstrap} BOOT_CFLAGS="${CFLAGS}" 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} # Check if the installation path exists. FULLPATH="%{BUILDROOT}%{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}" [ -d "${FULLPATH}" ] || exit 1 mkdir -pv %{BUILDROOT}%{prefix}/lib ln -sfv ../bin/cpp %{BUILDROOT}%{prefix}/lib/cpp ln -sfv gcc %{BUILDROOT}/usr/bin/cc # Fix libgcc_s symlinks. rm -f ${FULLPATH}/libgcc_s.so %{BUILDROOT}%{libdir}/libgcc_s.so case "%{DISTRO_ARCH}" in arm*) cat <${FULLPATH}/libgcc_s.so /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf32-littlearm) GROUP ( %{libdir}/libgcc_s.so.1 libgcc.a ) EOF ;; *) ln -svf ../../../../../%{libdir}/libgcc_s.so.1 ${FULLPATH}/libgcc_s.so ;; esac # Remove some GNU debugger stuff. rm -vf %{BUILDROOT}%{libdir}/lib*.py # Install missing header file(s) on ARM. case "%{DISTRO_ARCH}" in arm*) cp -vf %{DIR_APP}/gcc/config/vxworks-dummy.h \ ${FULLPATH}/plugin/include/config/ cp -vf %{DIR_APP}/gcc/config/arm/arm-cores.def \ ${FULLPATH}/plugin/include/config/arm/ ;; esac # libgomp mv -vf %{BUILDROOT}%{libdir}/libgomp.spec ${FULLPATH}/ ln -svf ../../../libgomp.so.1.0.0 ${FULLPATH}/libgomp.so chmod 755 %{BUILDROOT}%{libdir}/libgomp.so.1.* # libstdc++ ln -svf ../../../libstdc++.so.6.0.16 ${FULLPATH}/libstdc++.so # libmudflap ln -svf ../../../libmudflap.so.0.0.0 ${FULLPATH}/libmudflap.so ln -svf ../../../libmudflapth.so.0.0.0 ${FULLPATH}/libmudflapth.so chmod 755 %{BUILDROOT}%{libdir}/libmudflap{,th}.so.0.* # libquadmath if [ "%{build_libquadmath}" = "1" ]; then ln -svf ../../../libquadmath.so.0.0.0 ${FULLPATH}/libquadmath.so chmod 755 %{BUILDROOT}%{libdir}/libquadmath.so.0.* fi end keep_libraries %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc.a %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libgcc_eh.a end end packages package %{name} groups += Build requires binutils >= %{required_binutils_version} filesystem >= 002 glibc-devel gmp-devel cpp = %{thisver} libgcc = %{thisver} libgomp = %{thisver} end # We do not ship libgcc-devel anymore. provides += libgcc-devel = %{thisver} obsoletes += libgcc-devel < %{thisver} if "%{build_cloog_ppl}" == "1" requires += cloog-ppl >= 0.15 end end package %{name}-c++ summary = C++ support for GCC. description This package adds C++ support to the GNU Compiler Collection. It includes support for most of the current C++ specification, including templates and exception handling. end requires gcc = %{thisver} libstdc++ = %{thisver} libstdc++-devel = %{thisver} end files /usr/bin/*++ %{libdir}/gcc/*/*/cc1plus /usr/share/man/man*/*++* end end package cpp summary = The C Preprocessor. description Cpp is the GNU C-Compatible Compiler Preprocessor. Cpp is a macro processor which is used automatically by the C compiler to transform your program before actual compilation. It is called a macro processor because it allows you to define macros, abbreviations for longer constructs. The C preprocessor provides four separate functionalities: the inclusion of header files (files of declarations that can be substituted into your program); macro expansion (you can define macros, and the C preprocessor will replace the macros with their definitions throughout the program); conditional compilation (using special preprocessing directives, you can include or exclude parts of the program according to various conditions); and line control (if you use a program to combine or rearrange source files into an intermediate file which is then compiled, you can use line control to inform the compiler about where each source line originated). You should install this package if you are a C programmer and you use macros. end group = Development/Languages files %{prefix}/lib/cpp %{bindir}/cpp %{mandir}/man1/cpp.1* %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/cc1 end provides = /lib/cpp end package libgcc summary = GCC shared support library. description This package contains GCC shared support library which is needed e.g. for exception handling support. end files %{libdir}/libgcc*.so.* end end package libstdc++ summary = GNU Standard C++ Library. description The libstdc++ package contains a rewritten standard compliant GCC Standard C++ Library. end files %{libdir}/libstdc++*.so.* end end package libstdc++-devel summary = Header files and libraries for C++ development. description This is the GNU implementation of the standard C++ libraries. This package includes the header files and libraries needed for C++ development. This includes rewritten implementation of STL. end requires libstdc++ = %{thisver} end files %{includedir}/c++ %{libdir}/libstdc++*.so end end package libgomp summary = GCC OpenMP v3.0 shared support library. description This package contains GCC shared support library which is needed for OpenMP v3.0 support. end files %{libdir}/libgomp*.so.* end end package libmudflap summary = GCC mudflap shared support library. description This package contains GCC shared support library which is needed for mudflap support. end files %{libdir}/libmudflap*.so.* end end package libmudflap-devel summary = Development files for GCC mudflap support. description This package contains headers for building mudflap-instrumented programs. To instrument a non-threaded program, add -fmudflap option to GCC and when linking add -lmudflap, for threaded programs also add -fmudflapth and -lmudflapth. end requires libmudflap = %{thisver} end files %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/mf-runtime.h %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflap.so %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libmudflapth.so end end if "%{build_libquadmath}" == "1" package libquadmath summary = GCC __float128 shared support library. description This package contains GCC shared support library which is needed for __float128 math support and for Fortran REAL*16 support. end files %{libdir}/libquadmath*.so.* end end package libquadmath-devel summary = Development files for GCC __float128 support. description This package contains headers for building Fortran programs using REAL*16 and programs using __float128 math. end requires gcc = %{thisver} libquadmath = %{thisver} end files %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath.h %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/include/quadmath_weak.h %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/libquadmath.so end end end package gcc-plugin-devel summary = Support for compiling GCC plugins. description This package contains header files and other support files for compiling GCC plugins. The GCC plugin ABI is currently not stable, so plugins must be rebuilt any time GCC is updated. end requires gcc = %{thisver} gmp-devel >= 4.1.2-8 mpfr-devel >= 2.2.1 libmpc-devel >= 0.8.1 end files %{libdir}/gcc/%{DISTRO_BUILDTARGET}/%{version}/plugin end end package %{name}-debuginfo template DEBUGINFO end end