Somewhat simpler. - still need up-to-date pkg_add - you should be able to set DEBUG_PACKAGES=${BUILD_PACKAGES} in most cases, as it will now zap PKG_ARCH=* from the actual list.
- normal work-flow: build -> fake -> build-debug-info (internal target for now) -> package (no more back and forth between fake and update-plist) - build-debug-info uses the actual plists, so there's no debug info generated if there are no plists (and no packages either) (internally build-debug-info now generates a Makefile instead of just list of files) - automatically generated debug packing-lists do not get to register-plist (they are deduced from normal packing-lists, and we generally do NOT register automatic stuff). This also allows for quicker modifications of how debug packages are built. BTW, pkg_add doesn't use -d for anything yet. Serendipitous... :) For instance, in libarchive's case, my current port generates a PLIST: @comment $OpenBSD: PLIST,v 1.12 2019/06/18 20:30:01 naddy Exp $ bin/.debug/ @bin bin/.debug/bsdcat.dbg @bin bin/.debug/bsdcpio.dbg @bin bin/.debug/bsdtar.dbg lib/.debug/ @static-lib lib/.debug/libarchive.a lib/.debug/libarchive.so.10.3.dbg and a Makefile: # Makefile generated by build-debug-info # No serviceable parts all: .PHONY: all all: bin/.debug/bsdcat.dbg bin/.debug/bsdcat.dbg: bin/bsdcat @${INSTALL_DATA_DIR} ${@D} @echo "> Copy debug info from bin/bsdcat to $@" @objcopy --only-keep-debug bin/bsdcat $@ @objcopy --strip-debug bin/bsdcat @objcopy --add-gnu-debuglink=$@ bin/bsdcat @touch $@ all: bin/.debug/bsdcpio.dbg bin/.debug/bsdcpio.dbg: bin/bsdcpio @${INSTALL_DATA_DIR} ${@D} @echo "> Copy debug info from bin/bsdcpio to $@" @objcopy --only-keep-debug bin/bsdcpio $@ @objcopy --strip-debug bin/bsdcpio @objcopy --add-gnu-debuglink=$@ bin/bsdcpio @touch $@ all: bin/.debug/bsdtar.dbg bin/.debug/bsdtar.dbg: bin/bsdtar @${INSTALL_DATA_DIR} ${@D} @echo "> Copy debug info from bin/bsdtar to $@" @objcopy --only-keep-debug bin/bsdtar $@ @objcopy --strip-debug bin/bsdtar @objcopy --add-gnu-debuglink=$@ bin/bsdtar @touch $@ all: lib/.debug/libarchive.a lib/.debug/libarchive.a: lib/libarchive.a @${INSTALL_DATA_DIR} ${@D} @echo "> Copy debug info from lib/libarchive.a to $@" @cp lib/libarchive.a $@ @strip lib/libarchive.a @touch $@ all: lib/.debug/libarchive.so.10.3.dbg lib/.debug/libarchive.so.10.3.dbg: lib/libarchive.so.10.3 @${INSTALL_DATA_DIR} ${@D} @echo "> Copy debug info from lib/libarchive.so.10.3 to $@" @objcopy --only-keep-debug lib/libarchive.so.10.3 $@ @objcopy --strip-debug lib/libarchive.so.10.3 @objcopy --add-gnu-debuglink=$@ lib/libarchive.so.10.3 @touch $@