gcc2.spec 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. ##
  2. ## gcc2.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 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 information
  26. Name: gcc2
  27. Summary: Old GNU C/C++ Compiler (2.95)
  28. URL: http://gcc.gnu.org/
  29. Vendor: Free Software Foundation
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [EXP]
  32. Group: Language
  33. License: GPL
  34. Version: 2.95.3
  35. Release: 20020311
  36. # list of sources
  37. Source0: ftp://gcc.gnu.org/pub/gcc/releases/%{version}/gcc-%{version}.tar.bz2
  38. Patch0: gcc-2.95.3.patch-osf
  39. Patch1: gcc-2.95.3.patch-freebsd
  40. # build information
  41. Prefix: %{l_prefix}
  42. BuildRoot: %{l_buildroot}
  43. BuildPreReq: OpenPKG, openpkg >= 20020206, make
  44. PreReq: OpenPKG, openpkg >= 20020206
  45. AutoReq: no
  46. AutoReqProv: no
  47. %description
  48. The GNU Compiler Collection (GCC) provides C and C++ compilers.
  49. This is an old version of GCC. Do not use it unless you have a good
  50. reason.
  51. %prep
  52. %setup -q -n gcc-%{version}
  53. %patch0 -p0
  54. %patch1 -p0
  55. # fix --with-local-prefix in advance
  56. find . -type f -print |\
  57. xargs %{l_shtool} subst -v -s -e "s;/gcc-lib;/gcc2-lib;g"
  58. %build
  59. # configure the package
  60. mkdir obj
  61. cd obj
  62. options=""
  63. case "%{l_target}" in
  64. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  65. esac
  66. CC="%{l_cc}" \
  67. CFLAGS="%{l_cflags}" \
  68. ../configure \
  69. --prefix=%{l_prefix} \
  70. --exec-prefix=%{l_prefix} \
  71. --with-gxx-include-dir=%{l_prefix}/include/g++2 \
  72. --with-local-prefix=%{l_prefix}/lib/gcc2-lib \
  73. --enable-languages="c,c++" \
  74. --disable-shared \
  75. --disable-threads \
  76. $options
  77. # build the package
  78. %{l_make} %{l_mflags} \
  79. MAKE="%{l_make} %{l_mflags}" \
  80. CFLAGS='-O' \
  81. LIBCFLAGS='-g -O2' \
  82. LIBCXXFLAGS='-g -O2 -fno-implicit-templates' \
  83. bootstrap-lean
  84. %install
  85. rm -rf $RPM_BUILD_ROOT
  86. triple=`./config.guess`
  87. triple=`./config.sub $triple`
  88. cd obj
  89. # redirect to temporary build root
  90. %{l_shtool} subst -v -s \
  91. -e "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  92. -e "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  93. -e "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++2;" \
  94. -e "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++2;" \
  95. -e "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib;" \
  96. `find . -name Makefile -type f -print`
  97. # make sure the install procedure doesn't compile anything
  98. # (or else we would have wrong paths hard-coded in the programs)
  99. %{l_shtool} subst -v -s \
  100. -e 's;^install-cpp:.*;install-cpp:;' \
  101. -e 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  102. -e 's;^install-driver:.*;install-driver:;' \
  103. -e 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  104. -e 's;^install-build:.*;install-build:;' \
  105. -e 's;^install-collect2:.*;install-collect2: installdirs;' \
  106. -e 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  107. -e 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  108. gcc/Makefile gcc/*/Makefile
  109. # make sure the Makefiles are not re-generated
  110. for file in `find . -name config.status -print`; do
  111. ( echo "#!/bin/sh"
  112. echo ":"
  113. ) >$file
  114. done
  115. # run the standard installation procedure
  116. %{l_make} %{l_mflags} install
  117. # strip the installation
  118. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  119. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/include/ >/dev/null 2>&1 || true
  120. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  121. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
  122. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  123. for prog in cc1 cc1plus collect2 cpp; do
  124. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/$prog >/dev/null 2>&1 || true
  125. done
  126. # rename files
  127. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  128. for file in *; do
  129. mv ${file} ${file}2
  130. done
  131. )
  132. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  133. for file in *; do
  134. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\12\2;'`
  135. done
  136. )
  137. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  138. for file in *; do
  139. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\12\2;'`
  140. done
  141. )
  142. # cleanup tree
  143. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libiberty.a
  144. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/libstdc++.a
  145. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libstdc++.a* \
  146. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/libstdc++.a
  147. # create file list
  148. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{version}/files -r$RPM_BUILD_ROOT %{l_files_std}
  149. %files -f files
  150. %clean
  151. rm -rf $RPM_BUILD_ROOT