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
This commit is contained in:
thfr 2020-04-11 09:59:20 +00:00
parent e12c949d2f
commit ea8c5e8f6b
4 changed files with 35 additions and 13 deletions

View File

@ -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

View File

@ -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 :

View File

@ -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 <stdarg.h>
@ -13,4 +14,10 @@ Index: src/hl.h
+#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC) || defined(__OpenBSD__)
#include <stddef.h>
#include <stdint.h>
+#if defined(__clang__) && !defined(__cplusplus)
typedef uint16_t char16_t;
typedef uint32_t char32_t;
+#endif
#else
# include <uchar.h>
#endif

View File

@ -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