gcc34.spec 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. ##
  2. ## gcc34.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.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 20030813
  29. # package information
  30. Name: gcc34
  31. Summary: GNU Compiler Collection
  32. URL: http://gcc.gnu.org/
  33. Vendor: Free Software Foundation
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG [EVAL]
  36. Group: Compiler
  37. License: GPL
  38. Version: %{V_full}s%{V_snap}
  39. Release: 20030813
  40. # package options
  41. %option with_cxx yes
  42. %option with_optimize yes
  43. %option with_binutils yes
  44. %option with_threads yes
  45. %option with_gcc no
  46. # list of sources
  47. Source0: ftp://gcc.gnu.org/pub/gcc/snapshots/%{V_full}-%{V_snap}/gcc-%{V_full}-%{V_snap}.tar.bz2
  48. Patch0: gcc34.patch
  49. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20030103, make, flex, bison, texinfo
  53. PreReq: OpenPKG, openpkg >= 20030103
  54. %if "%{with_binutils}" == "yes"
  55. BuildPreReq: binutils >= 2.13
  56. PreReq: binutils >= 2.13
  57. %endif
  58. AutoReq: no
  59. AutoReqProv: no
  60. %if "%{with_gcc}" == "yes"
  61. Provides: gcc = %{version}-%{release}
  62. %endif
  63. %description
  64. The GNU Compiler Collection (GCC) provides a standard conforming and
  65. highly portable ISO C and ISO C++ compiler.
  66. %prep
  67. %setup -q -n gcc-%{V_full}-%{V_snap}
  68. %patch -p0
  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. # disable GNU iconv usage
  100. ( echo "am_cv_func_iconv=no"
  101. echo "am_cv_lib_iconv=no"
  102. ) >config.cache
  103. # configure the package
  104. CC="%{l_cc}" \
  105. CFLAGS="%{l_cflags}" \
  106. ../configure \
  107. --cache-file=./config.cache \
  108. --prefix=%{l_prefix} \
  109. --exec-prefix=%{l_prefix} \
  110. --includedir=%{l_prefix}/include/gcc%{V_comp} \
  111. --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
  112. --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
  113. --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
  114. --enable-languages="${l_enable_languages}" \
  115. --enable-threads="${l_enable_threads}" \
  116. --disable-maintainer-mode \
  117. --disable-shared \
  118. --disable-nls \
  119. ${l_with_gnu_ld_as}
  120. # explicitly redirect remaining gcc library directories
  121. %{l_shtool} subst -v -s \
  122. -e "s;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;" \
  123. `find . -name Makefile -type f -print`
  124. # determine build flags
  125. l_cflags=""
  126. l_boot_cflags=""
  127. l_libcflags="-g"
  128. l_libcxxflags="-g"
  129. %if "%{with_binutils}" == "yes"
  130. # at least GNU as from GNU binutils supports -pipe always
  131. l_boot_cflags="$l_boot_cflags -pipe"
  132. l_libcxxflags="$l_libcxxflags -pipe"
  133. %endif
  134. %if "%{with_optimize}" == "yes"
  135. # conservatively optimize the generated program code
  136. # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
  137. l_cflags="$l_cflags -O"
  138. l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer -funroll-loops"
  139. case "%{l_target}" in
  140. *x86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;;
  141. *sparc64-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
  142. esac
  143. l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
  144. %else
  145. # else do no optimizations at all to reduce problems to minimum in advance
  146. l_boot_cflags="$l_boot_cflags -O0"
  147. l_libcxxflags="$l_libcxxflags -O0"
  148. %endif
  149. # build the package
  150. %{l_make} %{l_mflags} \
  151. MAKE="%{l_make} %{l_mflags}" \
  152. BOOT_CFLAGS="${l_boot_cflags}" \
  153. CFLAGS="${l_cflags}" \
  154. LIBCFLAGS="${l_libcflags}" \
  155. LIBCXXFLAGS="${l_libcxxflags}" \
  156. bootstrap-lean
  157. %install
  158. rm -rf $RPM_BUILD_ROOT
  159. # fetch GNU platform triple
  160. triple=`./config.guess`
  161. triple=`./config.sub ${triple}`
  162. # perform the standard installation procedure
  163. ( cd obj
  164. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  165. ) || exit $?
  166. # cleanup installation tree
  167. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  168. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}/
  169. for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
  170. subdir=`echo "$multilib" | sed -e 's/;.*$//'`
  171. [ ".$subdir" = .. ] && continue
  172. mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
  173. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}/$subdir/
  174. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir
  175. done
  176. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  177. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}/include/ \
  178. >/dev/null 2>&1 || true
  179. # strip installation tree
  180. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  181. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  182. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  183. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
  184. %if "%{with_cxx}" == "yes"
  185. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  186. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  187. %endif
  188. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  189. for prog in cc1 cc1plus collect2 cpp; do
  190. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/%{V_full}/${prog} \
  191. >/dev/null 2>&1 || true
  192. done
  193. # bump up installation tree
  194. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
  195. $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  196. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  197. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  198. %if "%{with_cxx}" == "yes"
  199. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  200. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  201. %endif
  202. # resolve filename conflicts
  203. %if "%{with_gcc}" != "yes" && "%{V_comp}" != ""
  204. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  205. for file in *; do
  206. [ ".$file" = ".*" ] && continue
  207. mv ${file} ${file}%{V_comp}
  208. done
  209. ) || exit $?
  210. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  211. for file in *; do
  212. [ ".$file" = ".*" ] && continue
  213. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  214. done
  215. ) || exit $?
  216. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  217. for file in *; do
  218. [ ".$file" = ".*" ] && continue
  219. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  220. done
  221. ) || exit $?
  222. %endif
  223. # determine installation file list
  224. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  225. %files -f files
  226. %clean
  227. rm -rf $RPM_BUILD_ROOT