gcc34.spec 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. ##
  2. ## gcc34.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 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 20040310
  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
  36. Class: EVAL
  37. Group: Compiler
  38. License: GPL
  39. Version: %{V_full}s%{V_snap}
  40. Release: 20040310
  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}/gcc-%{V_full}-%{V_snap}.tar.bz2
  49. Patch0: gcc34.patch
  50. # build information
  51. Prefix: %{l_prefix}
  52. BuildRoot: %{l_buildroot}
  53. BuildPreReq: OpenPKG, openpkg >= 20040130, make, flex, bison, texinfo
  54. PreReq: OpenPKG, openpkg >= 20040130
  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. %track
  68. prog gcc34 = {
  69. version = %{V_full}-%{V_snap}
  70. url = ftp://gcc.gnu.org/pub/gcc/snapshots/
  71. regex = (\d+\.\d+-\d{8})
  72. url = ftp://gcc.gnu.org/pub/gcc/snapshots/__NEWVER__/
  73. regex = gcc-(\d+\.\d+-\d{8})\.tar\.bz2
  74. }
  75. %prep
  76. %setup -q -n gcc-%{V_full}-%{V_snap}
  77. %patch -p0
  78. %{l_shtool} subst -v -s \
  79. -e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
  80. gcc/configure
  81. %build
  82. # create build sub-directory
  83. mkdir obj
  84. cd obj
  85. # determine ld(1) and as(1) usage
  86. l_with_gnu_ld_as=""
  87. %if "%{with_binutils}" == "yes"
  88. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
  89. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
  90. %else
  91. case "%{l_platform -t}" in
  92. *-linux* | *-freebsd* )
  93. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
  94. ;;
  95. esac
  96. %endif
  97. # determine threads usage
  98. %if "%{with_threads}" == "yes"
  99. l_enable_threads="posix"
  100. %else
  101. l_enable_threads="single"
  102. %endif
  103. # determine language usage
  104. l_enable_languages="c"
  105. %if "%{with_cxx}" == "yes"
  106. l_enable_languages="${l_enable_languages},c++"
  107. %endif
  108. # disable GNU iconv usage
  109. ( echo "am_cv_func_iconv=no"
  110. echo "am_cv_lib_iconv=no"
  111. ) >config.cache
  112. # configure the package
  113. CC="%{l_cc}" \
  114. CFLAGS="%{l_cflags}" \
  115. ../configure \
  116. --cache-file=./config.cache \
  117. --prefix=%{l_prefix} \
  118. --exec-prefix=%{l_prefix} \
  119. --includedir=%{l_prefix}/include/gcc%{V_comp} \
  120. --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
  121. --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
  122. --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
  123. --enable-languages="${l_enable_languages}" \
  124. --enable-threads="${l_enable_threads}" \
  125. --disable-maintainer-mode \
  126. --disable-shared \
  127. --disable-nls \
  128. ${l_with_gnu_ld_as}
  129. # explicitly redirect remaining gcc library directories
  130. %{l_shtool} subst -v -s \
  131. -e "s;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;" \
  132. `find . -name Makefile -type f -print`
  133. # determine build flags
  134. l_cflags=""
  135. l_boot_cflags=""
  136. l_libcflags="-g"
  137. l_libcxxflags="-g"
  138. %if "%{with_binutils}" == "yes"
  139. # at least GNU as from GNU binutils supports -pipe always
  140. l_boot_cflags="$l_boot_cflags -pipe"
  141. l_libcxxflags="$l_libcxxflags -pipe"
  142. %endif
  143. %if "%{with_optimize}" == "yes"
  144. # conservatively optimize the generated program code
  145. # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
  146. l_cflags="$l_cflags -O"
  147. l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer -funroll-loops"
  148. case "%{l_platform -t}" in
  149. *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;;
  150. *sun4u-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
  151. esac
  152. l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
  153. %else
  154. # else do no optimizations at all to reduce problems to minimum in advance
  155. l_boot_cflags="$l_boot_cflags -O0"
  156. l_libcxxflags="$l_libcxxflags -O0"
  157. %endif
  158. # build the package
  159. %{l_make} %{l_mflags} \
  160. MAKE="%{l_make} %{l_mflags}" \
  161. BOOT_CFLAGS="${l_boot_cflags}" \
  162. CFLAGS="${l_cflags}" \
  163. LIBCFLAGS="${l_libcflags}" \
  164. LIBCXXFLAGS="${l_libcxxflags}" \
  165. bootstrap-lean
  166. %install
  167. rm -rf $RPM_BUILD_ROOT
  168. # fetch GNU platform triple
  169. triple=`./config.guess`
  170. triple=`./config.sub ${triple}`
  171. # perform the standard installation procedure
  172. ( cd obj
  173. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  174. ) || exit $?
  175. # cleanup installation tree
  176. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  177. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/
  178. for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
  179. subdir=`echo "$multilib" | sed -e 's/;.*$//'`
  180. [ ".$subdir" = .. ] && continue
  181. mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
  182. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/
  183. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir
  184. done
  185. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  186. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
  187. >/dev/null 2>&1 || true
  188. # strip installation tree
  189. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  190. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  191. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  192. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
  193. %if "%{with_cxx}" == "yes"
  194. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  195. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  196. %endif
  197. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  198. for prog in cc1 cc1plus collect2 cpp; do
  199. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \
  200. >/dev/null 2>&1 || true
  201. done
  202. # bump up installation tree
  203. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
  204. $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  205. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  206. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  207. %if "%{with_cxx}" == "yes"
  208. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  209. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  210. %endif
  211. # resolve filename conflicts
  212. %if "%{with_gcc}" != "yes" && "%{V_comp}" != ""
  213. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  214. for file in *; do
  215. [ ".$file" = ".*" ] && continue
  216. mv ${file} ${file}%{V_comp}
  217. done
  218. ) || exit $?
  219. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  220. for file in *; do
  221. [ ".$file" = ".*" ] && continue
  222. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  223. done
  224. ) || exit $?
  225. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  226. for file in *; do
  227. [ ".$file" = ".*" ] && continue
  228. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  229. done
  230. ) || exit $?
  231. %endif
  232. # determine installation file list
  233. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  234. %files -f files
  235. %clean
  236. rm -rf $RPM_BUILD_ROOT