gcc.spec 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ##
  2. ## gcc.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2001 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2001 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. %define V_major 3.0.2
  26. %define V_short 3.0.2
  27. %define V_long 3.0.2
  28. # package information
  29. Name: gcc
  30. Summary: GNU C/C++ Compiler
  31. URL: http://gcc.gnu.org/
  32. Vendor: Free Software Foundation
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [REL]
  35. Group: Language
  36. License: GPL
  37. Version: %{V_short}
  38. Release: 20011201
  39. # list of sources
  40. Source0: ftp://gcc.gnu.org/pub/gcc/releases/%{V_long}/gcc-%{V_long}.tar.bz2
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20011126.0, make
  45. PreReq: OpenPKG, openpkg >= 20011126.0
  46. AutoReq: no
  47. AutoReqProv: no
  48. %description
  49. The GNU Compiler Collection (GCC) provides C and C++ compilers.
  50. %prep
  51. %setup -q -n gcc-%{V_long}
  52. %build
  53. # configure the package
  54. mkdir obj
  55. cd obj
  56. options=""
  57. case "%{l_target}" in
  58. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  59. esac
  60. CC="%{l_cc}" \
  61. CFLAGS="%{l_cflags}" \
  62. ../configure \
  63. --prefix=%{l_prefix} \
  64. --exec-prefix=%{l_prefix} \
  65. --with-gxx-include-dir=%{l_prefix}/include/g++ \
  66. --with-local-prefix=%{l_prefix}/lib/gcc-lib \
  67. --enable-languages="c,c++" \
  68. --enable-threads \
  69. --disable-maintainer-mode \
  70. --disable-shared \
  71. --disable-nls \
  72. $options
  73. # build the package
  74. %{l_make} %{l_mflags} \
  75. MAKE="%{l_make} %{l_mflags}" \
  76. CFLAGS='-O' \
  77. LIBCFLAGS='-g -O2' \
  78. LIBCXXFLAGS='-g -O2 -fno-implicit-templates' \
  79. bootstrap-lean
  80. %install
  81. rm -rf $RPM_BUILD_ROOT
  82. triple=`./config.guess`
  83. triple=`./config.sub $triple | sed -e 's;-unknown-;--;'`
  84. cd obj
  85. # redirect to temporary build root
  86. %{l_rpmtool} subst -v -s \
  87. "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  88. "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  89. "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  90. "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  91. "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  92. "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-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: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
  105. 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  106. -- gcc/Makefile gcc/libgcc.mk gcc/*/Makefile
  107. # make sure the Makefiles are not re-generated
  108. for file in `find . -name config.status -print`; do
  109. ( echo "#!/bin/sh"
  110. echo ":"
  111. ) >$file
  112. done
  113. # run the standard installation procedure
  114. %{l_make} %{l_mflags} install
  115. # strip the installation
  116. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  117. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
  118. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  119. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  120. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
  121. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++
  122. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++
  123. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  124. for prog in cc1 cc1plus collect2 cpp; do
  125. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
  126. done
  127. # make additional links
  128. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  129. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  130. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  131. # create file list
  132. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/files -r$RPM_BUILD_ROOT %{l_files_std}
  133. %files -f files
  134. %clean
  135. rm -rf $RPM_BUILD_ROOT