Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2024 07:36:56 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: cfdad59b52e2 - main - net/usockets: Fix build
Message-ID:  <202401220736.40M7aufb008736@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cfdad59b52e23763719685bda5d58ed9c8371318

commit cfdad59b52e23763719685bda5d58ed9c8371318
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-01-22 07:35:50 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-01-22 07:36:54 +0000

    net/usockets: Fix build
    
    -fPIC was missing in some cases, and this was somehow flying on 14
    but was failing on 15.
    
    Reported by:    fallout
---
 net/usockets/Makefile                      |  3 ++-
 net/usockets/files/patch-Makefile          | 20 +++-----------------
 net/usockets/files/patch-tests_sni__test.c | 15 +++++++++++++++
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/net/usockets/Makefile b/net/usockets/Makefile
index 56edca8f7ce5..0fecfee0aa8d 100644
--- a/net/usockets/Makefile
+++ b/net/usockets/Makefile
@@ -20,6 +20,7 @@ GH_ACCOUNT=	uNetworking
 GH_PROJECT=	uSockets
 
 MAKE_ARGS=	WITH_OPENSSL=1
+CXXFLAGS+=	-fPIC
 
 ALL_TARGET=	default
 
@@ -32,7 +33,7 @@ do-install:
 
 do-test: # tests fail to compile: https://github.com/uNetworking/uSockets/issues/213
 	cd ${WRKSRC} && \
-		${CXX} -o test tests/sni_test.c ${STAGEDIR}${PREFIX}/lib/libuSockets.so && \
+		${CC} ${CFLAGS} -o test tests/sni_test.c ${STAGEDIR}${PREFIX}/lib/libuSockets.so && \
 		./test
 
 .include <bsd.port.mk>
diff --git a/net/usockets/files/patch-Makefile b/net/usockets/files/patch-Makefile
index feba3bb79842..1a326b309bd0 100644
--- a/net/usockets/files/patch-Makefile
+++ b/net/usockets/files/patch-Makefile
@@ -1,25 +1,11 @@
 --- Makefile.orig	2023-12-28 02:58:25 UTC
 +++ Makefile
-@@ -77,18 +77,18 @@ ifeq ($(WITH_ASIO),1)
- 	$(CC) $(CFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c src/io_uring/*.c
- # Also link in Boost Asio support
- ifeq ($(WITH_ASIO),1)
--	$(CXX) $(CXXFLAGS) -Isrc -std=c++14 -flto -O3 -c src/eventing/asio.cpp
-+	$(CXX) $(CXXFLAGS) -Isrc -fPIC -std=c++14 -flto -O3 -c src/eventing/asio.cpp
- endif
- 
- # For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11
- ifeq ($(WITH_OPENSSL),1)
--	$(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
-+	$(CXX) $(CXXFLAGS) -fPIC -std=c++17 -flto -O3 -c src/crypto/*.cpp
- endif
- ifeq ($(WITH_BORINGSSL),1)
--	$(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
-+	$(CXX) $(CXXFLAGS) -fPIC -std=c++17 -flto -O3 -c src/crypto/*.cpp
+@@ -88,7 +88,7 @@ endif
+ 	$(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp
  endif
  # Create a static library (try windows, then unix)
 -	lib.exe /out:uSockets.a *.o || $(AR) rvs uSockets.a *.o
-+	lib.exe /out:uSockets.a *.o || $(CXX) -shared -o libuSockets.so *.o -lssl
++	$(CXX) -shared -o libuSockets.so *.o -lssl
  
  # BoringSSL needs cmake and golang
  .PHONY: boringssl
diff --git a/net/usockets/files/patch-tests_sni__test.c b/net/usockets/files/patch-tests_sni__test.c
new file mode 100644
index 000000000000..6b12040160cd
--- /dev/null
+++ b/net/usockets/files/patch-tests_sni__test.c
@@ -0,0 +1,15 @@
+--- tests/sni_test.c.orig	2024-01-22 07:32:06 UTC
++++ tests/sni_test.c
+@@ -1,10 +1,10 @@
+-extern "C" {
++//extern "C" {
+ void *sni_new();
+ void sni_free(void *sni, void (*cb)(void *user));
+ int sni_add(void *sni, const char *hostname, void *user);
+ void *sni_remove(void *sni, const char *hostname);
+ void *sni_find(void *sni, const char *hostname);
+-}
++//}
+ 
+ #include <assert.h>
+ #include <stdio.h>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401220736.40M7aufb008736>