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