Switch Clementine to FindBacktrace.cmake that was recently committed to CMake.

prodded by dcoppa@
This commit is contained in:
zhuk 2013-03-21 16:05:00 +00:00
parent a5fac2184e
commit 0ddf737853
5 changed files with 38 additions and 51 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.5 2013/03/16 09:31:05 brad Exp $ # $OpenBSD: Makefile,v 1.6 2013/03/21 16:05:00 zhuk Exp $
SHARED_ONLY = Yes SHARED_ONLY = Yes
COMMENT = Qt4-based featureful music player COMMENT = Qt4-based featureful music player
DISTNAME = clementine-1.1.1 DISTNAME = clementine-1.1.1
REVISION = 1 REVISION = 2
CATEGORIES = audio x11 CATEGORIES = audio x11
HOMEPAGE = http://clementine-player.org/ HOMEPAGE = http://clementine-player.org/
@ -32,6 +32,7 @@ WANTLIB += plist
MODULES = devel/cmake devel/gettext x11/qt4 MODULES = devel/cmake devel/gettext x11/qt4
BUILD_DEPENDS = devel/boost \ BUILD_DEPENDS = devel/boost \
devel/cmake>=2.8.10.2p3 \
devel/sparsehash devel/sparsehash
RUN_DEPENDS = devel/desktop-file-utils \ RUN_DEPENDS = devel/desktop-file-utils \
@ -70,6 +71,6 @@ CONFIGURE_ARGS += -DENABLE_SOUNDMENU:Bool=No
CONFIGURE_ARGS += -DBUNDLE_PROJECTM_PRESETS:Bool=Yes CONFIGURE_ARGS += -DBUNDLE_PROJECTM_PRESETS:Bool=Yes
post-extract: post-extract:
cp ${FILESDIR}/FindExecinfo.cmake ${WRKSRC}/cmake cp ${FILESDIR}/config.h.in ${WRKSRC}/ext/libclementine-common/
.include <bsd.port.mk> .include <bsd.port.mk>

View File

@ -1,29 +0,0 @@
# - Find execinfo library
# Find the execinfo library and includes.
# This module defines
# EXECINFO_INCLUDE_DIR, where to find execinfo.h
# EXECINFO_LIBRARY, path to library
# EXECINFO_FOUND, set only if execinfo successfully found
#
# $OpenBSD: FindExecinfo.cmake,v 1.1 2013/02/06 13:23:03 zhuk Exp $
# Copyright (c) 2013, Vadim Zhukov <persgray@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
include(FindPackageHandleStandardArgs)
find_path(EXECINFO_INCLUDE_DIR "execinfo.h")
find_library(EXECINFO_LIBRARY "execinfo")
find_package_handle_standard_args(Execinfo DEFAULT_MSG EXECINFO_INCLUDE_DIR EXECINFO_LIBRARY)

View File

@ -0,0 +1,6 @@
#cmakedefine01 HAVE_BACKTRACE
#if HAVE_BACKTRACE
#include <${BACKTRACE_INCLUDES}>
#endif

View File

@ -1,14 +1,14 @@
$OpenBSD: patch-ext_libclementine-common_CMakeLists_txt,v 1.2 2013/02/06 13:23:03 zhuk Exp $ $OpenBSD: patch-ext_libclementine-common_CMakeLists_txt,v 1.3 2013/03/21 16:05:00 zhuk Exp $
--- ext/libclementine-common/CMakeLists.txt.orig Sun Nov 18 12:51:26 2012 --- ext/libclementine-common/CMakeLists.txt.orig Sun Nov 18 12:51:26 2012
+++ ext/libclementine-common/CMakeLists.txt Wed Feb 6 17:06:29 2013 +++ ext/libclementine-common/CMakeLists.txt Thu Mar 21 19:34:21 2013
@@ -41,3 +41,10 @@ target_link_libraries(libclementine-common @@ -41,3 +41,10 @@ target_link_libraries(libclementine-common
chardet chardet
) )
+find_package(Execinfo) +find_package(Backtrace)
+if(EXECINFO_FOUND) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+ include_directories(${EXECINFO_INCLUDE_DIR}) + ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+ target_link_libraries(libclementine-common ${EXECINFO_LIBRARY}) +if(BACKTRACE_FOUND)
+ add_definitions(-DEXECINFO_FOUND -DHAVE_BACKTRACE) + include_directories(${BACKTRACE_INCLUDE_DIRS})
+endif(EXECINFO_FOUND) + target_link_libraries(libclementine-common ${BACKTRACE_LIBRARIES})
+ +endif(BACKTRACE_FOUND)

View File

@ -1,31 +1,40 @@
$OpenBSD: patch-ext_libclementine-common_core_logging_cpp,v 1.2 2013/02/06 13:23:03 zhuk Exp $ $OpenBSD: patch-ext_libclementine-common_core_logging_cpp,v 1.3 2013/03/21 16:05:00 zhuk Exp $
backtrace() is probably present on GNU and Solaris only. backtrace() is probably present on GNU and Solaris only.
--- ext/libclementine-common/core/logging.cpp.orig Thu Oct 11 15:16:39 2012 --- ext/libclementine-common/core/logging.cpp.orig Thu Oct 11 15:16:39 2012
+++ ext/libclementine-common/core/logging.cpp Wed Feb 6 17:06:07 2013 +++ ext/libclementine-common/core/logging.cpp Thu Feb 7 17:55:23 2013
@@ -21,7 +21,7 @@ @@ -21,9 +21,6 @@
#include <QtGlobal> #include <QtGlobal>
#include <cxxabi.h> #include <cxxabi.h>
-#ifdef Q_OS_UNIX -#ifdef Q_OS_UNIX
+#ifdef EXECINFO_FOUND -#include <execinfo.h>
#include <execinfo.h> -#endif
#endif
@@ -224,7 +224,7 @@ QString DemangleSymbol(const QString& symbol) { #include <QCoreApplication>
#include <QDateTime>
@@ -31,6 +28,7 @@
#include <glib.h>
+#include "config.h"
#include "logging.h"
@@ -224,7 +222,7 @@ QString DemangleSymbol(const QString& symbol) {
} }
void DumpStackTrace() { void DumpStackTrace() {
-#ifdef Q_OS_UNIX -#ifdef Q_OS_UNIX
+#ifdef HAVE_BACKTRACE +#if HAVE_BACKTRACE
void* callstack[128]; void* callstack[128];
int callstack_size = backtrace(reinterpret_cast<void**>(&callstack), sizeof(callstack)); int callstack_size = backtrace(reinterpret_cast<void**>(&callstack), sizeof(callstack));
char** symbols = backtrace_symbols(reinterpret_cast<void**>(&callstack), callstack_size); char** symbols = backtrace_symbols(reinterpret_cast<void**>(&callstack), callstack_size);
@@ -234,7 +234,7 @@ void DumpStackTrace() { @@ -234,7 +232,7 @@ void DumpStackTrace() {
} }
free(symbols); free(symbols);
#else #else
- qLog(Debug) << "FIXME: Implement printing stack traces on this platform"; - qLog(Debug) << "FIXME: Implement printing stack traces on this platform";
+ qLog(Debug) << "FIXME: Implement printing stack traces on this platform or port backtrace() from GNU libc"; + qLog(Debug) << "FIXME: Implement printing stack traces on this platform or provide separate execinfo library";
#endif #endif
} }