gcc2.spec 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. ##
  2. ## gcc2.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.com>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: gcc2
  26. Summary: Old GNU C/C++ Compiler
  27. Group: Language
  28. URL: http://gcc.gnu.org/
  29. Vendor: Free Software Foundation
  30. Packager: rse@openpkg.org
  31. Distribution: OpenPKG [EXP]
  32. License: GPL
  33. Version: 2.95.3
  34. Release: 20020206
  35. # list of sources
  36. Source0: ftp://gcc.gnu.org/pub/gcc/releases/%{version}/gcc-%{version}.tar.bz2
  37. Patch0: gcc-2.95.3.patch-osf
  38. Patch1: gcc-2.95.3.patch-freebsd
  39. # build information
  40. Prefix: %{l_prefix}
  41. BuildRoot: %{l_buildroot}
  42. BuildPreReq: OpenPKG, openpkg >= 20020206.0.0, make
  43. PreReq: OpenPKG, openpkg >= 20020206.0.0
  44. AutoReq: no
  45. AutoReqProv: no
  46. %description
  47. The GNU Compiler Collection (GCC) provides C and C++ compilers.
  48. %prep
  49. %setup -q -n gcc-%{version}
  50. %patch0 -p0
  51. %patch1 -p0
  52. # fix --with-local-prefix in advance
  53. find . -type f -print |\
  54. xargs %{l_rpmtool} subst -v -s "s;/gcc-lib;/gcc2-lib;g" --
  55. %build
  56. # configure the package
  57. mkdir obj
  58. cd obj
  59. options=""
  60. case "%{l_target}" in
  61. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  62. esac
  63. CC="%{l_cc}" \
  64. CFLAGS="%{l_cflags}" \
  65. ../configure \
  66. --prefix=%{l_prefix} \
  67. --exec-prefix=%{l_prefix} \
  68. --with-gxx-include-dir=%{l_prefix}/include/g++2 \
  69. --with-local-prefix=%{l_prefix}/lib/gcc2-lib \
  70. --enable-languages="c,c++" \
  71. --disable-shared \
  72. --disable-threads \
  73. $options
  74. # build the package
  75. %{l_make} %{l_mflags} \
  76. MAKE="%{l_make} %{l_mflags}" \
  77. CFLAGS='-O' \
  78. LIBCFLAGS='-g -O2' \
  79. LIBCXXFLAGS='-g -O2 -fno-implicit-templates' \
  80. bootstrap-lean
  81. %install
  82. rm -rf $RPM_BUILD_ROOT
  83. triple=`./config.guess`
  84. triple=`./config.sub $triple`
  85. cd obj
  86. # redirect to temporary build root
  87. %{l_rpmtool} subst -v -s \
  88. "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  89. "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  90. "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++2;" \
  91. "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++2;" \
  92. "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib;" \
  93. -- `find . -name Makefile -type f -print`
  94. # make sure the install procedure doesn't compile anything
  95. # (or else we would have wrong paths hard-coded in the programs)
  96. %{l_rpmtool} subst -v -s \
  97. 's;^install-cpp:.*;install-cpp:;' \
  98. 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  99. 's;^install-driver:.*;install-driver:;' \
  100. 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  101. 's;^install-build:.*;install-build:;' \
  102. 's;^install-collect2:.*;install-collect2: installdirs;' \
  103. 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  104. 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  105. -- gcc/Makefile gcc/*/Makefile
  106. # make sure the Makefiles are not re-generated
  107. for file in `find . -name config.status -print`; do
  108. ( echo "#!/bin/sh"
  109. echo ":"
  110. ) >$file
  111. done
  112. # run the standard installation procedure
  113. %{l_make} %{l_mflags} install
  114. # strip the installation
  115. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  116. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/include/ >/dev/null 2>&1 || true
  117. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  118. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
  119. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  120. for prog in cc1 cc1plus collect2 cpp; do
  121. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/$prog >/dev/null 2>&1 || true
  122. done
  123. # rename files
  124. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  125. for file in *; do
  126. mv ${file} ${file}2
  127. done
  128. )
  129. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  130. for file in *; do
  131. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\12\2;'`
  132. done
  133. )
  134. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  135. for file in *; do
  136. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\12\2;'`
  137. done
  138. )
  139. # cleanup tree
  140. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libiberty.a
  141. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/libstdc++.a
  142. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libstdc++.a* \
  143. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc2-lib/$triple/%{version}/libstdc++.a
  144. # create file list
  145. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{version}/files -r$RPM_BUILD_ROOT %{l_files_std}
  146. exit 0
  147. %files -f files
  148. %clean
  149. # rm -rf $RPM_BUILD_ROOT