gcc.spec 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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.2
  35. Release: 20030208
  36. # package options
  37. %option with_cxx yes
  38. %option with_optimize yes
  39. %option with_binutils yes
  40. %option with_threads yes
  41. # list of sources
  42. Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/gcc-%{version}.tar.bz2
  43. Patch0: gcc.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20030103, make
  48. PreReq: OpenPKG, openpkg >= 20030103
  49. %if "%{with_binutils}" == "yes"
  50. BuildPreReq: binutils >= 2.13
  51. PreReq: binutils >= 2.13
  52. %endif
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. The GNU Compiler Collection (GCC) provides a standard conforming and
  57. highly portable ISO C and ISO C++ compiler.
  58. %prep
  59. %setup -q -n gcc-%{version}
  60. %patch -p0
  61. %{l_shtool} subst -v -s \
  62. -e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
  63. gcc/configure
  64. %build
  65. # create build sub-directory
  66. mkdir obj
  67. cd obj
  68. # determine ld(1) and as(1) usage
  69. l_with_gnu_ld_as=""
  70. %if "%{with_binutils}" == "yes"
  71. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
  72. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
  73. %else
  74. case "%{l_target}" in
  75. *-linux* | *-freebsd* )
  76. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
  77. ;;
  78. esac
  79. %endif
  80. # determine threads usage
  81. %if "%{with_threads}" == "yes"
  82. l_enable_threads="posix"
  83. %else
  84. l_enable_threads="single"
  85. %endif
  86. # determine language usage
  87. l_enable_languages="c"
  88. %if "%{with_cxx}" == "yes"
  89. l_enable_languages="${l_enable_languages},c++"
  90. %endif
  91. # configure the package
  92. CC="%{l_cc}" \
  93. CFLAGS="%{l_cflags}" \
  94. ../configure \
  95. --prefix=%{l_prefix} \
  96. --exec-prefix=%{l_prefix} \
  97. --includedir=%{l_prefix}/include/gcc \
  98. --with-gxx-include-dir=%{l_prefix}/include/g++ \
  99. --with-local-prefix=%{l_prefix}/lib/gcc-lib \
  100. --enable-languages="${l_enable_languages}" \
  101. --enable-threads="${l_enable_threads}" \
  102. --disable-maintainer-mode \
  103. --disable-shared \
  104. --disable-nls \
  105. ${l_with_gnu_ld_as}
  106. # determine build parameters
  107. %if "%{with_optimize}" == "yes"
  108. l_boot_cflags="-O2"
  109. l_cflags="-O"
  110. l_libcflags="-g -O2"
  111. l_libcxxflags="-g -O2 -fno-implicit-templates"
  112. %else
  113. l_boot_cflags="-O0"
  114. l_cflags=""
  115. l_libcflags="-g -O0"
  116. l_libcxxflags="-g -O0"
  117. %endif
  118. # build the package
  119. %{l_make} %{l_mflags} \
  120. MAKE="%{l_make} %{l_mflags}" \
  121. BOOT_CFLAGS="${l_boot_cflags}" \
  122. CFLAGS="${l_cflags}" \
  123. LIBCFLAGS="${l_libcflags}" \
  124. LIBCXXFLAGS="${l_libcxxflags}" \
  125. bootstrap-lean
  126. %install
  127. rm -rf $RPM_BUILD_ROOT
  128. # fetch GNU platform triple
  129. triple=`./config.guess`
  130. triple=`./config.sub ${triple}`
  131. # perform the standard installation procedure
  132. ( cd obj
  133. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT )
  134. # cleanup installation tree
  135. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  136. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/
  137. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  138. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/include/ \
  139. >/dev/null 2>&1 || true
  140. # strip installation tree
  141. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  142. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  143. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  144. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/dev/null 2>&1 || true
  145. %if "%{with_cxx}" == "yes"
  146. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  147. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  148. %endif
  149. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  150. for prog in cc1 cc1plus collect2 cpp; do
  151. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/${prog} \
  152. >/dev/null 2>&1 || true
  153. done
  154. # bump up installation tree
  155. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
  156. $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  157. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  158. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  159. %if "%{with_cxx}" == "yes"
  160. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  161. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  162. %endif
  163. # determine installation file list
  164. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  165. %files -f files
  166. %clean
  167. rm -rf $RPM_BUILD_ROOT