tech-pkg archive

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

Fix boost-libs backtrace check during freeze?



Hi Thomas,

I got a report that my hacky detection of libbacktrace in the host's
toolchain for having correct PLIST for devel/boost-libs breaks on at
least one setup due to the _PKGSRC_BARRIER around calling of a script
that runs the compiler/linker. I don't understand where a barrier is
appropriate and folks on IRC also seem to be divided over this. Good
signs to avoid it;-)

After some suggestion on IRC, I prepared an alternate way of dealing
with the implicit creation of the backtrace parts via GENERATE_PLIST
instead. I tested in on Ubuntu with the system toolchain (has
libbacktrace) and a custom toolchain (doesn't have it).

The full patch is attached, the core is this:

-# libboost_stacktrace_backtrace requires libbacktrace.
-# FIXME: Test on non-Linux. It should just work.
-TEST_BACKTRACE_CMD=	${PKGSRC_SETENV} ${MAKE_ENV} ${TOOLS_PLATFORM.sh} \
-  ${FILESDIR}/test-backtrace.sh '${CXX} ${CXXFLAGS} ${CPPFLAGS}'
-.if !defined(_PKGSRC_BARRIER)
-.if ${OPSYS} == "Linux" && ${TEST_BACKTRACE_CMD:sh} == "yes"
-PLIST.backtrace=	yes
-.endif
-.endif
+# Add backtrace libs when they got built because of libbacktrace
+# being available in the toolchain (not easy to detect beforehand).
+GENERATE_PLIST+=	cd ${DESTDIR:Q}/${PREFIX:Q}; \
+  for f in lib/libboost_stacktrace_backtrace.*; do \
+   if [ -f "$$f" ]; then echo "$$f"; fi; \
+  done;


OK to commit? Any nit-picking about rather running find instead of a
loop?


Alrighty then,

Thomas

-- 
Dr. Thomas Orgis
HPC @ Universität Hamburg
Index: devel/boost-libs/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/boost-libs/Makefile,v
retrieving revision 1.87
diff -u -r1.87 Makefile
--- devel/boost-libs/Makefile	24 Apr 2021 14:12:17 -0000	1.87
+++ devel/boost-libs/Makefile	21 Sep 2021 10:09:01 -0000
@@ -47,15 +47,12 @@
 PLIST.longdbl=		yes
 .endif
 
-# libboost_stacktrace_backtrace requires libbacktrace.
-# FIXME: Test on non-Linux. It should just work.
-TEST_BACKTRACE_CMD=	${PKGSRC_SETENV} ${MAKE_ENV} ${TOOLS_PLATFORM.sh} \
-  ${FILESDIR}/test-backtrace.sh '${CXX} ${CXXFLAGS} ${CPPFLAGS}'
-.if !defined(_PKGSRC_BARRIER)
-.if ${OPSYS} == "Linux" && ${TEST_BACKTRACE_CMD:sh} == "yes"
-PLIST.backtrace=	yes
-.endif
-.endif
+# Add backtrace libs when they got built because of libbacktrace
+# being available in the toolchain (not easy to detect beforehand).
+GENERATE_PLIST+=	cd ${DESTDIR:Q}/${PREFIX:Q}; \
+  for f in lib/libboost_stacktrace_backtrace.*; do \
+   if [ -f "$$f" ]; then echo "$$f"; fi; \
+  done;
 
 UNLIMIT_RESOURCES+=	stacksize
 
Index: devel/boost-libs/PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/devel/boost-libs/PLIST,v
retrieving revision 1.42
diff -u -r1.42 PLIST
--- devel/boost-libs/PLIST	1 Jan 2021 08:19:02 -0000	1.42
+++ devel/boost-libs/PLIST	21 Sep 2021 10:09:01 -0000
@@ -84,9 +84,6 @@
 lib/libboost_stacktrace_addr2line.a
 lib/libboost_stacktrace_addr2line.so
 lib/libboost_stacktrace_addr2line.so.${PKGVERSION}
-${PLIST.backtrace}lib/libboost_stacktrace_backtrace.a
-${PLIST.backtrace}lib/libboost_stacktrace_backtrace.so
-${PLIST.backtrace}lib/libboost_stacktrace_backtrace.so.${BOOST_VERSION}
 lib/libboost_stacktrace_basic.a
 lib/libboost_stacktrace_basic.so
 lib/libboost_stacktrace_basic.so.${PKGVERSION}
Index: devel/boost-libs/files/test-backtrace.sh
===================================================================
RCS file: devel/boost-libs/files/test-backtrace.sh
diff -N devel/boost-libs/files/test-backtrace.sh
--- devel/boost-libs/files/test-backtrace.sh	23 Apr 2021 16:17:27 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-#!/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