Files
haikuports/dev-lang/tcc/patches/tcc-0.9.26.patchset
alaviss a0fdf8cf1f Add TEST() to various ports (#1832)
* app-crypt/rhash: disable on x86_gcc2, also fixed secondary arch

* dev-lang/tcc: make tcc actually works

  - update patches: define custom haiku definitions, use haiku
    start/end objects

  - make tcc uses haiku custom paths

  - add secondary arch support
  - add x86_64

* dev-lang/tcc: disable on all architectures

  - Haiku's BeBuild.h depends on __GNUC__ macro to select ABI, which
    unfortunately we can't risk to define, so disabling for now

* dev-python/pyqt: use correct name for sip

* dev-lang/spidermonkey: fix build

  - add x86 to snd arch

  - update config.sub and config.guess

  - add missing cmd:js_config
  - add missing cmd:zip

* dev-python/pyqt: clean up the spaces left by previous contributor

* add TEST() for the following ports:
  - sys-devel/flex
  - app-crypt/rhash
  - app-text/podofo
  - app-crypt/qca
  - app-editors/retext
  - app-i18n/mozc
  - dev-lang/tcc
  - dev-lang/yasm
  - dev-lang/spidermonkey
  - dev-libs/glib
  - dev-libs/jsoncpp
  - dev-libs/libtommath
  - dev-libs/libxslt
  - dev-libs/libyajl
  - dev-libs/zziplib
2017-12-10 13:49:50 +01:00

186 lines
4.9 KiB
Plaintext

From a728c4e0a15d3822cfb283a4764c2d01018a788a 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];
--
2.7.0
From 47578a5c04b702ee055ced9dcd29f5eb7f1b2165 Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Sun, 3 Dec 2017 11:51:08 +0700
Subject: tcc.h: ucontext_t is in <signal.h>
diff --git a/tcc.h b/tcc.h
index 2c2936c..ec75502 100644
--- a/tcc.h
+++ b/tcc.h
@@ -43,7 +43,11 @@
#ifndef _WIN32
# include <unistd.h>
# include <sys/time.h>
-# include <sys/ucontext.h>
+# ifndef __HAIKU__
+# include <sys/ucontext.h>
+# else
+# include <signal.h>
+# endif
# include <sys/mman.h>
# ifndef CONFIG_TCC_STATIC
# include <dlfcn.h>
--
2.7.0
From 99dfbd1a1ea61dd7a2fa6b2a64b4f3cef082d3c2 Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Sun, 3 Dec 2017 11:52:06 +0700
Subject: libtcc: add support for haiku start files
diff --git a/libtcc.c b/libtcc.c
index af0fb7f..e5d12bb 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1346,8 +1346,15 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
if ((output_type == TCC_OUTPUT_EXE || output_type == TCC_OUTPUT_DLL) &&
!s->nostdlib) {
if (output_type != TCC_OUTPUT_DLL)
+# ifdef __HAIKU__
+ tcc_add_crt(s, "start_dyn.o");
+# else
tcc_add_crt(s, "crt1.o");
+# endif
tcc_add_crt(s, "crti.o");
+# ifdef __HAIKU__
+ tcc_add_crt(s, "init_term_dyn.o");
+# endif
}
#endif
return 0;
--
2.7.0
From ddb0f5247fd5d09647154fe15000c2b74112f77e Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Sun, 3 Dec 2017 11:52:50 +0700
Subject: tccelf: haiku use libroot instead of libc
diff --git a/tccelf.c b/tccelf.c
index 500ea18..bdc4c9c 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1360,7 +1360,11 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
/* add libc */
if (!s1->nostdlib) {
+#ifdef __HAIKU__
+ tcc_add_library(s1, "root");
+#else
tcc_add_library(s1, "c");
+#endif
#ifdef CONFIG_USE_LIBGCC
tcc_add_file(s1, TCC_LIBGCC);
#elif !defined WITHOUT_LIBTCC
--
2.7.0
From a7a81c2967a49730c1d55c54e2d80022aad959ac Mon Sep 17 00:00:00 2001
From: Leorize <alaviss@users.noreply.github.com>
Date: Sun, 3 Dec 2017 17:31:00 +0700
Subject: libtcc: define Haiku specific macros
diff --git a/libtcc.c b/libtcc.c
index e5d12bb..0660c51 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -930,6 +930,10 @@ LIBTCCAPI TCCState *tcc_new(void)
tcc_define_symbol(s, "__i386__", NULL);
tcc_define_symbol(s, "__i386", NULL);
tcc_define_symbol(s, "i386", NULL);
+# if defined(__HAIKU__)
+ tcc_define_symbol(s, "__INTEL__", NULL);
+ tcc_define_symbol(s, "__X86__", NULL);
+# endif
#elif defined(TCC_TARGET_X86_64)
tcc_define_symbol(s, "__x86_64__", NULL);
#elif defined(TCC_TARGET_ARM)
@@ -964,6 +968,9 @@ LIBTCCAPI TCCState *tcc_new(void)
# if defined(__FreeBSD_kernel__)
tcc_define_symbol(s, "__FreeBSD_kernel__", NULL);
# endif
+# if defined(__HAIKU__)
+ tcc_define_symbol(s, "__HAIKU__", NULL);
+# endif
#endif
/* TinyCC & gcc defines */
--
2.7.0