tcc-0.9.26-r3.ebuild 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit toolchain-funcs
  5. DESCRIPTION="A very small C compiler for ix86/amd64"
  6. HOMEPAGE="http://bellard.org/tcc/"
  7. SRC_URI="http://download.savannah.gnu.org/releases/tinycc/${P}.tar.bz2"
  8. LICENSE="LGPL-2.1"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~x86 ~amd64-linux"
  11. DEPEND="dev-lang/perl" # doc generation
  12. # Both tendra and tinycc install /usr/bin/tcc
  13. RDEPEND="!dev-lang/tendra"
  14. IUSE="test"
  15. src_prepare() {
  16. # Don't strip
  17. sed -i -e 's|$(INSTALL) -s|$(INSTALL)|' Makefile || die
  18. # Fix examples
  19. sed -i -e '1{
  20. i#! /usr/bin/tcc -run
  21. /^#!/d
  22. }' examples/ex*.c || die
  23. sed -i -e '1s/$/ -lX11/' examples/ex4.c || die
  24. # Fix texi2html invocation
  25. sed -i -e 's/-number//' Makefile || die
  26. sed -i -e 's/--sections//' Makefile || die
  27. # Fix compiling tcc with clang
  28. eapply "${FILESDIR}"/clang.patch
  29. # Allows using tcc as the system compiler for Gentoo
  30. eapply "${FILESDIR}"/linker.patch
  31. eapply_user
  32. }
  33. src_configure() {
  34. use test && unset CFLAGS LDFLAGS # Tests run with CC=tcc etc, they will fail hard otherwise
  35. # better fixes welcome, it feels wrong to hack the env like this
  36. # not autotools, so call configure directly
  37. ./configure --cc="$(tc-getCC)" \
  38. --prefix="${EPREFIX}/usr" \
  39. --libdir="${EPREFIX}/usr/$(get_libdir)" \
  40. --docdir="${EPREFIX}/usr/share/doc/${PF}"
  41. }
  42. src_compile() {
  43. emake AR="$(tc-getAR)"
  44. }
  45. src_install() {
  46. emake DESTDIR="${D}" install
  47. dodoc Changelog README TODO VERSION
  48. #dohtml tcc-doc.html
  49. exeinto /usr/share/doc/${PF}/examples
  50. doexe examples/ex*.c
  51. }
  52. src_test() {
  53. # this is using tcc bits that don't know as-needed etc.
  54. TCCFLAGS="" emake test
  55. }