diff options
author | jperkin <jperkin@pkgsrc.org> | 2018-11-12 14:22:58 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2018-11-12 14:22:58 +0000 |
commit | 6fc8ee4fa695940657da550101ed79da923fb0fe (patch) | |
tree | 750afd7418929def64b8dc2763263f653416e991 /mk/install/install.mk | |
parent | 9b5a438016d5026cab40691562b916c7ddc144b0 (diff) | |
download | pkgsrc-6fc8ee4fa695940657da550101ed79da923fb0fe.tar.gz |
mk: Add CTF infrastructure support.
Platform support is determined by _OPSYS_SUPPORTS_CTF from mk/platform, the
user enables support by setting PKGSRC_USE_CTF=yes, and packages can
explicitly disable support with CTF_SUPPORTED=no or skip certain files with
CTF_FILES_SKIP.
The path to ctfconvert is configured via TOOLS_PLATFORM.ctfconvert.
If all of the requisite variables are enabled, a compiler-specific debug flag
is passed via the wrappers to ensure we have DWARF information to convert,
_INSTALL_UNSTRIPPED is explicitly defined to avoid binaries being stripped
prior to conversion, and the conversion is performed during the install stage.
It is recommended that users who enable the feature also set STRIP_DEBUG=yes
to reduce the final binary size once the conversion has been performed.
This has been used for the past year in Joyent SmartOS builds. FreeBSD is
marked as supported but is untested.
Diffstat (limited to 'mk/install/install.mk')
-rw-r--r-- | mk/install/install.mk | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/mk/install/install.mk b/mk/install/install.mk index dc5e710729a..a1c5590587c 100644 --- a/mk/install/install.mk +++ b/mk/install/install.mk @@ -1,4 +1,4 @@ -# $NetBSD: install.mk,v 1.74 2018/11/12 13:47:32 jperkin Exp $ +# $NetBSD: install.mk,v 1.75 2018/11/12 14:22:58 jperkin Exp $ # # This file provides the code for the "install" phase. # @@ -183,6 +183,9 @@ _INSTALL_ALL_TARGETS+= pre-install _INSTALL_ALL_TARGETS+= do-install _INSTALL_ALL_TARGETS+= post-install _INSTALL_ALL_TARGETS+= plist +.if ${_PKGSRC_USE_CTF} == "yes" +_INSTALL_ALL_TARGETS+= install-ctf +.endif .if ${STRIP_DEBUG:Uno:tl} == "yes" && ${STRIP_DEBUG_SUPPORTED:Uyes:tl} == "yes" _INSTALL_ALL_TARGETS+= install-strip-debug .endif @@ -337,6 +340,30 @@ post-install: .endif ###################################################################### +### install-ctf (PRIVATE) +###################################################################### +### install-ctf creates CTF information from debug binaries. +### +.PHONY: install-ctf +install-ctf: plist + @${STEP_MSG} "Generating CTF data" + ${RUN}cd ${DESTDIR:Q}${PREFIX:Q}; \ + ${CAT} ${_PLIST_NOKEYWORDS} | while read f; do \ + [ ! -h "$${f}" ] || continue; \ + case "$${f}" in \ + ${CTF_FILES_SKIP:@p@${p}) continue ;;@} \ + *) ;; \ + esac; \ + tmp_f="$${f}.XXX"; \ + if ${CTFCONVERT} -o "$${tmp_f}" "$${f}" 2>/dev/null; then \ + if [ -f "$${tmp_f}" -a -f "$${f}" ]; then \ + ${MV} "$${tmp_f}" "$${f}"; \ + fi; \ + fi; \ + ${RM} -f "$${tmp_f}"; \ + done + +###################################################################### ### install-strip-debug (PRIVATE) ###################################################################### ### install-strip-debug tries to strip debug information from |