gcc.spec 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. ##
  2. ## gcc.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. %define V_major 3.0.3
  26. %define V_short 3.0.3
  27. %define V_long 3.0.3
  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: 20011222
  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 >= 20011227, make
  45. PreReq: OpenPKG, openpkg >= 20011227
  46. AutoReq: no
  47. AutoReqProv: no
  48. %description
  49. The GNU Compiler Collection (GCC) provides a standard conforming and
  50. highly portable ISO C and ISO C++ compiler.
  51. %prep
  52. %setup -q -n gcc-%{V_long}
  53. %build
  54. # configure the package
  55. mkdir obj
  56. cd obj
  57. options=""
  58. case "%{l_target}" in
  59. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  60. esac
  61. CC="%{l_cc}" \
  62. CFLAGS="%{l_cflags}" \
  63. ../configure \
  64. --prefix=%{l_prefix} \
  65. --exec-prefix=%{l_prefix} \
  66. --with-gxx-include-dir=%{l_prefix}/include/g++ \
  67. --with-local-prefix=%{l_prefix}/lib/gcc-lib \
  68. --enable-languages="c,c++" \
  69. --enable-threads \
  70. --disable-maintainer-mode \
  71. --disable-shared \
  72. --disable-nls \
  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 | sed -e 's;-unknown-;--;'`
  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++;" \
  91. "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  92. "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  93. "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib;" \
  94. -- `find . -name Makefile -type f -print`
  95. # make sure the install procedure doesn't compile anything
  96. # (or else we would have wrong paths hard-coded in the programs)
  97. %{l_rpmtool} subst -v -s \
  98. 's;^install-cpp:.*;install-cpp:;' \
  99. 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  100. 's;^install-driver:.*;install-driver:;' \
  101. 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  102. 's;^install-build:.*;install-build:;' \
  103. 's;^install-collect2:.*;install-collect2: installdirs;' \
  104. 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  105. 's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
  106. 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  107. -- gcc/Makefile gcc/libgcc.mk gcc/*/Makefile
  108. # make sure the Makefiles are not re-generated
  109. for file in `find . -name config.status -print`; do
  110. ( echo "#!/bin/sh"
  111. echo ":"
  112. ) >$file
  113. done
  114. # run the standard installation procedure
  115. %{l_make} %{l_mflags} install
  116. # strip the installation
  117. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  118. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
  119. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  120. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  121. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
  122. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++
  123. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++
  124. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  125. for prog in cc1 cc1plus collect2 cpp; do
  126. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
  127. done
  128. # make additional links
  129. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  130. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  131. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  132. # create file list
  133. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/files -r$RPM_BUILD_ROOT %{l_files_std}
  134. %files -f files
  135. %clean
  136. rm -rf $RPM_BUILD_ROOT