gcc34.spec 8.1 KB

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