gcc.spec 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. ##
  2. ## gcc.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: gcc
  27. Summary: GNU Compiler Collection
  28. URL: http://gcc.gnu.org/
  29. Vendor: Free Software Foundation
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [CORE]
  32. Group: Language
  33. License: GPL
  34. Version: 3.2.3
  35. Release: 20030427
  36. # package options
  37. %option with_cxx yes
  38. %option with_optimize yes
  39. %option with_binutils yes
  40. %option with_threads yes
  41. %option with_bounds no
  42. # list of sources
  43. Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/gcc-%{version}.tar.bz2
  44. Patch0: gcc.patch
  45. Patch1: http://web.inter.nl.net/hcc/Haj.Ten.Brugge/bounds-checking-gcc-%{version}-1.00.patch.bz2
  46. # build information
  47. Prefix: %{l_prefix}
  48. BuildRoot: %{l_buildroot}
  49. BuildPreReq: OpenPKG, openpkg >= 20030103, make
  50. PreReq: OpenPKG, openpkg >= 20030103
  51. %if "%{with_binutils}" == "yes"
  52. BuildPreReq: binutils >= 2.13
  53. PreReq: binutils >= 2.13
  54. %endif
  55. AutoReq: no
  56. AutoReqProv: no
  57. %description
  58. The GNU Compiler Collection (GCC) provides a standard conforming and
  59. highly portable ISO C and ISO C++ compiler.
  60. %prep
  61. %setup -q -n gcc-%{version}
  62. %patch0 -p0
  63. %if "%{with_bounds}" == "yes"
  64. %patch1 -p1
  65. %{l_shtool} subst -v -s \
  66. -e 's; $(libsubdir); $(DESTDIR)$(libsubdir);g' \
  67. gcc/Makefile.in
  68. %endif
  69. %{l_shtool} subst -v -s \
  70. -e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
  71. gcc/configure
  72. %build
  73. # create build sub-directory
  74. mkdir obj
  75. cd obj
  76. # determine ld(1) and as(1) usage
  77. l_with_gnu_ld_as=""
  78. %if "%{with_binutils}" == "yes"
  79. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
  80. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
  81. %else
  82. case "%{l_target}" in
  83. *-linux* | *-freebsd* )
  84. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
  85. ;;
  86. esac
  87. %endif
  88. # determine threads usage
  89. %if "%{with_threads}" == "yes"
  90. l_enable_threads="posix"
  91. %else
  92. l_enable_threads="single"
  93. %endif
  94. # determine language usage
  95. l_enable_languages="c"
  96. %if "%{with_cxx}" == "yes"
  97. l_enable_languages="${l_enable_languages},c++"
  98. %endif
  99. # configure the package
  100. CC="%{l_cc}" \
  101. CFLAGS="%{l_cflags}" \
  102. ../configure \
  103. --prefix=%{l_prefix} \
  104. --exec-prefix=%{l_prefix} \
  105. --includedir=%{l_prefix}/include/gcc \
  106. --with-gxx-include-dir=%{l_prefix}/include/g++ \
  107. --with-local-prefix=%{l_prefix}/lib/gcc-lib \
  108. --enable-languages="${l_enable_languages}" \
  109. --enable-threads="${l_enable_threads}" \
  110. --disable-maintainer-mode \
  111. --disable-shared \
  112. --disable-nls \
  113. ${l_with_gnu_ld_as}
  114. # determine build flags
  115. l_cflags=""
  116. l_boot_cflags=""
  117. l_libcflags="-g"
  118. l_libcxxflags="-g"
  119. %if "%{with_binutils}" == "yes"
  120. # at least GNU as from GNU binutils supports -pipe always
  121. l_boot_cflags="$l_boot_cflags -pipe"
  122. l_libcflags="$l_libcflags -pipe"
  123. l_libcxxflags="$l_libcxxflags -pipe"
  124. %endif
  125. %if "%{with_optimize}" == "yes"
  126. # conservatively optimize the generated program code
  127. # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
  128. l_cflags="$l_cflags -O"
  129. l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer -funroll-loops"
  130. case "%{l_target}" in
  131. *x86-* ) l_boot_cflags="$l_boot_cflags -mcpu=pentium3" ;;
  132. *sparc64-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
  133. esac
  134. l_libcflags="$l_libcflags -O2"
  135. l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
  136. %else
  137. # else do no optimizations at all to reduce problems to minimum in advance
  138. l_boot_cflags="$l_boot_cflags -O0"
  139. l_libcflags="$l_libcflags -O0"
  140. l_libcxxflags="$l_libcxxflags -O0"
  141. %endif
  142. # build the package
  143. %{l_make} %{l_mflags} \
  144. MAKE="%{l_make} %{l_mflags}" \
  145. BOOT_CFLAGS="${l_boot_cflags}" \
  146. CFLAGS="${l_cflags}" \
  147. LIBCFLAGS="${l_libcflags}" \
  148. LIBCXXFLAGS="${l_libcxxflags}" \
  149. bootstrap-lean
  150. %install
  151. rm -rf $RPM_BUILD_ROOT
  152. # fetch GNU platform triple
  153. triple=`./config.guess`
  154. triple=`./config.sub ${triple}`
  155. # perform the standard installation procedure
  156. ( cd obj
  157. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT )
  158. # cleanup installation tree
  159. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  160. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/
  161. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  162. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/include/ \
  163. >/dev/null 2>&1 || true
  164. # strip installation tree
  165. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  166. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  167. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  168. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/dev/null 2>&1 || true
  169. %if "%{with_cxx}" == "yes"
  170. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  171. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  172. %endif
  173. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  174. for prog in cc1 cc1plus collect2 cpp; do
  175. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/${prog} \
  176. >/dev/null 2>&1 || true
  177. done
  178. # bump up installation tree
  179. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
  180. $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  181. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  182. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  183. %if "%{with_cxx}" == "yes"
  184. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  185. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  186. %endif
  187. # determine installation file list
  188. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  189. %files -f files
  190. %clean
  191. rm -rf $RPM_BUILD_ROOT