gcc.spec 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ##
  2. ## gcc.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. %define V_major 3.0.1
  25. %define V_short 3.0.1
  26. %define V_long 3.0.1
  27. # package information
  28. Name: gcc
  29. Summary: GNU C/C++ Compiler
  30. URL: http://gcc.gnu.org/
  31. Vendor: Free Software Foundation
  32. Packager: The OpenPKG Project
  33. Distribution: OpenPKG [EXP]
  34. Group: Language
  35. License: GPL
  36. Version: %{V_short}
  37. Release: %{l_branch}.0
  38. # list of sources
  39. Source0: ftp://gcc.gnu.org/pub/gcc/releases/%{V_long}/gcc-%{V_long}.tar.bz2
  40. # build information
  41. Prefix: %{l_prefix}
  42. BuildRoot: %{l_buildroot}
  43. BuildPreReq: OpenPKG, openpkg >= 20011023.0, make
  44. PreReq: OpenPKG, openpkg >= 20011023.0
  45. AutoReq: no
  46. AutoReqProv: no
  47. %description
  48. The GNU Compiler Collection (GCC) provides C and C++ compilers.
  49. %prep
  50. %setup -q -n gcc-%{V_long}
  51. %build
  52. # configure the package
  53. mkdir obj
  54. cd obj
  55. options=""
  56. case "%{l_target}" in
  57. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  58. esac
  59. CC="%{l_cc}" \
  60. CFLAGS="%{l_cflags}" \
  61. ../configure \
  62. --prefix=%{l_prefix} \
  63. --exec-prefix=%{l_prefix} \
  64. --with-gxx-include-dir=%{l_prefix}/include/g++ \
  65. --with-local-prefix=%{l_prefix}/lib/gcc-lib \
  66. --enable-languages="c,c++" \
  67. --enable-threads \
  68. --disable-maintainer-mode \
  69. --enable-shared \
  70. --disable-nls \
  71. $options
  72. # build the package
  73. %{l_make} %{l_mflags} \
  74. MAKE="%{l_make} %{l_mflags}" \
  75. CFLAGS='-O' \
  76. LIBCFLAGS='-g -O2' \
  77. LIBCXXFLAGS='-g -O2 -fno-implicit-templates' \
  78. bootstrap-lean
  79. %install
  80. rm -rf $RPM_BUILD_ROOT
  81. triple=`./config.guess`
  82. triple=`./config.sub $triple | sed -e 's;-unknown-;--;'`
  83. cd obj
  84. # redirect to temporary build root
  85. %{l_rpmtool} subst -v -s \
  86. "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  87. "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  88. "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  89. "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  90. "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
  91. "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib;" \
  92. -- `find . -name Makefile -type f -print`
  93. # make sure the install procedure doesn't compile anything
  94. # (or else we would have wrong paths hard-coded in the programs)
  95. %{l_rpmtool} subst -v -s \
  96. 's;^install-cpp:.*;install-cpp:;' \
  97. 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  98. 's;^install-driver:.*;install-driver:;' \
  99. 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  100. 's;^install-build:.*;install-build:;' \
  101. 's;^install-collect2:.*;install-collect2: installdirs;' \
  102. 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  103. 's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
  104. 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  105. -- gcc/Makefile gcc/libgcc.mk 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/gcc-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
  117. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  118. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  119. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
  120. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++
  121. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++
  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/gcc-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
  125. done
  126. # make additional links
  127. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  128. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  129. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  130. # create file list
  131. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/files -r$RPM_BUILD_ROOT %{l_files_std}
  132. %files -f files
  133. %clean
  134. rm -rf $RPM_BUILD_ROOT