From nobody Tue Jun 3 19:57:05 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bBhLn35lZz5y5Wn; Tue, 03 Jun 2025 19:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bBhLn2MT6z3kjQ; Tue, 03 Jun 2025 19:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1748980625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KHd+P1LvELJxEHnzsavkostyFDtwRdeHpQecJHX+QMM=; b=ZwA0L2VJG6ARZccFG7y4HObybJJd59Uclr0iwzT3ZyNP2khfM6i2EwzU3EVSqJoZJc6wMM NlWgHCK26VKWmEMO4ygzXQFxU9sofUrOECqMR8JVwcNNBPu3wb/JghXV9jGjbnCsz2fd59 pgevObs8fTHfEfkYRPBqzaC+dAtJ9NMSOKGENYaEHX53hPud4DDgy6mvSBtMcvUwyaZT7V qDSyFdusBpfQQfAko2tMm0nDhVUJpTbAARUtSie71mqBVjjgfNxJW8MTJIBTYsdtE17264 Ri7T0r3W+hrtWVnoIevZ/I+6OPEZFbRZmUBGsFEdB+bBHPlh5Gj2xauo9lSJ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1748980625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KHd+P1LvELJxEHnzsavkostyFDtwRdeHpQecJHX+QMM=; b=xtbE6we67VvMOycmifbdhjpMaInIVHhi8V3U1RjLZae5OGYWTfzwShrzqDEe4F+prHTiHe iL3/5wyMQrSCttYmmTpk6gyWCUcvqH/v8oE+N2bXj0Nx4ibVRDK9BGBnfEcu05lmehFQhl fg7jJNXp+Pvh8QvPf5lMhwHt0Y+yKQGtxFF6R4uX+DExKxHf1nD7bXRTiyMUUhheX/I7wJ Ed52Mzkbc98ONrNmqGJxxE9VFsjRau8D9pVrBQzkHXAxwpou8XScllstllqCecvAa4Z/17 d9VYVBR38d/dA75okAgQgoI05P9T/4dwtIkFJ9zxxT2b7q6bVYqYmjUxpGLRfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1748980625; a=rsa-sha256; cv=none; b=nBFH0RxDbcG4ioDJ1pJfFLPxCWg+oNI4WPkb2jGJlN6nEXcHNHiWWHajZLJV+YU9PFc6jr wI4HaGqK5mUxL65+IWkEjzPTgOwVJ656h2opB7p15GTEsq0agLq9zff0a0o9AvQbAbpbrL 3VC1b6Gf+eAhgmK/MwWbYJM7jqexhyFUR3X7LqVOnaPzcWSpuZtFvDOQ8UnQ1bdzdPE8Gr VglU4buDAHsMIApFdnML6AfSTY0FtcXyo8bnh563tTfJHYb7xu8iOGpWMBVdT/vPmykcxL XfXL3B/trNzKzOIoVHxGTDxQg5Dvf0ZcL6sWQZckoQw87OLo/JVRYEkg4iHjzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bBhLn1sMRzrxm; Tue, 03 Jun 2025 19:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 553Jv5qL050452; Tue, 3 Jun 2025 19:57:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 553Jv5uF050449; Tue, 3 Jun 2025 19:57:05 GMT (envelope-from git) Date: Tue, 3 Jun 2025 19:57:05 GMT Message-Id: <202506031957.553Jv5uF050449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: a40d73475b1d - main - Export SB_OBJROOT for later reference List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a40d73475b1d716142dd32c29a16d5f9fc418f7d Auto-Submitted: auto-generated The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a40d73475b1d716142dd32c29a16d5f9fc418f7d commit a40d73475b1d716142dd32c29a16d5f9fc418f7d Author: Simon J. Gerraty AuthorDate: 2025-06-03 19:55:18 +0000 Commit: Simon J. Gerraty CommitDate: 2025-06-03 19:55:18 +0000 Export SB_OBJROOT for later reference The build varies MAKEOBJDIRPREFIX at times which can make it difficult to track the original OBJROOT. This is easier when we get the original from env as SB_OBJROOT. If SB_OBJROOT did not come from env, set and export it the first time we set OBJROOT. This allows SB_OBJROOT to be used in .MAKE.META.IGNORE* variables to tweak what should be considered as making a target out-of-date. Update auto.obj.mk to latest from contrib/bmake - handles relative objdirs more simply and reliably. Also update jobs.mk and stage-install.sh Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D50313 --- share/mk/auto.obj.mk | 15 ++++++---- share/mk/jobs.mk | 11 +++++--- share/mk/src.sys.obj.mk | 6 ++++ share/mk/stage-install.sh | 71 +++++++++++++++++++++++++++++++++++++---------- 4 files changed, 79 insertions(+), 24 deletions(-) diff --git a/share/mk/auto.obj.mk b/share/mk/auto.obj.mk index cfe60ef9c4d6..4b8c5325b71f 100644 --- a/share/mk/auto.obj.mk +++ b/share/mk/auto.obj.mk @@ -1,8 +1,8 @@ # SPDX-License-Identifier: BSD-2-Clause # -# $Id: auto.obj.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $ +# $Id: auto.obj.mk,v 1.20 2025/05/17 15:29:55 sjg Exp $ # -# @(#) Copyright (c) 2004, Simon J. Gerraty +# @(#) Copyright (c) 2004-2025, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -50,7 +50,12 @@ __objdir?= ${.CURDIR} __objdir?= ${MAKEOBJDIRPREFIX}${.CURDIR} .endif __objdir?= ${MAKEOBJDIR:Uobj} -__objdir:= ${__objdir} +# relative dirs can cause trouble below +# keep it simple and convert to absolute path now if needed +.if ${__objdir:M/*} == "" +# avoid ugly ${.CURDIR}/./obj etc. +__objdir:= ${.CURDIR}/${__objdir:S,^./,,} +.endif .if ${.OBJDIR:tA} != ${__objdir:tA} # We need to chdir, make the directory if needed .if !exists(${__objdir}/) && \ @@ -65,11 +70,9 @@ __objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \ .if ${.OBJDIR:tA} != ${__objdir:tA} # we did not get what we want - do we care? .if ${__objdir_made:Uno:M${__objdir}/*} != "" -# watch out for __objdir being relative path -.if !(${__objdir:M/*} == "" && ${.OBJDIR:tA} == ${${.CURDIR}/${__objdir}:L:tA}) +# we attempted to make ${__objdir} and failed .error could not use ${__objdir}: .OBJDIR=${.OBJDIR} .endif -.endif # apparently we can live with it # make sure we know what we have .OBJDIR: ${.CURDIR} diff --git a/share/mk/jobs.mk b/share/mk/jobs.mk index 0643e6481082..e304e16a9c56 100644 --- a/share/mk/jobs.mk +++ b/share/mk/jobs.mk @@ -1,6 +1,8 @@ -# $Id: jobs.mk,v 1.14 2023/09/11 16:52:44 sjg Exp $ +# SPDX-License-Identifier: BSD-2-Clause # -# @(#) Copyright (c) 2012-2023, Simon J. Gerraty +# $Id: jobs.mk,v 1.19 2025/02/03 21:18:44 sjg Exp $ +# +# @(#) Copyright (c) 2012-2025, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -66,7 +68,7 @@ NEWLOG_SH := ${(type newlog.sh) 2> /dev/null:L:sh:M/*} .endif .endif .if !empty(NEWLOG_SH) && exists(${NEWLOG_SH}) -NEWLOG := sh ${NEWLOG_SH} +NEWLOG := ${.SHELL:Ush} ${NEWLOG_SH} JOB_NEWLOG_ARGS ?= -S -n ${JOB_LOG_GENS} .else NEWLOG = : @@ -78,7 +80,8 @@ JOB_MAX = ${.MAKE.JOBS} # This should be derrived from number of cpu's .if ${.MAKE.JOBS.C:Uno} == "yes" # 1.2 - 1.5 times nCPU works well on most machines that support -jC -JOB_MAX_C ?= 1.33C +# if the factor is floating point, the C suffix isn't needed +JOB_MAX_C ?= 1.33 JOB_MAX ?= ${JOB_MAX_C} .endif JOB_MAX ?= 8 diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk index 708559edcdb8..e4fe3fa9a2aa 100644 --- a/share/mk/src.sys.obj.mk +++ b/share/mk/src.sys.obj.mk @@ -73,6 +73,12 @@ OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T} .endif # Must export since OBJDIR will dynamically be based on it .export OBJROOT SRCTOP +# if we didn't get SB_OBJROOT from env, +# it is handy to set it now, so we can remember it +.if empty(SB_OBJROOT) +SB_OBJROOT:= ${OBJROOT} +.export SB_OBJROOT +.endif .endif .if ${MK_DIRDEPS_BUILD} == "no" diff --git a/share/mk/stage-install.sh b/share/mk/stage-install.sh index 64d044fa048c..d9182e32feff 100755 --- a/share/mk/stage-install.sh +++ b/share/mk/stage-install.sh @@ -28,22 +28,28 @@ # "file".dirdep placed in "dest" or "dest".dirdep if it happed # to be a file rather than a directory. # +# Before we run install(1), we check if "dest" needs to be a +# directory (more than one file in "args") and create it +# if necessary. +# # SEE ALSO: # meta.stage.mk -# +# # RCSid: -# $Id: stage-install.sh,v 1.5 2013/04/19 16:32:24 sjg Exp $ +# $Id: stage-install.sh,v 1.11 2024/02/17 17:26:57 sjg Exp $ # -# @(#) Copyright (c) 2013, Simon J. Gerraty +# SPDX-License-Identifier: BSD-2-Clause +# +# @(#) Copyright (c) 2013-2020, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. # Permission to copy, redistribute or otherwise -# use this file is hereby granted provided that +# use this file is hereby granted provided that # the above copyright notice and this notice are -# left intact. -# +# left intact. +# # Please send copies of changes and bug-fixes to: # sjg@crufty.net # @@ -59,6 +65,45 @@ do esac done +# get last entry from "$@" without side effects +last_entry() { + while [ $# -gt 8 ] + do + shift 8 + done + eval last=\$$# + echo $last +} + +# mkdir $dest if needed (more than one file) +mkdir_if_needed() { + ( + lf= + while [ $# -gt 8 ] + do + shift 4 + done + for f in "$@" + do + [ -f $f ] || continue + [ $f = $dest ] && continue + if [ -n "$lf" ]; then + # dest must be a directory + mkdir -p $dest + break + fi + lf=$f + done + ) +} + +args="$@" +dest=`last_entry "$@"` +case " $args " in +*" -d "*) ;; +*) [ -e $dest ] || mkdir_if_needed "$@";; +esac + # if .dirdep doesn't exist, just run install and be done _DIRDEP=${_DIRDEP:-$OBJDIR/.dirdep} [ -s $_DIRDEP ] && EXEC= || EXEC=exec @@ -74,18 +119,16 @@ StageDirdep() { t=$1 if [ -s $t.dirdep ]; then cmp -s $_DIRDEP $t.dirdep && return - echo "ERROR: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2 - exit 1 + case "${STAGE_CONFLICT:-error}" in + [Ee]*) STAGE_CONFLICT=ERROR action=exit;; + *) STAGE_CONFLICT=WARNING action=: ;; + esac + echo "$STAGE_CONFLICT: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2 + $action 1 fi LnCp $_DIRDEP $t.dirdep || exit 1 } -args="$@" -while [ $# -gt 8 ] -do - shift 8 -done -eval dest=\$$# if [ -f $dest ]; then # a file, there can be only one .dirdep needed StageDirdep $dest