Garbage collect the pthread patching for CMake.

From Brad, thanks.
This commit is contained in:
dcoppa 2012-08-20 08:07:34 +00:00
parent f575aff5d1
commit 367b2bd1b2
4 changed files with 6 additions and 133 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.62 2012/07/12 16:26:13 dcoppa Exp $
# $OpenBSD: Makefile,v 1.63 2012/08/20 08:07:34 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 = 9
REVISION = 10
MASTER_SITES = ${HOMEPAGE}files/v2.8/
MAINTAINER = David Coppa <dcoppa@openbsd.org>

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-Modules_FindQt4_cmake,v 1.13 2012/05/07 07:06:20 dcoppa Exp $
--- Modules/FindQt4.cmake.orig Wed Apr 18 20:10:54 2012
+++ Modules/FindQt4.cmake Mon Apr 30 11:07:25 2012
$OpenBSD: patch-Modules_FindQt4_cmake,v 1.14 2012/08/20 08:07:34 dcoppa Exp $
--- Modules/FindQt4.cmake.orig Wed Apr 18 14:10:54 2012
+++ Modules/FindQt4.cmake Sat Aug 18 08:43:30 2012
@@ -473,13 +473,20 @@ GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRE
# check for qmake
# Debian uses qmake-qt4
@ -29,20 +29,7 @@ $OpenBSD: patch-Modules_FindQt4_cmake,v 1.13 2012/05/07 07:06:20 dcoppa Exp $
# double check that it was a Qt4 qmake, if not, re-find with different names
IF (QT_QMAKE_EXECUTABLE)
@@ -922,6 +929,12 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
_QT4_ADJUST_LIB_VARS(QAxContainer)
ENDIF(Q_WS_WIN)
+ # Qt4 on OpenBSD needs to be linked with -pthread
+ IF(CMAKE_SYSTEM MATCHES "OpenBSD*")
+ FIND_PACKAGE(Threads)
+ SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT})
+ ENDIF(CMAKE_SYSTEM MATCHES "OpenBSD*")
#######################################
#
@@ -946,13 +959,13 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
@@ -946,13 +953,13 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
ENDIF(QT_QMAKE_CHANGED)
FIND_PROGRAM(QT_MOC_EXECUTABLE

View File

@ -1,87 +0,0 @@
$OpenBSD: patch-Modules_FindThreads_cmake,v 1.4 2012/05/07 07:06:20 dcoppa Exp $
--- Modules/FindThreads.cmake.orig Mon Apr 30 11:43:02 2012
+++ Modules/FindThreads.cmake Mon Apr 30 11:48:51 2012
@@ -43,80 +43,9 @@ ELSE()
# We have pthread.h
# Let's check for the library now.
#
- SET(CMAKE_HAVE_THREADS_LIBRARY)
- IF(NOT THREADS_HAVE_PTHREAD_ARG)
- # Check if pthread functions are in normal C library
- CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE)
- IF(CMAKE_HAVE_LIBC_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "")
- SET(CMAKE_HAVE_THREADS_LIBRARY 1)
- SET(Threads_FOUND TRUE)
- ENDIF()
-
- IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
- # Do we have -lpthreads
- CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
- IF(CMAKE_HAVE_PTHREADS_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
- SET(CMAKE_HAVE_THREADS_LIBRARY 1)
- SET(Threads_FOUND TRUE)
- ENDIF()
-
- # Ok, how about -lpthread
- CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
- IF(CMAKE_HAVE_PTHREAD_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
- SET(CMAKE_HAVE_THREADS_LIBRARY 1)
- SET(Threads_FOUND TRUE)
- ENDIF()
-
- IF(CMAKE_SYSTEM MATCHES "SunOS.*")
- # On sun also check for -lthread
- CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
- IF(CMAKE_HAVE_THR_CREATE)
- SET(CMAKE_THREAD_LIBS_INIT "-lthread")
- SET(CMAKE_HAVE_THREADS_LIBRARY 1)
- SET(Threads_FOUND TRUE)
- ENDIF()
- ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
- ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
- ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
-
- IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
- # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
- IF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
- MESSAGE(STATUS "Check if compiler accepts -pthread")
- TRY_RUN(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
- ${CMAKE_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/CheckForPthreads.c
- CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
- COMPILE_OUTPUT_VARIABLE OUTPUT)
-
- IF(THREADS_HAVE_PTHREAD_ARG)
- IF(THREADS_PTHREAD_ARG MATCHES "^2$")
- SET(Threads_FOUND TRUE)
- MESSAGE(STATUS "Check if compiler accepts -pthread - yes")
- ELSE()
- MESSAGE(STATUS "Check if compiler accepts -pthread - no")
- FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
- ENDIF()
- ELSE()
- MESSAGE(STATUS "Check if compiler accepts -pthread - no")
- FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
- ENDIF()
-
- ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
-
- IF(THREADS_HAVE_PTHREAD_ARG)
- SET(Threads_FOUND TRUE)
- SET(CMAKE_THREAD_LIBS_INIT "-pthread")
- ENDIF()
-
- ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
+ SET(CMAKE_HAVE_PTHREAD_CREATE 1)
+ SET(CMAKE_HAVE_THREADS_LIBRARY 1)
+ SET(CMAKE_THREAD_LIBS_INIT "-pthread")
ENDIF(CMAKE_HAVE_PTHREAD_H)
ENDIF()

View File

@ -1,27 +0,0 @@
$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));