gcc33.spec 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 3.3
  27. %define V_short 33
  28. %define V_snap_comp 20030106
  29. %define V_snap_dash 2003-01-06
  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 [PLUS]
  37. Group: Language
  38. License: GPL
  39. Version: %{V_major}s%{V_snap_comp}
  40. Release: 20030109
  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. Patch0: gcc33.patch
  49. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20030103, make
  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. %description
  61. The GNU Compiler Collection (GCC) provides a standard conforming and
  62. highly portable ISO C and ISO C++ compiler.
  63. %prep
  64. %setup -q -n gcc-%{V_snap_comp}
  65. %patch -p0
  66. %{l_shtool} subst -v -s \
  67. -e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
  68. gcc/configure
  69. %build
  70. # configure the package
  71. mkdir obj
  72. cd obj
  73. options=""
  74. case "%{l_target}" in
  75. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  76. esac
  77. CC="%{l_cc}" \
  78. CFLAGS="%{l_cflags}" \
  79. ../configure \
  80. --prefix=%{l_prefix} \
  81. --exec-prefix=%{l_prefix} \
  82. --includedir=%{l_prefix}/include/gcc \
  83. --with-gxx-include-dir=%{l_prefix}/include/g++%{V_short} \
  84. --with-local-prefix=%{l_prefix}/lib/gcc%{V_short}-lib \
  85. %if "%{with_cxx}" == "yes"
  86. --enable-languages="c,c++" \
  87. %else
  88. --enable-languages="c" \
  89. %endif
  90. %if "%{with_threads}" == "yes"
  91. --enable-threads=posix \
  92. %else
  93. --enable-threads=single \
  94. %endif
  95. --disable-maintainer-mode \
  96. --disable-shared \
  97. --disable-nls \
  98. %if "%{with_binutils}" == "yes"
  99. --with-gnu-ld --with-ld=%{l_prefix}/bin/ld \
  100. --with-gnu-as --with-as=%{l_prefix}/bin/as \
  101. %endif
  102. $options
  103. # redirect lib directory
  104. %{l_shtool} subst -v -s \
  105. -e "s;/gcc-lib/;/gcc%{V_short}-lib/;" \
  106. `find . -name Makefile -type f -print`
  107. # build the package
  108. %if "%{with_optimize}" == "yes"
  109. l_boot_cflags="-O2"
  110. l_cflags="-O"
  111. l_libcflags="-g -O2"
  112. l_libcxxflags="-g -O2 -fno-implicit-templates"
  113. case "%{l_target}" in
  114. *-osf* ) l_boot_cflags="-O" ;;
  115. esac
  116. %else
  117. l_boot_cflags="-O0"
  118. l_cflags=""
  119. l_libcflags="-g -O0"
  120. l_libcxxflags="-g -O0"
  121. %endif
  122. %{l_make} %{l_mflags} \
  123. MAKE="%{l_make} %{l_mflags}" \
  124. BOOT_CFLAGS="$l_boot_cflags" \
  125. CFLAGS="$l_cflags" \
  126. LIBCFLAGS="$l_libcflags" \
  127. LIBCXXFLAGS="$l_libcxxflags" \
  128. bootstrap-lean
  129. %install
  130. rm -rf $RPM_BUILD_ROOT
  131. triple=`./config.guess`
  132. cd obj
  133. # redirect to temporary build root
  134. %{l_shtool} subst -v -s \
  135. -e "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  136. -e "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  137. -e "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++%{V_short};" \
  138. -e "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++%{V_short};" \
  139. -e "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++%{V_short};" \
  140. -e "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib;" \
  141. -e "s;/gcc-lib/;/gcc%{V_short}-lib;" \
  142. `find . -name Makefile -type f -print`
  143. # make sure the install procedure doesn't compile anything
  144. # (or else we would have wrong paths hard-coded in the programs)
  145. %{l_shtool} subst -v -s \
  146. -e 's;^install-cpp:.*;install-cpp:;' \
  147. -e 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  148. -e 's;^install-driver:.*;install-driver:;' \
  149. -e 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  150. -e 's;^install-build:.*;install-build:;' \
  151. -e 's;^install-collect2:.*;install-collect2: installdirs;' \
  152. -e 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  153. -e 's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
  154. -e 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  155. gcc/Makefile gcc/libgcc.mk gcc/*/Makefile
  156. # make sure the Makefiles are not re-generated
  157. for file in `find . -name config.status -print`; do
  158. ( echo "#!/bin/sh"
  159. echo ":"
  160. ) >$file
  161. done
  162. # run the standard installation procedure
  163. %{l_make} %{l_mflags} install
  164. # strip the installation
  165. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  166. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
  167. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  168. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7
  169. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  170. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/gccbug >/dev/null 2>&1 || true
  171. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/dev/null 2>&1 || true
  172. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc-%{V_major} >/dev/null 2>&1 || true
  173. %if "%{with_cxx}" == "yes"
  174. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  175. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  176. %endif
  177. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  178. for prog in cc1 cc1plus collect2 cpp; do
  179. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
  180. done
  181. # cleanup tree
  182. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib
  183. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libiberty.a
  184. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{V_major}/libstdc++.a
  185. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libstdc++.a* \
  186. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{V_major}/libstdc++.a
  187. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{V_major}/libsupc++.a
  188. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libsupc++.a* \
  189. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{V_major}/libsupc++.a
  190. # rename files
  191. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  192. for file in *; do
  193. mv ${file} ${file}%{V_short}
  194. done
  195. )
  196. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  197. for file in *; do
  198. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_short}\2;'`
  199. done
  200. )
  201. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  202. for file in *; do
  203. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_short}\2;'`
  204. done
  205. )
  206. # create file list
  207. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_snap_comp}/files -r$RPM_BUILD_ROOT %{l_files_std}
  208. %files -f files
  209. %clean
  210. rm -rf $RPM_BUILD_ROOT