Fix libpthread linking (use '-pthread' instead of '-lpthread') for

cmake-based ports that use "CHECK_LIBRARY_EXISTS(pthread ...)".

Fix libpthread linking for devel/llvm too (additional care was
needed).

No fallout in a bulk build: thanks landry!
This commit is contained in:
dcoppa 2012-06-14 09:32:00 +00:00
parent bc8797b0ab
commit cf153cacfa
4 changed files with 46 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.55 2012/05/15 08:36:28 dcoppa Exp $
# $OpenBSD: Makefile,v 1.56 2012/06/14 09:32:00 dcoppa Exp $
VMEM_WARNING = Yes
BROKEN-arm = build fails since move to gcc4
@ -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 <dcoppa@openbsd.org>

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-Source_cmComputeLinkInformation_cxx,v 1.3 2012/06/14 09:32:00 dcoppa Exp $
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));

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.43 2012/05/26 09:14:34 jasper Exp $
# $OpenBSD: Makefile,v 1.44 2012/06/14 09:32:00 dcoppa Exp $
# XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when
# updating this port.
@ -10,7 +10,7 @@ COMMENT = modular, fast C/C++/ObjC compiler, static analyzer and tools
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

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-tools_llvm-config_CMakeLists_txt,v 1.1 2012/06/14 09:32:00 dcoppa Exp $
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}")