gcc33.spec 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. ##
  2. ## gcc33.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 versions
  26. %define V_major_dot 3.3
  27. %define V_major_comp 33
  28. %define V_snap_dash 2003-05-05
  29. %define V_snap_comp 20030505
  30. # package information
  31. Name: gcc33
  32. Summary: GNU Compiler Collection (3.3)
  33. URL: http://gcc.gnu.org/
  34. Vendor: Free Software Foundation
  35. Packager: The OpenPKG Project
  36. Distribution: OpenPKG [EVAL]
  37. Group: Language
  38. License: GPL
  39. Version: %{V_major_dot}s%{V_snap_comp}
  40. Release: 20030505
  41. # package options
  42. %option with_cxx yes
  43. %option with_optimize yes
  44. %option with_binutils yes
  45. %option with_threads yes
  46. # list of sources
  47. Source0: ftp://gcc.gnu.org/pub/gcc/snapshots/%{V_snap_dash}/gcc-%{V_snap_comp}.tar.bz2
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20030103, make, flex, bison
  52. PreReq: OpenPKG, openpkg >= 20030103
  53. %if "%{with_binutils}" == "yes"
  54. BuildPreReq: binutils >= 2.13
  55. PreReq: binutils >= 2.13
  56. %endif
  57. AutoReq: no
  58. AutoReqProv: no
  59. %description
  60. The GNU Compiler Collection (GCC) provides a standard conforming and
  61. highly portable ISO C and ISO C++ compiler.
  62. %prep
  63. %setup -q -n gcc-%{V_snap_comp}
  64. %{l_shtool} subst -v -s \
  65. -e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
  66. gcc/configure
  67. %build
  68. # create build sub-directory
  69. mkdir obj
  70. cd obj
  71. # determine ld(1) and as(1) usage
  72. l_with_gnu_ld_as=""
  73. %if "%{with_binutils}" == "yes"
  74. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
  75. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
  76. %else
  77. case "%{l_target}" in
  78. *-linux* | *-freebsd* )
  79. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
  80. ;;
  81. esac
  82. %endif
  83. # determine threads usage
  84. %if "%{with_threads}" == "yes"
  85. l_enable_threads="posix"
  86. %else
  87. l_enable_threads="single"
  88. %endif
  89. # determine language usage
  90. l_enable_languages="c"
  91. %if "%{with_cxx}" == "yes"
  92. l_enable_languages="${l_enable_languages},c++"
  93. %endif
  94. # configure the package
  95. CC="%{l_cc}" \
  96. CFLAGS="%{l_cflags}" \
  97. ../configure \
  98. --prefix=%{l_prefix} \
  99. --exec-prefix=%{l_prefix} \
  100. --includedir=%{l_prefix}/include/gcc%{V_major_comp} \
  101. --with-gxx-include-dir=%{l_prefix}/include/g++%{V_major_comp} \
  102. --with-local-prefix=%{l_prefix}/lib/gcc%{V_major_comp}-lib \
  103. --enable-languages="${l_enable_languages}" \
  104. --enable-threads="${l_enable_threads}" \
  105. --disable-maintainer-mode \
  106. --disable-shared \
  107. --disable-nls \
  108. ${l_with_gnu_ld_as}
  109. # explicitly redirect remaining gcc-lib directories
  110. %{l_shtool} subst -v -s \
  111. -e "s;/gcc-lib/;/gcc%{V_major_comp}-lib/;" \
  112. `find . -name Makefile -type f -print`
  113. # determine build flags
  114. l_cflags=""
  115. l_boot_cflags=""
  116. l_libcflags="-g"
  117. l_libcxxflags="-g"
  118. %if "%{with_binutils}" == "yes"
  119. # at least GNU as from GNU binutils supports -pipe always
  120. l_boot_cflags="$l_boot_cflags -pipe"
  121. l_libcflags="$l_libcflags -pipe"
  122. l_libcxxflags="$l_libcxxflags -pipe"
  123. %endif
  124. %if "%{with_optimize}" == "yes"
  125. # conservatively optimize the generated program code
  126. # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
  127. l_cflags="$l_cflags -O"
  128. l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer -funroll-loops"
  129. case "%{l_target}" in
  130. *x86-* ) l_boot_cflags="$l_boot_cflags -mcpu=pentium3" ;;
  131. *sparc64-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
  132. esac
  133. l_libcflags="$l_libcflags -O2"
  134. l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
  135. %else
  136. # else do no optimizations at all to reduce problems to minimum in advance
  137. l_boot_cflags="$l_boot_cflags -O0"
  138. l_libcflags="$l_libcflags -O0"
  139. l_libcxxflags="$l_libcxxflags -O0"
  140. %endif
  141. # build the package
  142. %{l_make} %{l_mflags} \
  143. MAKE="%{l_make} %{l_mflags}" \
  144. BOOT_CFLAGS="${l_boot_cflags}" \
  145. CFLAGS="${l_cflags}" \
  146. LIBCFLAGS="${l_libcflags}" \
  147. LIBCXXFLAGS="${l_libcxxflags}" \
  148. bootstrap-lean
  149. %install
  150. rm -rf $RPM_BUILD_ROOT
  151. # fetch GNU platform triple
  152. triple=`./config.guess`
  153. triple=`./config.sub ${triple}`
  154. # perform the standard installation procedure
  155. ( cd obj
  156. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT )
  157. # cleanup installation tree
  158. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  159. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_major_comp}-lib/${triple}/%{V_major_dot}/
  160. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  161. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_major_comp}-lib/${triple}/%{V_major_dot}/include/ \
  162. >/dev/null 2>&1 || true
  163. # strip installation tree
  164. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  165. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  166. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  167. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/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%{V_major_comp}-lib/${triple}/%{V_major_dot}/${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. # resolve filename conflicts
  188. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  189. for file in *; do
  190. mv ${file} ${file}%{V_major_comp}
  191. done )
  192. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  193. for file in *; do
  194. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_major_comp}\2;'`
  195. done )
  196. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  197. for file in *; do
  198. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_major_comp}\2;'`
  199. done )
  200. # determine installation file list
  201. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  202. %files -f files
  203. %clean
  204. rm -rf $RPM_BUILD_ROOT