Fix the corner case when you need to link with a library called
libpthreadsomething, like "libpthread-stubs" for example...

---8<---

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/cmake/Makefile,v
retrieving revision 1.55
diff -u -p -r1.55 Makefile
--- Makefile    15 May 2012 08:36:28 -0000      1.55
+++ Makefile    12 Jun 2012 09:02:23 -0000
@@ -7,7 +7,7 @@ HOMEPAGE =      http://www.cmake.org/
 CATEGORIES =   devel
 COMMENT =      portable build system
 DISTNAME =     cmake-2.8.8
-REVISION =     2
+REVISION =     3
 MASTER_SITES = ${HOMEPAGE}files/v2.8/
 
 MAINTAINER =   David Coppa <[email protected]>
Index: patches/patch-Source_cmComputeLinkInformation_cxx
===================================================================
RCS file: patches/patch-Source_cmComputeLinkInformation_cxx
diff -N patches/patch-Source_cmComputeLinkInformation_cxx
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Source_cmComputeLinkInformation_cxx   12 Jun 2012 09:02:23 
-0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+Fix libpthread linking on OpenBSD: use '-pthread' instead of
+'-lpthread'.
+
+--- Source/cmComputeLinkInformation.cxx.orig   Wed Apr 18 20:10:54 2012
++++ Source/cmComputeLinkInformation.cxx        Mon Jun 11 14:28:03 2012
+@@ -1304,7 +1304,19 @@ void cmComputeLinkInformation::AddUserItem(std::string
+     }
+ 
+   // Create an option to ask the linker to search for the library.
++#if defined(__OpenBSD__)
++  std::string out;
++  if(strcmp(lib.c_str(), "pthread") == 0)
++    {
++    out += "-";
++    }
++  else
++    {
++    out += this->LibLinkFlag;
++    }
++#else
+   std::string out = this->LibLinkFlag;
++#endif
+   out += lib;
+   out += this->LibLinkSuffix;
+   this->Items.push_back(Item(out, false));

---8<---

Also, devel/llvm needs additional care:

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- Makefile    26 May 2012 09:14:34 -0000      1.43
+++ Makefile    12 Jun 2012 09:04:05 -0000
@@ -10,7 +10,7 @@ COMMENT =     modular, fast C/C++/ObjC compi
 LLVM_V =       3.1
 DISTNAME =     llvm-${LLVM_V}.src
 PKGNAME =      llvm-${LLVM_V}
-
+REVISION =     0
 CATEGORIES =   devel
 
 # packager notes in http://llvm.org/docs/Packaging.html
Index: patches/patch-tools_llvm-config_CMakeLists_txt
===================================================================
RCS file: patches/patch-tools_llvm-config_CMakeLists_txt
diff -N patches/patch-tools_llvm-config_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tools_llvm-config_CMakeLists_txt      12 Jun 2012 09:04:05 
-0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Use '-pthread', not '-lpthread'.
+
+--- tools/llvm-config/CMakeLists.txt.orig      Mon Jun 11 15:49:19 2012
++++ tools/llvm-config/CMakeLists.txt   Mon Jun 11 15:49:34 2012
+@@ -11,7 +11,7 @@ set(SEDSCRIPT_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/Buil
+ # Compute the substitution values for various items.
+ get_system_libs(LLVM_SYSTEM_LIBS_LIST)
+ foreach(l ${LLVM_SYSTEM_LIBS_LIST})
+-  set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}")
++  set(SYSTEM_LIBS ${SYSTEM_LIBS} "-${l}")
+ endforeach()
+ set(C_FLGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} 
${LLVM_DEFINITIONS}")
+ set(CXX_FLGS "${CMAKE_CXX_FLAGS} 
${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")


Nobody interested?

Cheers!
David

Reply via email to