git: 7b68016c7678 - stable/13 - pkgbase: set the prefix of debug files and macros to /usr/src

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 04 Dec 2023 10:39:39 UTC
The branch stable/13 has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b68016c7678db478cb8ac7a15fa821c0231fccc

commit 7b68016c7678db478cb8ac7a15fa821c0231fccc
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-11-13 17:18:58 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-12-04 10:39:16 +0000

    pkgbase: set the prefix of debug files and macros to /usr/src
    
    When the macro PACKAGE_BUILDING is set, then consider we are building package
    for pkgbase, this has already been used in Makefile.inc1 and reuse the
    PACKAGE_BUILDING macros already used for that purpose in the ports tree
    
    In the future this should be tied to REPRODUCIBLE_BUILD
    
    MFC After:      3 days
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D42569
    
    (cherry picked from commit 030af1b62d7b9a86f5ecdceff5a1fa23e9570be1)
---
 share/mk/src.sys.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk
index edf369638d9d..d5c2af0c559d 100644
--- a/share/mk/src.sys.mk
+++ b/share/mk/src.sys.mk
@@ -38,6 +38,9 @@ __postrcconf_${var}:=	${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno
 # default over to -fno-common, making this redundant.
 CFCOMMONFLAG?=	-fno-common
 CFLAGS+=	${CFCOMMONFLAG}
+.if defined(PACKAGE_BUILDING)
+CFLAGS+=	-fmacro-prefix-map=${SRCTOP}=/usr/src -fdebug-prefix-map=${SRCTOP}=/usr/src
+.endif
 
 DEFAULTWARNS=	6