From ea8c5e8f6b77e1a496e4fe86606ec91a07df6764 Mon Sep 17 00:00:00 2001 From: thfr Date: Sat, 11 Apr 2020 09:59:20 +0000 Subject: [PATCH] fix return type for hl_thread_id by switching to getthrid(2) remove unneeded LONG_BIT detection in Makefile ok tb@ for the above also ifdef to hl.h to avoid typedef collision with clang in C++ mode --- lang/hashlink/Makefile | 4 +-- lang/hashlink/patches/patch-Makefile | 27 +++++++++++++++----- lang/hashlink/patches/patch-src_hl_h | 11 ++++++-- lang/hashlink/patches/patch-src_std_thread_c | 6 ++--- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/lang/hashlink/Makefile b/lang/hashlink/Makefile index 779a3b75456..8029cbe0428 100644 --- a/lang/hashlink/Makefile +++ b/lang/hashlink/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2020/03/07 00:30:59 cwen Exp $ +# $OpenBSD: Makefile,v 1.3 2020/04/11 09:59:20 thfr Exp $ # JIT segfaults without USE_WXNEEDED USE_WXNEEDED = Yes @@ -9,7 +9,7 @@ V = 1.10 GH_ACCOUNT = HaxeFoundation GH_PROJECT = hashlink GH_TAGNAME = ${V} -REVISION = 0 +REVISION = 1 SHARED_LIBS = hl 0.0 # 1.10 diff --git a/lang/hashlink/patches/patch-Makefile b/lang/hashlink/patches/patch-Makefile index 6d1185c7766..4832dd20c23 100644 --- a/lang/hashlink/patches/patch-Makefile +++ b/lang/hashlink/patches/patch-Makefile @@ -1,13 +1,19 @@ -$OpenBSD: patch-Makefile,v 1.1.1.1 2020/02/25 02:36:47 thfr Exp $ +$OpenBSD: patch-Makefile,v 1.2 2020/04/11 09:59:20 thfr Exp $ remove -m$(ARCH) add versioning to libhl {CFLAGS} -> (CFLAGS) to not get picked up by SUBST_CMD +remove Linux's 32-/64-bit detection Index: Makefile --- Makefile.orig +++ Makefile -@@ -6,11 +6,11 @@ INSTALL_DIR ?= $(PREFIX) +@@ -1,16 +1,14 @@ + +-LBITS := $(shell getconf LONG_BIT) +-ARCH ?= $(LBITS) + PREFIX ?= /usr/local + INSTALL_DIR ?= $(PREFIX) LIBS=fmt sdl ssl openal ui uv mysql @@ -24,7 +30,7 @@ Index: Makefile LIBTURBOJPEG = -lturbojpeg PCRE = include/pcre/pcre_chartables.o include/pcre/pcre_compile.o include/pcre/pcre_dfa_exec.o \ -@@ -80,7 +80,7 @@ RELEASE_NAME = osx +@@ -80,16 +78,9 @@ RELEASE_NAME = osx else # Linux @@ -32,8 +38,17 @@ Index: Makefile +CFLAGS += -fPIC -pthread LFLAGS += -lm -Wl,-rpath,. -Wl,--export-dynamic -Wl,--no-undefined - ifeq ($(ARCH),32) -@@ -123,34 +123,34 @@ uninstall: +-ifeq ($(ARCH),32) +-CFLAGS += -I /usr/include/i386-linux-gnu +-LIBFLAGS += -L/opt/libjpeg-turbo/lib +-else +-LIBFLAGS += -L/opt/libjpeg-turbo/lib64 +-endif +- + LIBOPENAL = -lopenal + RELEASE_NAME = linux + +@@ -123,34 +114,34 @@ uninstall: libs: $(LIBS) libhl: ${LIB} @@ -78,7 +93,7 @@ Index: Makefile mesa: (cd libs/mesa && make) -@@ -204,7 +204,7 @@ release_osx: +@@ -204,7 +195,7 @@ release_osx: .SUFFIXES : .c .o .c.o : diff --git a/lang/hashlink/patches/patch-src_hl_h b/lang/hashlink/patches/patch-src_hl_h index 7eab6345a83..91794b5abdb 100644 --- a/lang/hashlink/patches/patch-src_hl_h +++ b/lang/hashlink/patches/patch-src_hl_h @@ -1,11 +1,12 @@ -$OpenBSD: patch-src_hl_h,v 1.2 2020/03/07 00:30:59 cwen Exp $ +$OpenBSD: patch-src_hl_h,v 1.3 2020/04/11 09:59:20 thfr Exp $ add OpenBSD to ifdef +don't typedef char{16,32}_t in clang with C++ Index: src/hl.h --- src/hl.h.orig +++ src/hl.h -@@ -234,7 +234,7 @@ typedef uint16_t uchar; +@@ -234,11 +234,13 @@ typedef uint16_t uchar; # define USTR(str) u##str #else # include @@ -13,4 +14,10 @@ Index: src/hl.h +#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC) || defined(__OpenBSD__) #include #include ++#if defined(__clang__) && !defined(__cplusplus) typedef uint16_t char16_t; + typedef uint32_t char32_t; ++#endif + #else + # include + #endif diff --git a/lang/hashlink/patches/patch-src_std_thread_c b/lang/hashlink/patches/patch-src_std_thread_c index cc06959ee09..84ccf70f19e 100644 --- a/lang/hashlink/patches/patch-src_std_thread_c +++ b/lang/hashlink/patches/patch-src_std_thread_c @@ -1,6 +1,6 @@ -$OpenBSD: patch-src_std_thread_c,v 1.2 2020/03/07 00:30:59 cwen Exp $ +$OpenBSD: patch-src_std_thread_c,v 1.3 2020/04/11 09:59:20 thfr Exp $ -enable thread_id for OpenBSD using pthread_self() +enable hl_thread_id for OpenBSD using getthrid(2) Index: src/std/thread.c --- src/std/thread.c.orig @@ -10,7 +10,7 @@ Index: src/std/thread.c pthread_threadid_np(NULL, &tid64); return (pid_t)tid64; +#elif defined(__OpenBSD__) -+ return pthread_self(); ++ return getthrid(); #elif defined(SYS_gettid) && !defined(HL_TVOS) return syscall(SYS_gettid); #else