On Sat, Apr 11, 2020 at 08:40:58AM -0600, Thomas Frohwein wrote: > ping > any comments or suggestions about these issues before I update the port?
I already gave an ok for the getthrid and Makefile change. I haven't thought about or tested the rest. If it works, feel free to go ahead, but I don't feel comfortable okaying this in its entirety. > > On Fri, Apr 03, 2020 at 01:32:18PM -0600, Thomas Frohwein wrote: > > Hi, > > > > diff to tie up some loose ends brought up by tb@ > > > > Also amends the hl.h with an ifdef to fix a typedef collision when > > including the header with clang and C++ that was encountered with > > upcoming addition of hlsteam to games/steamworks-nosteam. Credit for > > the fix to brynet@. > > > > [...] > > > The use of pthread_self() in patches/patch-src_std_thread_c looks fishy. > > > It generates this warning: > > > > > > src/std/thread.c: In function 'hl_thread_id': > > > src/std/thread.c:374:9: warning: returning 'pthread_t' {aka 'struct > > > pthread *'} from a function with return type 'int' makes integer from > > > pointer without a cast > > > [-Wint-conversion] > > > return pthread_self(); > > > ^~~~~~~~~~~~~~ > > > > > > Is this intended and really correct? > > > > It seems the better solution is to replace this with getthrid(2). So > > far, I haven't noticed runtime issues with either pthread_self(3) or > > getthrid(2). The build time warning is resolved with this. > > > > > The second one is ugly but probably harmless: > > > > > > ===> Building for hashlink-1.10p0 > > > getconf: LONG_BIT: unknown variable > > > > > > The Makefile tries to set some arch-specific things using this: > > > > > > LBITS := $(shell getconf LONG_BIT) > > > ARCH ?= $(LBITS) > > > [...] > > > ifeq ($(ARCH),32) > > > CFLAGS += -I /usr/include/i386-linux-gnu > > > LIBFLAGS += -L/opt/libjpeg-turbo/lib > > > else > > > LIBFLAGS += -L/opt/libjpeg-turbo/lib64 > > > endif > > > > diff removes the linux bitness detection. > > > > ok? > > > > Index: Makefile > > =================================================================== > > RCS file: /cvs/ports/lang/hashlink/Makefile,v > > retrieving revision 1.2 > > diff -u -p -r1.2 Makefile > > --- Makefile 7 Mar 2020 00:30:59 -0000 1.2 > > +++ Makefile 3 Apr 2020 19:24:44 -0000 > > @@ -1,4 +1,4 @@ > > -# $OpenBSD: Makefile,v 1.2 2020/03/07 00:30:59 cwen Exp $ > > +# $OpenBSD: Makefile,v 1.1.1.1 2020/02/25 02:36:47 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 > > > > Index: patches/patch-Makefile > > =================================================================== > > RCS file: /cvs/ports/lang/hashlink/patches/patch-Makefile,v > > retrieving revision 1.1.1.1 > > diff -u -p -r1.1.1.1 patch-Makefile > > --- patches/patch-Makefile 25 Feb 2020 02:36:47 -0000 1.1.1.1 > > +++ patches/patch-Makefile 3 Apr 2020 19:24:44 -0000 > > @@ -3,11 +3,17 @@ $OpenBSD: patch-Makefile,v 1.1.1.1 2020/ > > 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 : > > Index: patches/patch-src_hl_h > > =================================================================== > > RCS file: /cvs/ports/lang/hashlink/patches/patch-src_hl_h,v > > retrieving revision 1.2 > > diff -u -p -r1.2 patch-src_hl_h > > --- patches/patch-src_hl_h 7 Mar 2020 00:30:59 -0000 1.2 > > +++ patches/patch-src_hl_h 3 Apr 2020 19:24:44 -0000 > > @@ -1,11 +1,12 @@ > > $OpenBSD: patch-src_hl_h,v 1.2 2020/03/07 00:30:59 cwen 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 > > Index: patches/patch-src_std_thread_c > > =================================================================== > > RCS file: /cvs/ports/lang/hashlink/patches/patch-src_std_thread_c,v > > retrieving revision 1.2 > > diff -u -p -r1.2 patch-src_std_thread_c > > --- patches/patch-src_std_thread_c 7 Mar 2020 00:30:59 -0000 1.2 > > +++ patches/patch-src_std_thread_c 3 Apr 2020 19:24:44 -0000 > > @@ -1,6 +1,6 @@ > > $OpenBSD: patch-src_std_thread_c,v 1.2 2020/03/07 00:30:59 cwen 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 > >