add recipe for tcc.

This commit is contained in:
Adrien Destugues
2014-08-09 18:57:58 +02:00
parent 55143417e6
commit 50ebacc642
2 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
From 33b1dca76db5ab527a0cb441dd70b27c339dafca Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 9 Aug 2014 18:44:13 +0200
Subject: Add Haiku support.
diff --git a/Makefile b/Makefile
index 705b585..bcf562e 100644
--- a/Makefile
+++ b/Makefile
@@ -36,12 +36,12 @@ ifdef CONFIG_WIN64
CONFIG_WIN32=yes
endif
-ifndef CONFIG_WIN32
-LIBS=-lm
-ifndef CONFIG_NOLDL
-LIBS+=-ldl
-endif
-endif
+#ifndef CONFIG_WIN32
+#LIBS=-lm
+#ifndef CONFIG_NOLDL
+#LIBS+=-ldl
+#endif
+#endif
# make libtcc as static or dynamic library?
ifdef DISABLE_STATIC
diff --git a/lib/bcheck.c b/lib/bcheck.c
index 54124b9..7af69ff 100644
--- a/lib/bcheck.c
+++ b/lib/bcheck.c
@@ -42,7 +42,7 @@
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|| defined(__DragonFly__) || defined(__dietlibc__) \
|| defined(__UCLIBC__) || defined(__OpenBSD__) \
- || defined(_WIN32) || defined(TCC_UCLIBC)
+ || defined(_WIN32) || defined(TCC_UCLIBC) || defined(__HAIKU__)
#warning Bound checking does not support malloc (etc.) in this environment.
#undef CONFIG_TCC_MALLOC_HOOKS
#undef HAVE_MEMALIGN
diff --git a/tccrun.c b/tccrun.c
index 50178a8..c67bebb 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -481,7 +481,7 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
*paddr = uc->uc_mcontext->__ss.__eip;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
*paddr = uc->uc_mcontext.mc_eip;
-#elif defined(__dietlibc__)
+#elif defined(__dietlibc__) || defined(__HAIKU__)
*paddr = uc->uc_mcontext.eip;
#else
*paddr = uc->uc_mcontext.gregs[REG_EIP];
@@ -492,7 +492,7 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
fp = uc->uc_mcontext->__ss.__ebp;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
fp = uc->uc_mcontext.mc_ebp;
-#elif defined(__dietlibc__)
+#elif defined(__dietlibc__) || defined(__HAIKU__)
fp = uc->uc_mcontext.ebp;
#else
fp = uc->uc_mcontext.gregs[REG_EBP];
--
1.8.3.4

View File

@@ -0,0 +1,65 @@
SUMMARY="A small and fast C compiler"
DESCRIPTION="* SMALL! You can compile and execute C code everywhere, for \
example on rescue disks (about 100KB for x86 TCC executable, including C \
preprocessor, C compiler, assembler and linker).
* FAST! tcc generates x86 code. No byte code overhead. Compile, assemble and \
link several times faster than GCC.
* UNLIMITED! Any C dynamic library can be used directly. TCC is heading \
torward full ISOC99 compliance. TCC can of course compile itself.
* SAFE! tcc includes an optional memory and bound checker. Bound checked code \
can be mixed freely with standard code.
* Compile and execute C source directly. No linking or assembly necessary. \
Full C preprocessor and GNU-like assembler included.
* C script supported : just add '#!/usr/local/bin/tcc -run' at the first line \
of your C source, and execute it directly from the command line.
* With libtcc, you can use TCC as a backend for dynamic code generation.
"
SRC_URI="http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.26.tar.bz2"
CHECKSUM_SHA256="521e701ae436c302545c3f973a9c9b7e2694769c71d9be10f70a2460705b6d71"
PATCHES="tcc-$portVersion.patchset"
HOMEPAGE="http://bellard.org/tcc/"
REVISION="1"
ARCHITECTURES="x86_gcc2"
COPYRIGHT="2001-2014 Fabrice Bellard"
LICENSE="GNU LGPL v2"
PROVIDES="
tcc = $portVersion
cmd:arm_eabi_tcc
cmd:arm_fpa_ld_tcc
cmd:arm_fpa_tcc
cmd:arm_vfp_tcc
cmd:c67_tcc
cmd:i386_win32_tcc
cmd:tcc
cmd:x86_64_tcc
cmd:x86_64_win32_tcc
"
REQUIRES="
haiku >= $haikuVersion
"
BUILD_PREREQUIRES="
haiku_devel >= $haikuVersion
cmd:gcc
cmd:make
"
PROVIDES_devel="
devel:libtcc
"
BUILD()
{
runConfigure ./configure --enable-cross
make $jobArgs
}
INSTALL()
{
make install
prepareInstalledDevelLib libtcc
packageEntries devel $developDir
}