Thursday, March 05, 2020

Re: [ports-gcc/all archs] fix lang/hashlink

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/hashlink/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 Makefile
--- Makefile 25 Feb 2020 02:36:47 -0000 1.1.1.1
+++ Makefile 5 Mar 2020 14:42:50 -0000
@@ -9,6 +9,7 @@ V = 1.10
GH_ACCOUNT = HaxeFoundation
GH_PROJECT = hashlink
GH_TAGNAME = ${V}
+REVISION = 0

SHARED_LIBS = hl 0.0 # 1.10

@@ -22,6 +23,10 @@ PERMIT_PACKAGE = Yes
WANTLIB += SDL2 c m mbedcrypto mbedtls mbedx509 openal png pthread
WANTLIB += turbojpeg uv vorbisfile z

+# C11
+COMPILER = base-clang ports-gcc
+COMPILER_LANGS = c
+
LIB_DEPENDS = audio/openal \
devel/libuv \
devel/sdl2 \
@@ -34,6 +39,12 @@ SUBST_VARS += CFLAGS

post-extract:
rm -rf ${WRKSRC}/include/{fmt,turbojpeg}
+ # remove dos line endings
+ cd ${WRKSRC} && perl -i -pe 's/\r$$//' \
+ libs/uv/uv.c \
+ src/hl.h \
+ src/std/socket.c \
+ src/std/thread.c

do-gen:
${SUBST_CMD} ${WRKSRC}/Makefile
Index: patches/patch-libs_uv_uv_c
===================================================================
RCS file: /cvs/ports/lang/hashlink/patches/patch-libs_uv_uv_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-libs_uv_uv_c
--- patches/patch-libs_uv_uv_c 25 Feb 2020 02:36:47 -0000 1.1.1.1
+++ patches/patch-libs_uv_uv_c 5 Mar 2020 14:42:50 -0000
@@ -5,13 +5,14 @@ add stub resolve function
Index: libs/uv/uv.c
--- libs/uv/uv.c.orig
+++ libs/uv/uv.c
-@@ -93,6 +93,9 @@ static void on_write( uv_write_t *wr, int status ) {
- trigger_callb((uv_handle_t*)wr,EVT_WRITE,&args,1,false);
- on_close((uv_handle_t*)wr);
- }
+@@ -94,6 +94,10 @@ static void on_write( uv_write_t *wr, int status ) {
+ on_close((uv_handle_t*)wr);
+ }
+
+HL_PRIM void HL_NAME(resolve)() {
+}
+DEFINE_PRIM(_VOID, resolve, _NO_ARG);
-
- HL_PRIM bool HL_NAME(stream_write)( uv_stream_t *s, vbyte *b, int size, vclosure *c ) {
- uv_write_t *wr = UV_ALLOC(uv_write_t);
++
+ HL_PRIM bool HL_NAME(stream_write)( uv_stream_t *s, vbyte *b, int size, vclosure *c ) {
+ uv_write_t *wr = UV_ALLOC(uv_write_t);
+ events_data *d = init_hl_data((uv_handle_t*)wr);
Index: patches/patch-src_hl_h
===================================================================
RCS file: /cvs/ports/lang/hashlink/patches/patch-src_hl_h,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-src_hl_h
--- patches/patch-src_hl_h 25 Feb 2020 02:36:47 -0000 1.1.1.1
+++ patches/patch-src_hl_h 5 Mar 2020 14:42:50 -0000
@@ -5,12 +5,12 @@ add OpenBSD to ifdef
Index: src/hl.h
--- src/hl.h.orig
+++ src/hl.h
-@@ -234,7 +234,7 @@ typedef uint16_t uchar;
- # define USTR(str) u##str
- #else
- # include <stdarg.h>
--#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC)
-+#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC) || defined(__OpenBSD__)
- #include <stddef.h>
- #include <stdint.h>
- typedef uint16_t char16_t;
+@@ -234,7 +234,7 @@ typedef uint16_t uchar;
+ # define USTR(str) u##str
+ #else
+ # include <stdarg.h>
+-#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC)
++#if defined(HL_IOS) || defined(HL_TVOS) || defined(HL_MAC) || defined(__OpenBSD__)
+ #include <stddef.h>
+ #include <stdint.h>
+ typedef uint16_t char16_t;
Index: patches/patch-src_std_socket_c
===================================================================
RCS file: /cvs/ports/lang/hashlink/patches/patch-src_std_socket_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-src_std_socket_c
--- patches/patch-src_std_socket_c 25 Feb 2020 02:36:47 -0000 1.1.1.1
+++ patches/patch-src_std_socket_c 5 Mar 2020 14:42:50 -0000
@@ -5,12 +5,21 @@ add OpenBSD to ifdef
Index: src/std/socket.c
--- src/std/socket.c.orig
+++ src/std/socket.c
-@@ -192,7 +192,7 @@ HL_PRIM int hl_host_resolve( vbyte *host ) {
- ip = inet_addr((char*)host);
- if( ip == INADDR_NONE ) {
- struct hostent *h;
--# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined (HL_CYGWIN) || defined(HL_CONSOLE)
-+# if defined(HL_WIN) || defined(__OpenBSD__) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined (HL_CYGWIN) || defined(HL_CONSOLE)
- h = gethostbyname((char*)host);
- # else
- struct hostent hbase;
+@@ -192,7 +192,7 @@ HL_PRIM int hl_host_resolve( vbyte *host ) {
+ ip = inet_addr((char*)host);
+ if( ip == INADDR_NONE ) {
+ struct hostent *h;
+-# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined (HL_CYGWIN) || defined(HL_CONSOLE)
++# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined (HL_CYGWIN) || defined(HL_CONSOLE) || defined(__OpenBSD__)
+ h = gethostbyname((char*)host);
+ # else
+ struct hostent hbase;
+@@ -219,7 +219,7 @@ HL_PRIM vbyte *hl_host_to_string( int ip ) {
+ HL_PRIM vbyte *hl_host_reverse( int ip ) {
+ struct hostent *h;
+ hl_blocking(true);
+-# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined(HL_CYGWIN) || defined(HL_CONSOLE)
++# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined(HL_CYGWIN) || defined(HL_CONSOLE) || defined(__OpenBSD__)
+ h = gethostbyaddr((char *)&ip,4,AF_INET);
+ # elif defined(__ANDROID__)
+ hl_error("hl_host_reverse() not available for this platform");
Index: patches/patch-src_std_thread_c
===================================================================
RCS file: /cvs/ports/lang/hashlink/patches/patch-src_std_thread_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-src_std_thread_c
--- patches/patch-src_std_thread_c 25 Feb 2020 02:36:47 -0000 1.1.1.1
+++ patches/patch-src_std_thread_c 5 Mar 2020 14:42:50 -0000
@@ -5,12 +5,12 @@ enable thread_id for OpenBSD using pthre
Index: src/std/thread.c
--- src/std/thread.c.orig
+++ src/std/thread.c
-@@ -370,6 +370,8 @@ HL_PRIM int hl_thread_id() {
- uint64_t tid64;
- pthread_threadid_np(NULL, &tid64);
- return (pid_t)tid64;
+@@ -370,6 +370,8 @@ HL_PRIM int hl_thread_id() {
+ uint64_t tid64;
+ pthread_threadid_np(NULL, &tid64);
+ return (pid_t)tid64;
+#elif defined(__OpenBSD__)
+ return pthread_self();
- #elif defined(SYS_gettid) && !defined(HL_TVOS)
- return syscall(SYS_gettid);
- #else
+ #elif defined(SYS_gettid) && !defined(HL_TVOS)
+ return syscall(SYS_gettid);
+ #else
On Thu, 5 Mar 2020 15:31:18 +0100
Theo Buehler wrote:

> On Thu, Mar 05, 2020 at 01:56:43PM +0100, Charlene Wendling wrote:
> > Hi,
> >
> > > http://build-failures.rhaalovely.net/sparc64/2020-03-01/lang/hashlink.log
> >
> > - C11 requires ports-gcc, so i added COMPILER
>
> This does build on sparc64. Not sure how to test it though, as haxe is
> marked broken.
>
> Shouldn't this set COMPILER_LANGS = c also? At least that's what
> Makefile.template seems to imply:
>
> # Ports that require a non-default compiler that do *not* use C++
> # should set this:
> #COMPILER_LANGS = c

I forgot to test with that in it. It still builds fine, i'm attaching a
modified diff.

> Apart from that your patch looks good to me.
>
> ok tb
>
>
> Further comments for thfr@ below.
>
> > - then the build fails because we don't have gethostbyaddr_r(), so i
> > used the fallback code like it was already the case for other
> > functions. Clang is unhappy as well, but too permissive as usual.
> > - while collecting the patch i have found out that it had DOS line
> > endings, so i fixed all patches that have them. Because of that
> > i'm attaching the diff.
> >
> > Once all that stuff has been done, it builds on powerpc [0] and is
> > still good on amd64.
> >
> > Comments/feedback are welcome :)
>
>
> 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?
>
>
> 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
>

No comments:

Post a Comment