git: 010e53f7c690 - main - git-arc: add initial non-FreeBSD and `$HOME` install support

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 23:32:52 UTC
The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=010e53f7c6908bee93d1bd32fb4b1658b0f19eef

commit 010e53f7c6908bee93d1bd32fb4b1658b0f19eef
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-10-29 20:59:38 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-10-29 23:31:58 +0000

    git-arc: add initial non-FreeBSD and `$HOME` install support
    
    Modify the existing code to permit setting a prefix via the `PREFIX`
    make variable, similar to what `--prefix` provides in autotools-based
    projects.
    
    Add the required compatibility glue in order to function with vanilla
    bmake, which enables installing the commands with Linux and macOS:
    - vanilla bmake requires `scripts.mk` to install `SCRIPTS`.
    - vanilla bmake does not tack `/man` on to the end of `MANDIR`, like
      with FreeBSD.
    
    Adjust the sysctl calls to instead look for `arc` in `$PATH` using
    `command -v` instead of hardcoding the path to the `arc` binary. This
    allows the command to invoke `phorge` as well as the legacy `arcanist`
    tool.
    
    While here, update the origin for `arcanist` as the former is the
    non-phorge fork is no longer supported (nor needed).
    
    NOTE:
    - regarding Linux support: this should now function out of the box with
      Linux as long as the host has access to an appropriate `arc` binary.
    - regarding macOS support: the arcanist/phorge packages do not yet
      exist in Homebrew or MacPorts, but are being added soon.
    
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D60995
---
 tools/tools/git/Makefile   | 12 +++++++++++-
 tools/tools/git/git-arc.sh |  6 ++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/tools/git/Makefile b/tools/tools/git/Makefile
index ee73ad178486..3d5d05e3ce61 100644
--- a/tools/tools/git/Makefile
+++ b/tools/tools/git/Makefile
@@ -1,5 +1,15 @@
 SCRIPTS=	git-arc.sh git-mfc
-BINDIR?=	/usr/local/bin
+PREFIX?=	/usr/local
+BINDIR=		${PREFIX}/bin
 MAN=		git-arc.1 git-mfc.1
 
+.if ${.MAKE.OS} == "FreeBSD"
+MANDIR?=	${PREFIX}/share/man/man
+.else
+# Work with vanilla bmake on alternate OSes, e.g., Linux, macOS, etc.
+MANDIR?=	${PREFIX}/share/man
+
+.include <scripts.mk>
+.endif
+
 .include <bsd.prog.mk>
diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
index efc29b92865d..537ac0f58d85 100755
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -101,7 +101,7 @@ get_bool_config()
 #
 setup()
 {
-    [ -x "${ARC_CMD}" ] || err "arc is required, install devel/arcanist-lib"
+    [ -x "${ARC_CMD}" ] || err "arc is required, install devel/phorgeit-arcanist-lib"
     which jq >/dev/null 2>&1 || err "jq is required, install textproc/jq"
 
     if [ "$VERBOSE" ]; then
@@ -152,9 +152,7 @@ setup()
 # the devel/arcanist-port, which installs a symlink in ${LOCALBASE}/bin
 # but conflicts with the archivers/arc port.
 #
-: "${LOCALBASE:=$(sysctl -n user.localbase)}"
-: "${LOCALBASE:=/usr/local}"
-: "${ARC_CMD:=${LOCALBASE}/lib/php/arcanist/bin/arc}"
+: "${ARC_CMD:="$(command -v arc)"}"
 arc()
 {
     ${ARC_CMD} "$@"