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
This commit is contained in:
Enji Cooper committed 2026-10-29 16:31:58 -07:00
1 parent 68aebfa28a
commit 010e53f7c6
2 files changed
+13 -5

No files matched your search

+11 -1
View File
@@ -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>
+2 -4
View File
@@ -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} "$@"