1 |
commit: 5f3838b3c67e7400a95f87496965354b1af777c4 |
2 |
Author: Austin English <wizardedit <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 2 05:20:25 2016 +0000 |
4 |
Commit: Austin English <wizardedit <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 2 05:20:54 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f3838b3 |
7 |
|
8 |
dev-lang/tcc: fix building with clang |
9 |
|
10 |
* fix building tcc with clang |
11 |
* allow using tcc as system compiler |
12 |
* update to EAPI 6 |
13 |
|
14 |
Gentoo-Bug: https://bugs.gentoo.org/502452 |
15 |
|
16 |
Package-Manager: portage-2.2.26 |
17 |
|
18 |
dev-lang/tcc/files/clang.patch | 18 ++++++++++ |
19 |
dev-lang/tcc/files/linker.patch | 18 ++++++++++ |
20 |
dev-lang/tcc/tcc-0.9.26-r3.ebuild | 72 +++++++++++++++++++++++++++++++++++++++ |
21 |
3 files changed, 108 insertions(+) |
22 |
|
23 |
diff --git a/dev-lang/tcc/files/clang.patch b/dev-lang/tcc/files/clang.patch |
24 |
new file mode 100644 |
25 |
index 0000000..8304470 |
26 |
--- /dev/null |
27 |
+++ b/dev-lang/tcc/files/clang.patch |
28 |
@@ -0,0 +1,18 @@ |
29 |
+# Fixes the default linker options for portage |
30 |
+# Upstream commit ba286136bf8e48c71ffd6c2fd9ce97e64a6eeeb1 |
31 |
+ |
32 |
+diff --git a/libtcc.c b/libtcc.c |
33 |
+index 127806f..dc78643 100644 |
34 |
+--- a/libtcc.c |
35 |
++++ b/libtcc.c |
36 |
+@@ -1560,6 +1560,10 @@ static int tcc_set_linker(TCCState *s, const char *option) |
37 |
+ } else |
38 |
+ goto err; |
39 |
+ |
40 |
++ } else if (link_option(option, "as-needed", &p)) { |
41 |
++ ignoring = 1; |
42 |
++ } else if (link_option(option, "O", &p)) { |
43 |
++ ignoring = 1; |
44 |
+ } else if (link_option(option, "rpath=", &p)) { |
45 |
+ s->rpath = copy_linker_arg(p); |
46 |
+ } else if (link_option(option, "section-alignment=", &p)) { |
47 |
|
48 |
diff --git a/dev-lang/tcc/files/linker.patch b/dev-lang/tcc/files/linker.patch |
49 |
new file mode 100644 |
50 |
index 0000000..01cc723 |
51 |
--- /dev/null |
52 |
+++ b/dev-lang/tcc/files/linker.patch |
53 |
@@ -0,0 +1,18 @@ |
54 |
+# Fix compiling tcc with clang. Upstream commit 73ac39c317a20accaf3b25ba833deee0c2e2849f |
55 |
+# Gentoo bug #502452 |
56 |
+diff --git a/lib/libtcc1.c b/lib/libtcc1.c |
57 |
+index cf9babf..b46fb5d 100644 |
58 |
+--- a/lib/libtcc1.c |
59 |
++++ b/lib/libtcc1.c |
60 |
+@@ -647,6 +647,11 @@ struct __va_list_struct { |
61 |
+ char *reg_save_area; |
62 |
+ }; |
63 |
+ |
64 |
++#undef __va_start |
65 |
++#undef __va_arg |
66 |
++#undef __va_copy |
67 |
++#undef __va_end |
68 |
++ |
69 |
+ void *__va_start(void *fp) |
70 |
+ { |
71 |
+ struct __va_list_struct *ap = |
72 |
|
73 |
diff --git a/dev-lang/tcc/tcc-0.9.26-r3.ebuild b/dev-lang/tcc/tcc-0.9.26-r3.ebuild |
74 |
new file mode 100644 |
75 |
index 0000000..a3b7d56 |
76 |
--- /dev/null |
77 |
+++ b/dev-lang/tcc/tcc-0.9.26-r3.ebuild |
78 |
@@ -0,0 +1,72 @@ |
79 |
+# Copyright 1999-2016 Gentoo Foundation |
80 |
+# Distributed under the terms of the GNU General Public License v2 |
81 |
+# $Id$ |
82 |
+ |
83 |
+EAPI="6" |
84 |
+ |
85 |
+inherit toolchain-funcs |
86 |
+ |
87 |
+DESCRIPTION="A very small C compiler for ix86/amd64" |
88 |
+HOMEPAGE="http://bellard.org/tcc/" |
89 |
+SRC_URI="http://download.savannah.gnu.org/releases/tinycc/${P}.tar.bz2" |
90 |
+ |
91 |
+LICENSE="LGPL-2.1" |
92 |
+SLOT="0" |
93 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux" |
94 |
+ |
95 |
+DEPEND="dev-lang/perl" # doc generation |
96 |
+# Both tendra and tinycc install /usr/bin/tcc |
97 |
+RDEPEND="!dev-lang/tendra" |
98 |
+IUSE="test" |
99 |
+ |
100 |
+src_prepare() { |
101 |
+ # Don't strip |
102 |
+ sed -i -e 's|$(INSTALL) -s|$(INSTALL)|' Makefile || die |
103 |
+ |
104 |
+ # Fix examples |
105 |
+ sed -i -e '1{ |
106 |
+ i#! /usr/bin/tcc -run |
107 |
+ /^#!/d |
108 |
+ }' examples/ex*.c || die |
109 |
+ sed -i -e '1s/$/ -lX11/' examples/ex4.c || die |
110 |
+ |
111 |
+ # Fix texi2html invocation |
112 |
+ sed -i -e 's/-number//' Makefile || die |
113 |
+ sed -i -e 's/--sections//' Makefile || die |
114 |
+ |
115 |
+ # Fix compiling tcc with clang |
116 |
+ eapply "${FILESDIR}"/clang.patch |
117 |
+ |
118 |
+ # Allows using tcc as the system compiler for Gentoo |
119 |
+ eapply "${FILESDIR}"/linker.patch |
120 |
+ |
121 |
+ eapply_user |
122 |
+} |
123 |
+ |
124 |
+src_configure() { |
125 |
+ use test && unset CFLAGS LDFLAGS # Tests run with CC=tcc etc, they will fail hard otherwise |
126 |
+ # better fixes welcome, it feels wrong to hack the env like this |
127 |
+ # not autotools, so call configure directly |
128 |
+ ./configure --cc="$(tc-getCC)" \ |
129 |
+ --prefix="${EPREFIX}/usr" \ |
130 |
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \ |
131 |
+ --docdir="${EPREFIX}/usr/share/doc/${PF}" |
132 |
+} |
133 |
+ |
134 |
+src_compile() { |
135 |
+ emake AR="$(tc-getAR)" |
136 |
+} |
137 |
+ |
138 |
+src_install() { |
139 |
+ emake DESTDIR="${D}" install |
140 |
+ |
141 |
+ dodoc Changelog README TODO VERSION |
142 |
+ #dohtml tcc-doc.html |
143 |
+ exeinto /usr/share/doc/${PF}/examples |
144 |
+ doexe examples/ex*.c |
145 |
+} |
146 |
+ |
147 |
+src_test() { |
148 |
+ # this is using tcc bits that don't know as-needed etc. |
149 |
+ TCCFLAGS="" emake test |
150 |
+} |