On Sat Dec 07, 2019 at 07:49:38PM +0100, Christian Weisgerber wrote:
> Rafael Sadowski:
> 
> > here is a relatively straightforward update to the latest stable
> > version. As always, we need brave people to test this diff
> > in a bulk build.
> 
> The only build error was x11/gnustep/libobjc2.
> However note that this takes out x11/gnustep/* and a few other
> ports.

Thanks for the bulk build and the report. libobjc2 uses
CMAKE_THREAD_LIBS_INIT wrong. CMAKE_THREAD_LIBS_INIT is the lib and not
a linker flag. Tested with current and upcoming cmake.

More: https://cmake.org/cmake/help/v3.16/module/FindThreads.html

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/Makefile,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 Makefile
--- Makefile    20 Oct 2019 08:03:03 -0000      1.22
+++ Makefile    8 Dec 2019 20:37:35 -0000
@@ -13,7 +13,7 @@ GH_TAGNAME =  v${VERSION}
 DISTNAME =     libobjc2-${VERSION:S/_//}
 PKGNAME =      gnustep-${DISTNAME}
 CATEGORIES =   x11/gnustep devel
-REVISION =     2
+REVISION =     3
 
 SHARED_LIBS += objc2   1.1
 SHARED_LIBS +=  objcxx 0.0
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/patches/patch-CMakeLists_txt,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt        1 Jan 2017 09:30:21 -0000       1.3
+++ patches/patch-CMakeLists_txt        8 Dec 2019 20:37:35 -0000
@@ -1,6 +1,10 @@
 $OpenBSD: patch-CMakeLists_txt,v 1.3 2017/01/01 09:30:21 jca Exp $
---- CMakeLists.txt.orig        Sun Jul 12 13:17:46 2015
-+++ CMakeLists.txt     Wed Dec 28 08:59:20 2016
+
+Do not use CMAKE_THREAD_LIBS_INIT as a linker flag
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
 @@ -5,7 +5,6 @@ project(libobjc)
  enable_language(ASM)
  
@@ -9,7 +13,31 @@ $OpenBSD: patch-CMakeLists_txt,v 1.3 201
  set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
  
  set(libobjc_VERSION 4.6)
-@@ -285,6 +284,11 @@ if (APPLE)
+@@ -237,12 +236,8 @@ endif (ENABLE_OBJCXX)
+ 
+ # Currently, we actually need pthreads, but we should use the platform's 
native
+ # threading implementation (we do for everything except thread-local storage)
+-set(CMAKE_THREAD_PREFER_PTHREAD)
+-include(FindThreads)
+-set(objc_LINK_FLAGS "${objc_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
++find_package(Threads REQUIRED)
+ 
+-
+-
+ add_library(objc SHARED ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} 
${libobjc_OBJC_SRCS} ${libobjc_CXX_SRCS})
+ 
+ set_target_properties(objc PROPERTIES
+@@ -265,6 +260,9 @@ if (BUILD_STATIC_LIBOBJC)
+ endif ()
+ 
+ 
++if (CMAKE_THREAD_LIBS_INIT)
++      target_link_libraries(objc ${CMAKE_THREAD_LIBS_INIT})
++endif ()
+ 
+ # Explicitly link the C++ runtime and libgc if we are compiling with gc 
support.
+ target_link_libraries(objc ${CXX_RUNTIME})
+@@ -285,6 +283,11 @@ if (APPLE)
        set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} 
-Wl,-undefined,dynamic_lookup")
        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} 
-Wl,-undefined,dynamic_lookup")
  endif ()

Reply via email to