git: 20baa89501c7 - stable/14 - ncurses: avoid hardcoded assumptions about the layout of .OBJDIR

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 15 Dec 2023 16:50:54 UTC
The branch stable/14 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=20baa89501c7a7815b5ca4ada916393732af8d42

commit 20baa89501c7a7815b5ca4ada916393732af8d42
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-09-12 21:00:45 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-12-15 00:58:04 +0000

    ncurses: avoid hardcoded assumptions about the layout of .OBJDIR
    
    Abstract out the details of the FreeBSD build into a $TINFO_OBJDIR that
    external builds can override if they orchestrate the build a bit
    differently and have a different objdir layout as a result.  This makes
    the ncurses build a little bit more flexible without requiring weird
    backflips.
    
    Reviewed by:    bapt, sjg
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    
    (cherry picked from commit c086d1cbc3d13967c031e6420831349967dbcfa2)
---
 lib/ncurses/config.mk        | 6 ++++--
 lib/ncurses/ncurses/Makefile | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk
index 0016dc97a72f..8a3e7d0ffa59 100644
--- a/lib/ncurses/config.mk
+++ b/lib/ncurses/config.mk
@@ -6,6 +6,8 @@ NCURSES_MAJOR=	6
 NCURSES_MINOR=	2
 NCURSES_PATCH=	20210220
 
+TINFO_OBJDIR?=	${.OBJDIR:H}/tinfo
+
 CFLAGS+=	-D_XOPEN_SOURCE_EXTENDED
 NCURSES_CFG_H=	${.CURDIR}/ncurses_cfg.h
 
@@ -17,7 +19,7 @@ CFLAGS+=	-I${.CURDIR:H}/ncurses
 
 CFLAGS+=	-I${NCURSES_DIR}/include
 CFLAGS+=	-I${NCURSES_DIR}/ncurses
-CFLAGS+=	-I${.OBJDIR:H}/tinfo/
+CFLAGS+=	-I${TINFO_OBJDIR}
 
 CFLAGS+=	-Wall
 
@@ -27,7 +29,7 @@ CFLAGS+=	-DHAVE_CONFIG_H
 
 # everyone needs this
 .PATH:		${NCURSES_DIR}/include
-.PATH:		${.OBJDIR:H}/tinfo/
+.PATH:		${TINFO_OBJDIR}
 
 # tools and directories
 AWK?=		awk
diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile
index b52085780952..e1a3dbf61e49 100644
--- a/lib/ncurses/ncurses/Makefile
+++ b/lib/ncurses/ncurses/Makefile
@@ -180,9 +180,9 @@ libncursesw.ald: ${.CURDIR}/${STATIC_LDSCRIPT}
 	    -e 's,@@STATICLIB_SUFFIX@@,${_STATICLIB_SUFFIX},g' \
 	    ${.ALLSRC} > ${.TARGET}
 
-lib_gen.c: MKlib_gen.sh ${.OBJDIR:H}/tinfo/curses.h ncurses_dll.h
+lib_gen.c: MKlib_gen.sh ${TINFO_OBJDIR}/curses.h ncurses_dll.h
 	LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CPP:N${CCACHE_BIN}} ${CFLAGS}" \
-	       "${AWK}" generated < ${.OBJDIR:H}/tinfo/curses.h >$@
+	       "${AWK}" generated < ${TINFO_OBJDIR}/curses.h >$@
 
 expanded.c: MKexpanded.sh
 	sh ${NCURSES_DIR}/ncurses/tty/MKexpanded.sh "${CC:N${CCACHE_BIN}} -E" ${CFLAGS} >expanded.c