bctoolbox: unbreak some consumers' build on ld.bfd archs

Upstream's cmake magic checks for execinfo.h, but there is no test to
check if the backtrace(3) function family requires extra linker flags.
Replace the header check by testing if backtrace(3) exists, and if it
does, add the required linker flag.

This fixes telephony/linphone/belr build on ld.bfd archs, at least.

Tested on macppc and amd64.

« ok if it works for you » landry@ (maintainer)
This commit is contained in:
cwen 2021-08-03 11:15:44 +00:00
parent 58f540e87b
commit 1659080781
2 changed files with 19 additions and 3 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.2 2021/07/10 16:56:03 landry Exp $
# $OpenBSD: Makefile,v 1.3 2021/08/03 11:15:44 cwen Exp $
COMMENT = utilities library used by linphone stack
MODULE = bctoolbox
REVISION = 0
SHARED_LIBS += bctoolbox 0.0 # 1
#SHARED_LIBS += bctoolbox-tester 0.0 # 1
@ -16,7 +17,7 @@ LIB_DEPENDS = security/polarssl \
converters/libiconv
MODCMAKE_DEBUG=Yes
WANTLIB += ${COMPILER_LIBCXX} iconv m mbedcrypto mbedtls mbedx509
WANTLIB += ${COMPILER_LIBCXX} execinfo iconv m mbedcrypto mbedtls mbedx509
# regen PLIST if building with tests
#LIB_DEPENDS += telephony/linphone/bcunit
#WANTLIB += bcunit

View File

@ -1,4 +1,6 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1.1.1 2021/07/10 12:03:19 landry Exp $
$OpenBSD: patch-CMakeLists_txt,v 1.2 2021/08/03 11:15:44 cwen Exp $
Hunk #3: ensure that libexecinfo symbols are resolved (fix the build on ld.bfd archs)
Index: CMakeLists.txt
--- CMakeLists.txt.orig
@ -25,3 +27,16 @@ Index: CMakeLists.txt
if(ENABLE_MBEDTLS)
find_package(MbedTLS)
@@ -151,7 +149,11 @@ set(EXPORT_TARGETS_NAME "bctoolbox")
check_library_exists("rt" "clock_gettime" "" HAVE_LIBRT)
check_library_exists("dl" "dladdr" "" HAVE_LIBDL)
-check_include_file("execinfo.h" HAVE_EXECINFO)
+
+check_library_exists("execinfo" "backtrace" "" HAVE_EXECINFO)
+if(HAVE_EXECINFO)
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lexecinfo")
+endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/config.h PROPERTIES GENERATED ON)