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

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Sat, 02 Dec 2023 09:45:30 UTC
The branch stable/14 has been updated by manu:

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

commit 7cedaf50721b125b5c46f8e974806248356787bf
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-11-13 17:18:58 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-12-02 09:44:04 +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