summaryrefslogtreecommitdiff
path: root/dev-lang
diff options
context:
space:
mode:
authorBertrand Jacquin <beber@meleeweb.net>2013-05-27 22:24:26 +0200
committerBertrand Jacquin <beber@meleeweb.net>2013-05-27 22:56:57 +0200
commitf2ad54b453679d281f64e0ecfc5a04f5219d8439 (patch)
tree86ed4af4caecead48fd0b4f3117311fe96638605 /dev-lang
parentAdd perl module VMware-vSphere-Perl-SDK (diff)
downloadportage-f2ad54b453679d281f64e0ecfc5a04f5219d8439.tar.xz
dev-lang: add a live ebuild for tcc which bring support for pthread
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/tcc/Manifest6
-rw-r--r--dev-lang/tcc/files/0001-tcc-Linux-pthread-option-sets-D_REENTRANT-and-lpthre.patch54
-rw-r--r--dev-lang/tcc/files/0002-tcc.c-skip-lpthread-when-c-option-specified.patch29
-rw-r--r--dev-lang/tcc/files/0003-tcc.c-fix-an-error-when-you-build-an-object-file-wit.patch70
-rw-r--r--dev-lang/tcc/files/tcc-0.9.25-flags.patch83
-rw-r--r--dev-lang/tcc/files/tcc-9999-XCC-to-CC.diff18
-rw-r--r--dev-lang/tcc/tcc-9999.ebuild49
7 files changed, 309 insertions, 0 deletions
diff --git a/dev-lang/tcc/Manifest b/dev-lang/tcc/Manifest
new file mode 100644
index 00000000..afdb2d84
--- /dev/null
+++ b/dev-lang/tcc/Manifest
@@ -0,0 +1,6 @@
+AUX 0001-tcc-Linux-pthread-option-sets-D_REENTRANT-and-lpthre.patch 2022 SHA256 467a56857d975018180423342380cb677703b609085971d2273307d4b5169835 SHA512 5837e44ceb071fc9124a51bab26a9605a304c1cf7c94ee82638d8c5e2f85264feaad6661b51460d4cc5a75cd4f3200711e8bc74b6e853d396c7c3e7aaffa6391 WHIRLPOOL 9fbf76c97c35fe7cd96e3079c2e70a8d865a967671efd0ad7dc1ccc65470689f3c2ca41edaf7e8f8a6ecdd87825e9a6d45b8211e4fe98e9c7a6d4125abbb926f
+AUX 0002-tcc.c-skip-lpthread-when-c-option-specified.patch 1001 SHA256 4f747885c1d75527df42b099411717fb39b3490e6665cfba77ee68e900a857dc SHA512 e35afb3f59f29ac9fa12bd4f2943a81d0cc1264b52b8fd804d9726787bfb2fd88a5b161019ba433f331525a3b862d2957f21787c1551ce62489b5ba05f034a09 WHIRLPOOL c6a566fdd83e0fc7d956e96febca956b1cbd2d48c550c6bec6b34458842f785c7f4c0d0c3207f8936823eb66a3f8055263507ba7edbb5f6c240dadd79bd58bd5
+AUX 0003-tcc.c-fix-an-error-when-you-build-an-object-file-wit.patch 2190 SHA256 37da085e7712a8ad9b9c338e767e231d2ae1dbaa54eee2a602f0eecce3d15f5d SHA512 eb433a7454b03fb43269c46f42de3c94e45d53d8c3602cb4c72366d2db70c68f760a9d9b5e01163b0c90f19464c7aa5d4fe29bc626640b713ac8a0e356f5dc6d WHIRLPOOL ff53df953feeadbeab892c6a391de3c554486b65543de76d324a87063656eae93220f08c3b581fbc60f21d6854849d9a2881e00bcaa8e60d1b47dd4e472a254a
+AUX tcc-0.9.25-flags.patch 2768 SHA256 91011cc843a7563bc91ca71e9bcc8dcd95102d370b276b266f12a64ddd705070 SHA512 7a511fd2bbc9263b92cc5171ba1c1518b98db13d051246a9183e578b53e0b1d5598e34bda0e8ac368adc3fa8378fa27b5c3dae74e847fc49739b12adf1c553c3 WHIRLPOOL 97079b179a686c645a46163c11fe6229dfd4b3d77c07c3b24fcf77c71484a9a881abfebbc78915ba4f71aefd873e3c59ee25750e545c2c01fc552c4d4ba23f58
+AUX tcc-9999-XCC-to-CC.diff 401 SHA256 2a1333397ce45df2523dc5815179a572ee5c4ef0a54afc45eb976443c26da43b SHA512 86951a2f123e825ab86134ce60d13987a2addaa572a0d6598ae2ca2903ce8bc1b7e69c29c8f2beba515a7c07f1b4ade9cb3ffb11d1679a50aae3be6ba2c02efe WHIRLPOOL 91f0c24d1a93ec53830f2477607c59f0db9200470d66ab6d8df569a3db6ceee992699b30e5cba7a5799875077998bc4f23713f88d2f7fc3add5566c47a3e3e53
+EBUILD tcc-9999.ebuild 992 SHA256 8277ddd4f2b236819d43d20fd8f4d18c4b0788f618750ea9e8ed1210e122fe5e SHA512 c7f07905e0c9b60025babcb7600d1e27b7bec17b93f2d167393ecf4263b7f5f0876d010dd19182c2336415cb6b82ceb3e75530c4b1fede55cf66c08171700c88 WHIRLPOOL 28e33ba662a18e407acc04f6a3053869993451bfceb10320a257df96892057f8de785d34f147570899cb4131cbeb0d6cbb260e828bbe3b44dba831b3d71d5ef9
diff --git a/dev-lang/tcc/files/0001-tcc-Linux-pthread-option-sets-D_REENTRANT-and-lpthre.patch b/dev-lang/tcc/files/0001-tcc-Linux-pthread-option-sets-D_REENTRANT-and-lpthre.patch
new file mode 100644
index 00000000..7810f9d9
--- /dev/null
+++ b/dev-lang/tcc/files/0001-tcc-Linux-pthread-option-sets-D_REENTRANT-and-lpthre.patch
@@ -0,0 +1,54 @@
+From 9036c18170ce5fdf386ef7f19b81e852b0a7b3e8 Mon Sep 17 00:00:00 2001
+From: Henry Kroll III <henry@comptune.com>
+Date: Wed, 24 Nov 2010 16:42:08 -0800
+Subject: [PATCH 1/1] tcc: Linux -pthread option sets -D_REENTRANT and
+ -lpthread
+
+---
+ tcc.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/tcc.c b/tcc.c
+index da65e24..969e022 100644
+--- a/tcc.c
++++ b/tcc.c
+@@ -61,6 +61,7 @@ static void help(void)
+ "Linker options:\n"
+ " -Ldir add library path 'dir'\n"
+ " -llib link with dynamic or static library 'lib'\n"
++ " -pthread link with -lpthread and -D_REENTRANT (POSIX Linux)\n"
+ " -shared generate a shared library\n"
+ " -soname set name for shared library to be used at runtime\n"
+ " -static static linking\n"
+@@ -113,6 +114,7 @@ enum {
+ TCC_OPTION_nostdlib,
+ TCC_OPTION_print_search_dirs,
+ TCC_OPTION_rdynamic,
++ TCC_OPTION_pthread,
+ TCC_OPTION_run,
+ TCC_OPTION_v,
+ TCC_OPTION_w,
+@@ -146,6 +148,7 @@ static const TCCOption tcc_options[] = {
+ { "shared", TCC_OPTION_shared, 0 },
+ { "soname", TCC_OPTION_soname, TCC_OPTION_HAS_ARG },
+ { "o", TCC_OPTION_o, TCC_OPTION_HAS_ARG },
++ { "pthread", TCC_OPTION_pthread, 0},
+ { "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
+ { "rdynamic", TCC_OPTION_rdynamic, 0 },
+ { "r", TCC_OPTION_r, 0 },
+@@ -293,6 +296,12 @@ static int parse_args(TCCState *s, int argc, char **argv)
+ dynarray_add((void ***)&files, &nb_files, r);
+ nb_libraries++;
+ break;
++ case TCC_OPTION_pthread:
++/* fixme: these options could be different on your platform */
++ dynarray_add((void ***)&files, &nb_files, "-lpthread");
++ nb_libraries++;
++ tcc_define_symbol(s, "_REENTRANT", "1");
++ break;
+ case TCC_OPTION_bench:
+ do_bench = 1;
+ break;
+--
+1.8.0.2
+
diff --git a/dev-lang/tcc/files/0002-tcc.c-skip-lpthread-when-c-option-specified.patch b/dev-lang/tcc/files/0002-tcc.c-skip-lpthread-when-c-option-specified.patch
new file mode 100644
index 00000000..30a7d6e3
--- /dev/null
+++ b/dev-lang/tcc/files/0002-tcc.c-skip-lpthread-when-c-option-specified.patch
@@ -0,0 +1,29 @@
+From 9e406656c739f67e5fdf8b115da40b8381b9286b Mon Sep 17 00:00:00 2001
+From: Henry Kroll III <henry@comptune.com>
+Date: Tue, 30 Nov 2010 13:58:18 -0800
+Subject: [PATCH 1/1] tcc.c: skip -lpthread when -c option specified
+
+---
+ tcc.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/tcc.c b/tcc.c
+index 969e022..6bd4ca1 100644
+--- a/tcc.c
++++ b/tcc.c
+@@ -298,8 +298,10 @@ static int parse_args(TCCState *s, int argc, char **argv)
+ break;
+ case TCC_OPTION_pthread:
+ /* fixme: these options could be different on your platform */
+- dynarray_add((void ***)&files, &nb_files, "-lpthread");
+- nb_libraries++;
++ if(output_type != TCC_OUTPUT_OBJ){
++ dynarray_add((void ***)&files, &nb_files, "-lpthread");
++ nb_libraries++;
++ }
+ tcc_define_symbol(s, "_REENTRANT", "1");
+ break;
+ case TCC_OPTION_bench:
+--
+1.8.0.2
+
diff --git a/dev-lang/tcc/files/0003-tcc.c-fix-an-error-when-you-build-an-object-file-wit.patch b/dev-lang/tcc/files/0003-tcc.c-fix-an-error-when-you-build-an-object-file-wit.patch
new file mode 100644
index 00000000..8988d39f
--- /dev/null
+++ b/dev-lang/tcc/files/0003-tcc.c-fix-an-error-when-you-build-an-object-file-wit.patch
@@ -0,0 +1,70 @@
+From 0a50e6c933cb3d470494c203e90808cef6873b06 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <st@anti-virus.by>
+Date: Tue, 4 Jan 2011 11:17:52 +0200
+Subject: [PATCH 1/1] tcc.c: fix an error when you build an object file with
+ '-pthread' key set
+
+The problem was partially fixed by Henry in the following patch:
+
+ tcc.c: skip -lpthread when -c option specified
+
+But that patch had one brawback: it is sensitive to argument order,
+as decision is taken during commandline parsing:
+
+ $ tcc -c a.c -o a.o -pthread # 1. works fine
+ tcc: error: file 'a.c' not found
+
+ $ tcc -pthread -c a.c -o a.o # 2. blows
+ tcc: error: cannot specify libraries with -c
+
+This patch fixes case 2.
+
+Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
+---
+ tcc.c | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/tcc.c b/tcc.c
+index 3c70f73..e0d6386 100644
+--- a/tcc.c
++++ b/tcc.c
+@@ -294,6 +294,9 @@ static int parse_args(TCCState *s, int argc, char **argv)
+ const TCCOption *popt;
+ const char *optarg, *p1, *r1;
+ char *r;
++ int was_pthread;
++
++ was_pthread = 0; /* is set if commandline contains -pthread key */
+
+ optind = 0;
+ while (optind < argc) {
+@@ -375,11 +378,7 @@ static int parse_args(TCCState *s, int argc, char **argv)
+ nb_libraries++;
+ break;
+ case TCC_OPTION_pthread:
+- /* fixme: these options could be different on your platform */
+- if(output_type != TCC_OUTPUT_OBJ){
+- dynarray_add((void ***)&files, &nb_files, "-lpthread");
+- nb_libraries++;
+- }
++ was_pthread = 1;
+ tcc_define_symbol(s, "_REENTRANT", "1");
+ break;
+ case TCC_OPTION_bench:
+@@ -494,6 +493,13 @@ static int parse_args(TCCState *s, int argc, char **argv)
+ }
+ }
+ }
++ /* fixme: these options could be different on your platform */
++ if (was_pthread
++ && output_type != TCC_OUTPUT_OBJ)
++ {
++ dynarray_add((void ***)&files, &nb_files, "-lpthread");
++ nb_libraries++;
++ }
+ return optind + 1;
+ }
+
+--
+1.8.0.2
+
diff --git a/dev-lang/tcc/files/tcc-0.9.25-flags.patch b/dev-lang/tcc/files/tcc-0.9.25-flags.patch
new file mode 100644
index 00000000..42ac9f3b
--- /dev/null
+++ b/dev-lang/tcc/files/tcc-0.9.25-flags.patch
@@ -0,0 +1,83 @@
+diff --git a/Makefile b/Makefile
+index 1a2b5f7..30526b2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -115,32 +115,32 @@ all: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc-doc.html tcc.1 libtcc_test$(EX
+
+ # Host Tiny C Compiler
+ tcc$(EXESUF): $(NATIVE_FILES)
+- $(CC) -o $@ $< $(NATIVE_TARGET) $(CFLAGS) $(LIBS)
++ $(CC) -o $@ $(NATIVE_TARGET) $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ # Cross Tiny C Compilers
+ i386-tcc$(EXESUF): $(I386_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_I386 $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_I386 $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ i386-win32-tcc$(EXESUF): $(WIN32_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_PE $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_PE $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ x86_64-tcc$(EXESUF): $(X86_64_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_X86_64 $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_X86_64 $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ c67-tcc$(EXESUF): $(C67_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_C67 $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_C67 $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ arm-tcc-fpa$(EXESUF): $(ARM_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_ARM $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_ARM $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ arm-tcc-fpa-ld$(EXESUF): $(ARM_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12 $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12 $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ arm-tcc-vfp$(EXESUF): $(ARM_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_ARM -DTCC_ARM_VFP $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_ARM -DTCC_ARM_VFP $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ arm-tcc-vfp-eabi$(EXESUF): $(ARM_FILES)
+- $(CC) -o $@ $< -DTCC_TARGET_ARM -DTCC_ARM_EABI $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -DTCC_TARGET_ARM -DTCC_ARM_EABI $(CFLAGS) $(LDFLAGS) $< $(LIBS)
+
+ # libtcc generation and test
+ libtcc.o: $(NATIVE_FILES)
+@@ -150,14 +150,14 @@ libtcc.a: libtcc.o
+ $(AR) rcs $@ $^
+
+ libtcc_test$(EXESUF): tests/libtcc_test.c libtcc.a
+- $(CC) -o $@ $^ -I. $(CFLAGS) $(LIBS)
++ $(CC) -o $@ -I. $(CFLAGS) $(LDFLAGS) $^ $(LIBS)
+
+ libtest: libtcc_test$(EXESUF) $(LIBTCC1)
+ ./libtcc_test$(EXESUF) lib_path=.
+
+ # profiling version
+ tcc_p$(EXESUF): $(NATIVE_FILES)
+- $(CC) -o $@ $< $(NATIVE_TARGET) $(CFLAGS_P) $(LIBS_P)
++ $(CC) -o $@ $(NATIVE_TARGET) $(CFLAGS_P) $(LDFLAGS) $< $(LIBS_P)
+
+ # windows utilities
+ tiny_impdef$(EXESUF): win32/tools/tiny_impdef.c
+@@ -180,16 +180,16 @@ LIBTCC1_OBJS+=alloca86.o alloca86-bt.o
+ endif
+
+ %.o: %.c
+- $(LIBTCC1_CC) -o $@ -c $< -O2 -Wall
++ $(LIBTCC1_CC) $(CFLAGS) -c $< -o $@
+
+ %.o: %.S
+- $(LIBTCC1_CC) -o $@ -c $<
++ $(LIBTCC1_CC) $(ASFLAGS) -c $< -o $@
+
+ libtcc1.a: $(LIBTCC1_OBJS)
+ $(AR) rcs $@ $^
+
+ bcheck.o: bcheck.c
+- $(CC) -o $@ -c $< -O2 -Wall
++ $(CC) $(CFLAGS) -c $< -o $@
+
+ # install
+ TCC_INCLUDES = stdarg.h stddef.h stdbool.h float.h varargs.h tcclib.h
diff --git a/dev-lang/tcc/files/tcc-9999-XCC-to-CC.diff b/dev-lang/tcc/files/tcc-9999-XCC-to-CC.diff
new file mode 100644
index 00000000..a59e21b7
--- /dev/null
+++ b/dev-lang/tcc/files/tcc-9999-XCC-to-CC.diff
@@ -0,0 +1,18 @@
+--- lib/Makefile.ori 2012-12-19 18:41:33.755986354 +0100
++++ lib/Makefile 2012-12-19 18:41:51.176365403 +0100
+@@ -16,13 +16,13 @@
+ ifeq ($(ARCH),i386)
+ TARGET = i386
+ ifneq ($(TARGETOS),Darwin)
+- XCC = gcc -O2 -m32
++ XCC = $(CC) -O2 -m32
+ endif
+ else
+ ifeq ($(ARCH),x86-64)
+ TARGET = x86_64
+ ifneq ($(TARGETOS),Darwin)
+- XCC = gcc -O2 -m64
++ XCC = $(CC) -O2 -m64
+ endif
+ endif
+ endif
diff --git a/dev-lang/tcc/tcc-9999.ebuild b/dev-lang/tcc/tcc-9999.ebuild
new file mode 100644
index 00000000..0ad2d7e4
--- /dev/null
+++ b/dev-lang/tcc/tcc-9999.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils toolchain-funcs git-2
+
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+DESCRIPTION="A very small C compiler for ix86/amd64"
+HOMEPAGE="http://bellard.org/tcc/"
+LICENSE="LGPL-2.1"
+SLOT="0"
+
+DEPEND=""
+# Both tendra and tinycc install /usr/bin/tcc
+RDEPEND="!dev-lang/tendra"
+
+EGIT_REPO_URI="git://repo.or.cz/tinycc.git"
+EGIT_COMMIT="HEAD"
+
+# Testsuite is broken, relies on gcc to compile
+# invalid C code that it no longer accepts
+RESTRICT="test"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PF}-XCC-to-CC.diff
+}
+
+src_configure() {
+ local myopts
+
+ use x86 && myopts="--cpu=x86"
+ use amd64 && myopts="--cpu=x86-64"
+ use mips && myopts="--cpu=mips"
+
+ econf ${myopts} --cc="$(tc-getCC)"
+}
+
+src_install() {
+ emake install DESTDIR="${D}"
+
+ dodoc Changelog README TODO VERSION
+ use doc && dohtml tcc-doc.html
+ exeinto /usr/share/doc/${PF}/examples
+ doexe examples/ex*.c
+}