hosttools-gcc.spec 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. %{?!tool_name: %global tool_name hosttools}
  2. %global tool_prefix /opt/%{tool_name}
  3. %bcond_without bootstrap
  4. %bcond_with zstd
  5. # build procedure: binutils -> bootstrap gcc -> binutils zstd -> gcc with zstd
  6. %global gmp_version 6.1.2
  7. %global mpfr_version 4.1.0
  8. %global mpc_version 1.2.1
  9. %global isl_version 0.24
  10. %global gcc_version 11.3.0
  11. Name: %{tool_name}-gcc
  12. Version: 11.3.0
  13. Release: 1%{?dist}
  14. Summary: GNU compiler collection
  15. Provides: cpp = %{version}-%{release}
  16. Provides: gcc = %{version}-%{release}
  17. Provides: gcc-c++ = %{version}-%{release}
  18. Provides: gcc-gnat = %{version}-%{release}
  19. License: GPLv3+
  20. URL: https://gcc.gnu.org
  21. Source0: https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/gcc-11.3.0.tar.xz
  22. Source1: https://gmplib.org/download/gmp/gmp-%{gmp_version}.tar.lz
  23. Source2: https://ftp.gnu.org/gnu/mpfr/mpfr-%{mpfr_version}.tar.xz
  24. Source3: https://ftp.gnu.org/gnu/mpc/mpc-%{mpc_version}.tar.gz
  25. Source4: https://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2
  26. Patch0: gcc-static-libsanitizer.patch
  27. BuildRequires: gcc-c++ gcc-gnat lzip texinfo
  28. %if %{with zstd}
  29. BuildRequires: zstd
  30. %endif
  31. %description
  32. GNU compiler collection
  33. %prep
  34. %setup -q -n gcc-%{gcc_version} -a 1 -a 2 -a 3 -a 4
  35. mv gmp-%{gmp_version} gmp
  36. mv mpfr-%{mpfr_version} mpfr
  37. mv mpc-%{mpc_version} mpc
  38. mv isl-%{isl_version} isl
  39. %patch0 -p1
  40. # --with-build-config=bootstrap-lto \
  41. %build
  42. mkdir build-gcc
  43. cd build-gcc
  44. CFLAGS=-fPIC CXXFLAGS=-fPIC ../configure --prefix=%{tool_prefix} \
  45. --disable-multilib \
  46. %if %{with bootstrap}
  47. --enable-bootstrap \
  48. %else
  49. --disable-bootstrap \
  50. %endif
  51. --with-linker-hash-style=gnu \
  52. --enable-languages=c,c++,ada,lto \
  53. --enable-lto \
  54. --enable-plugin \
  55. --disable-shared \
  56. --enable-threads=posix \
  57. --enable-__cxa_atexit \
  58. --enable-cet=auto \
  59. --enable-clocale=gnu \
  60. --enable-gnu-indirect-function \
  61. --enable-gnu-unique-object \
  62. --enable-linker-build-id \
  63. --disable-libssp \
  64. --disable-libstdcxx-pch \
  65. --disable-werror \
  66. --disable-nls \
  67. --enable-link-serialization=1
  68. make %{?_smp_mflags}
  69. %install
  70. cd build-gcc
  71. make DESTDIR=%{buildroot} install
  72. rm -f %{buildroot}%{tool_prefix}/share/info/dir
  73. rm -rf %{buildroot}%{tool_prefix}/share/man/man7
  74. find %{buildroot} -name '*.la' -delete
  75. ln -sf gcc %{buildroot}%{tool_prefix}/bin/cc
  76. cat > %{buildroot}%{tool_prefix}/bin/c89 <<"EOF"
  77. #!/bin/sh
  78. fl="-std=c89"
  79. for opt; do
  80. case "$opt" in
  81. -ansi|-std=c89|-std=iso9899:1990) fl="";;
  82. -std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2
  83. exit 1;;
  84. esac
  85. done
  86. exec %{tool_prefix}/bin/gcc $fl ${1+"$@"}
  87. EOF
  88. cat > %{buildroot}%{tool_prefix}/bin/c99 <<"EOF"
  89. #!/bin/sh
  90. fl="-std=c99"
  91. for opt; do
  92. case "$opt" in
  93. -std=c99|-std=iso9899:1999) fl="";;
  94. -std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2
  95. exit 1;;
  96. esac
  97. done
  98. exec %{tool_prefix}/bin/gcc $fl ${1+"$@"}
  99. EOF
  100. chmod 755 %{buildroot}%{tool_prefix}/bin/c89
  101. chmod 755 %{buildroot}%{tool_prefix}/bin/c99
  102. %files
  103. %{tool_prefix}/bin/*
  104. %{tool_prefix}/lib64/*
  105. %{tool_prefix}/lib/gcc/x86_64-pc-linux-gnu/%{version}
  106. %{tool_prefix}/libexec/gcc/x86_64-pc-linux-gnu/%{version}
  107. %{tool_prefix}/include/c++/%{version}
  108. %{tool_prefix}/share/gcc-%{version}/python/libstdcxx
  109. %{tool_prefix}/share/info/*.info*
  110. %{tool_prefix}/share/man/man1/*
  111. %changelog