gcc31.spec 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ##
  2. ## gcc31.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. # the version informations
  26. %define V_major 3.1
  27. %define V_snap_Y 2002
  28. %define V_snap_M 03
  29. %define V_snap_D 11
  30. # derived version shortcuts
  31. %define V_here %{V_major}s%{V_snap_Y}%{V_snap_M}%{V_snap_D}
  32. %define V_dir %{V_snap_Y}-%{V_snap_M}-%{V_snap_D}
  33. %define V_file %{V_snap_Y}%{V_snap_M}%{V_snap_D}
  34. # package information
  35. Name: gcc31
  36. Summary: Forthcoming GNU C/C++ Compiler (3.1)
  37. URL: http://gcc.gnu.org/
  38. Vendor: Free Software Foundation
  39. Packager: The OpenPKG Project
  40. Distribution: OpenPKG [EXP]
  41. Group: Language
  42. License: GPL
  43. Version: %{V_here}
  44. Release: 20020313
  45. # list of sources
  46. Source0: ftp://gcc.gnu.org/pub/gcc/snapshots/%{V_dir}/gcc-%{V_file}.tar.bz2
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20020206, make
  51. PreReq: OpenPKG, openpkg >= 20020206
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. The GNU Compiler Collection (GCC) provides a standard conforming
  56. and highly portable ISO C and ISO C++ compiler. This is a SNAPSHOT
  57. version of the forthcoming GCC 3.1. Do not use it in a production
  58. environment!
  59. %prep
  60. %setup -q -n gcc-%{V_file}
  61. %build
  62. # configure the package
  63. mkdir obj
  64. cd obj
  65. options=""
  66. case "%{l_target}" in
  67. *-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
  68. esac
  69. CC="%{l_cc}" \
  70. CFLAGS="%{l_cflags}" \
  71. ../configure \
  72. --prefix=%{l_prefix} \
  73. --exec-prefix=%{l_prefix} \
  74. --with-gxx-include-dir=%{l_prefix}/include/g++31 \
  75. --with-local-prefix=%{l_prefix}/lib/gcc31-lib \
  76. --enable-languages="c,c++" \
  77. --enable-threads \
  78. --disable-maintainer-mode \
  79. --disable-shared \
  80. --disable-nls \
  81. $options
  82. # build the package
  83. %{l_make} %{l_mflags} \
  84. MAKE="%{l_make} %{l_mflags}" \
  85. CFLAGS='-O' \
  86. LIBCFLAGS='-g -O2' \
  87. LIBCXXFLAGS='-g -O2 -fno-implicit-templates' \
  88. bootstrap-lean
  89. %install
  90. rm -rf $RPM_BUILD_ROOT
  91. triple=`./config.guess`
  92. triple=`./config.sub $triple | sed -e 's;-unknown-;--;'`
  93. cd obj
  94. # redirect to temporary build root
  95. %{l_shtool} subst -v -s \
  96. -e "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  97. -e "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  98. -e "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++31;" \
  99. -e "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++31;" \
  100. -e "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++31;" \
  101. -e "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc31-lib;" \
  102. `find . -name Makefile -type f -print`
  103. # make sure the install procedure doesn't compile anything
  104. # (or else we would have wrong paths hard-coded in the programs)
  105. %{l_shtool} subst -v -s \
  106. -e 's;^install-cpp:.*;install-cpp:;' \
  107. -e 's;^install-common:.*;install-common: installdirs lang.install-common;' \
  108. -e 's;^install-driver:.*;install-driver:;' \
  109. -e 's;^install-libgcc:.*;install-libgcc: installdirs;' \
  110. -e 's;^install-build:.*;install-build:;' \
  111. -e 's;^install-collect2:.*;install-collect2: installdirs;' \
  112. -e 's;^install-assert-h:.*;install-assert-h: installdirs;' \
  113. -e 's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
  114. -e 's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
  115. gcc/Makefile gcc/libgcc.mk gcc/*/Makefile
  116. # make sure the Makefiles are not re-generated
  117. for file in `find . -name config.status -print`; do
  118. ( echo "#!/bin/sh"
  119. echo ":"
  120. ) >$file
  121. done
  122. # run the standard installation procedure
  123. %{l_make} %{l_mflags} install
  124. # strip the installation
  125. mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
  126. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc31-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
  127. rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
  128. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  129. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
  130. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++
  131. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++
  132. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  133. for prog in cc1 cc1plus collect2 cpp; do
  134. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc31-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
  135. done
  136. # make additional links
  137. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  138. #ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  139. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  140. # rename files
  141. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  142. for file in *; do
  143. mv ${file} ${file}31
  144. done
  145. )
  146. ( cd $RPM_BUILD_ROOT%{l_prefix}/lib
  147. for file in *; do
  148. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\131\2;'`
  149. done
  150. )
  151. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  152. for file in *; do
  153. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\131\2;'`
  154. done
  155. )
  156. # create file list
  157. %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_file}/files -r$RPM_BUILD_ROOT %{l_files_std}
  158. %files -f files
  159. %clean
  160. rm -rf $RPM_BUILD_ROOT