pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/boost-libs devel/boost-libs: smarter check for l...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1aeb8569f9dc
branches:  trunk
changeset: 450983:1aeb8569f9dc
user:      thor <thor%pkgsrc.org@localhost>
date:      Fri Apr 23 16:17:27 2021 +0000

description:
devel/boost-libs: smarter check for libbacktrace indepentent of distro

This just does a quick compile/link to actually see if libbacktrace is
present in the current toolchain, not resorting to assumptions based on
Linux distro. In theory, it should work on any system, but I kept the
Linux condition in place.

diffstat:

 devel/boost-libs/Makefile                |   8 ++++----
 devel/boost-libs/files/test-backtrace.sh |  23 +++++++++++++++++++++++
 2 files changed, 27 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r a111c32c0514 -r 1aeb8569f9dc devel/boost-libs/Makefile
--- a/devel/boost-libs/Makefile Fri Apr 23 16:12:26 2021 +0000
+++ b/devel/boost-libs/Makefile Fri Apr 23 16:17:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.85 2021/04/21 12:09:50 adam Exp $
+# $NetBSD: Makefile,v 1.86 2021/04/23 16:17:27 thor Exp $
 
 BOOST_PACKAGE=         libs
 BOOST_COMMENT=         (binary libraries)
@@ -48,9 +48,9 @@
 .endif
 
 # libboost_stacktrace_backtrace requires libbacktrace.
-# FIXME: The condition needs to be refined for non-Debian/Ubuntu
-# platforms shipped with libbacktrace.
-.if ${OPSYS} == "Linux" && (exists(/etc/debian_version) || exists(/etc/devuan_version))
+# FIXME: Test on non-Linux. It should just work.
+TEST_BACKTRACE_CMD=    sh ${FILESDIR}/test-backtrace.sh '${CXX} ${CXXFLAGS} ${CPPFLAGS}'
+.if ${OPSYS} == "Linux" && ${TEST_BACKTRACE_CMD:sh} == "yes"
 PLIST.backtrace=       yes
 .endif
 
diff -r a111c32c0514 -r 1aeb8569f9dc devel/boost-libs/files/test-backtrace.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/boost-libs/files/test-backtrace.sh  Fri Apr 23 16:17:27 2021 +0000
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Given a compiler command, test if libbacktrace is available.
+# It is shipped with GCC, sometimes, and not in the official
+# places.
+
+set -e
+
+cc=$1; shift
+dir=$(mktemp -d "${TMPDIR:-/tmp}/conftest.XXXXXX")
+cd "$dir"
+cat > test.c <<EOT
+#include <backtrace.h>
+int main()
+{
+  return 0;
+}
+EOT
+$cc -o test test.c -lbacktrace 2>/dev/null  &&
+echo yes ||
+echo no
+cd
+rm -rf "$dir"



Home | Main Index | Thread Index | Old Index