git: 4a22b45b87f6 - main - net/iwnet: attempt to fix the port's build on -CURRENT

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Sun, 08 May 2022 07:34:55 UTC
The branch main has been updated by danfe:

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

commit 4a22b45b87f60f58577dc99cbaaf6a7351188573
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-05-08 07:33:58 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-05-08 07:33:58 +0000

    net/iwnet: attempt to fix the port's build on -CURRENT
    
    Lack of MALLOC_PRODUCTION exposed forgotten uninitialized pointer in
    hash table generator which caused segmentation fault during the build.
    Pull another upstream patch which might mitigate the races of CMake's
    custom commands.
    
    While here, don't forcibly insert our CFLAGS, they would get appended
    at the later stage automagically.
    
    Reported by:    pkg-fallout
---
 net/iwnet/Makefile                       | 6 ++++++
 net/iwnet/files/patch-src_CMakeLists.txt | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/iwnet/Makefile b/net/iwnet/Makefile
index b16a0ea17c25..373f7345cb8e 100644
--- a/net/iwnet/Makefile
+++ b/net/iwnet/Makefile
@@ -22,6 +22,12 @@ CMAKE_ARGS=	-DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_TESTS:BOOL=ON
 
 OPTIONS_DEFINE=	DOCS
 
+post-patch:
+	@${REINPLACE_CMD} -e '/USES_TERMINAL/d' \
+		${WRKSRC}/tools/CMakeLists.txt
+	@${REINPLACE_CMD} -e '51s:malloc(:calloc(1, :' \
+		${WRKSRC}/tools/mimegen.c
+
 do-test:
 	@cd ${TEST_WRKSRC} && ctest -C ${CMAKE_BUILD_TYPE} ${_MAKE_JOBS}
 
diff --git a/net/iwnet/files/patch-src_CMakeLists.txt b/net/iwnet/files/patch-src_CMakeLists.txt
index dce86d7fd320..32642169582c 100644
--- a/net/iwnet/files/patch-src_CMakeLists.txt
+++ b/net/iwnet/files/patch-src_CMakeLists.txt
@@ -5,7 +5,7 @@
      "${CMAKE_C_ASAN} -O0 -g -ggdb -Werror -DDEBUG -D_DEBUG -UNDEBUG -Wno-unused-variable"
  )
 -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_ASAN} -O3 -DNDEBUG")
-+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_ASAN} -DNDEBUG")
++set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_ASAN} -DNDEBUG")
  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-s")
  set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -g")
  set(CMAKE_C_FLAGS_RELEASEWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})