gcc.spec 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 versions
  26. %define V_major 3.2.1
  27. %define V_short 3.2.1
  28. %define V_long 3.2.1
  29. # package information
  30. Name: gcc
  31. Summary: GNU Compiler Collection
  32. URL: http://gcc.gnu.org/
  33. Vendor: Free Software Foundation
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG [CORE]
  36. Group: Language
  37. License: GPL
  38. Version: %{V_short}
  39. Release: 20030103
  40. # package options
  41. %option with_cxx yes
  42. %option with_optimize yes
  43. %option with_binutils yes
  44. %option with_threads yes
  45. # list of sources
  46. Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_long}/gcc-%{V_long}.tar.bz2
  47. Patch0: gcc.patch
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20030103, make
  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_long}
  64. %patch -p0
  65. %{l_shtool} subst -v -s \
  66. -e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
  67. gcc/configure
  68. %build
  69. # configure the package
  70. mkdir obj
  71. cd obj
  72. options=""
  73. case "%{l_target}" in
  74. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  75. esac
  76. CC="%{l_cc}" \
  77. CFLAGS="%{l_cflags}" \
  78. ../configure \
  79. --prefix=%{l_prefix} \
  80. --exec-prefix=%{l_prefix} \
  81. --includedir=%{l_prefix}/include/gcc \
  82. --with-gxx-include-dir=%{l_prefix}/include/g++ \
  83. --with-local-prefix=%{l_prefix}/lib/gcc-lib \
  84. %if "%{with_cxx}" == "yes"
  85. --enable-languages="c,c++" \
  86. %else
  87. --enable-languages="c" \
  88. %endif
  89. %if "%{with_threads}" == "yes"
  90. --enable-threads=posix \
  91. %else
  92. --enable-threads=single \
  93. %endif
  94. --disable-maintainer-mode \
  95. --disable-shared \
  96. --disable-nls \
  97. %if "%{with_binutils}" == "yes"
  98. --with-gnu-ld --with-ld=%{l_prefix}/bin/ld \
  99. --with-gnu-as --with-as=%{l_prefix}/bin/as \
  100. %endif
  101. $options
  102. # build the package
  103. %if "%{with_optimize}" == "yes"
  104. l_boot_cflags="-O2"
  105. l_cflags="-O"
  106. l_libcflags="-g -O2"
  107. l_libcxxflags="-g -O2 -fno-implicit-templates"
  108. case "%{l_target}" in
  109. *-osf* ) l_boot_cflags="-O" ;;
  110. esac
  111. %else
  112. l_boot_cflags="-O0"
  113. l_cflags=""
  114. l_libcflags="-g -O0"
  115. l_libcxxflags="-g -O0"
  116. %endif
  117. %{l_make} %{l_mflags} \
  118. MAKE="%{l_make} %{l_mflags}" \
  119. BOOT_CFLAGS="$l_boot_cflags" \
  120. CFLAGS="$l_cflags" \
  121. LIBCFLAGS="$l_libcflags" \
  122. LIBCXXFLAGS="$l_libcxxflags" \
  123. bootstrap-lean
  124. %install
  125. rm -rf $RPM_BUILD_ROOT
  126. triple=`./config.guess`
  127. triple=`./config.sub $triple | sed -e 's;-unknown-;--;'`
  128. cd obj
  129. # redirect to temporary build root
  130. %{l_shtool} subst -v -s \
  131. -e "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  132. -e "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  133. -e "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  134. -e "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  135. -e "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  136. -e "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib;" \
  137. `find . -name Makefile -type f -print`
  138. # make sure the install procedure doesn't compile anything
  139. # (or else we would have wrong paths hard-coded in the programs)
  140. %{l_shtool} subst -v -s \
  141. -e 's;^install-cpp:.*;install-cpp:;' \
  142. -e 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  143. -e 's;^install-driver:.*;install-driver:;' \
  144. -e 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  145. -e 's;^install-build:.*;install-build:;' \
  146. -e 's;^install-collect2:.*;install-collect2: installdirs;' \
  147. -e 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  148. -e 's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
  149. -e 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  150. gcc/Makefile gcc/libgcc.mk gcc/*/Makefile
  151. # make sure the Makefiles are not re-generated
  152. for file in `find . -name config.status -print`; do
  153. ( echo "#!/bin/sh"
  154. echo ":"
  155. ) >$file
  156. done
  157. # run the standard installation procedure
  158. %{l_make} %{l_mflags} install
  159. # strip the installation
  160. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  161. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
  162. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  163. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  164. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/dev/null 2>&1 || true
  165. %if "%{with_cxx}" == "yes"
  166. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  167. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  168. %endif
  169. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  170. for prog in cc1 cc1plus collect2 cpp; do
  171. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
  172. done
  173. # make additional links
  174. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  175. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  176. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  177. %if "%{with_cxx}" == "yes"
  178. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  179. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  180. %endif
  181. # create file list
  182. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/files -r$RPM_BUILD_ROOT %{l_files_std}
  183. %files -f files
  184. %clean
  185. rm -rf $RPM_BUILD_ROOT