2020-11-12 09:05:59 +00:00
|
|
|
|
{ bison
|
2021-10-08 15:17:17 +00:00
|
|
|
|
, cacert
|
2020-11-12 09:05:59 +00:00
|
|
|
|
, fetchFromGitHub
|
|
|
|
|
, flex
|
|
|
|
|
, php
|
2021-02-05 17:12:51 +00:00
|
|
|
|
, lib, stdenv
|
2021-09-18 10:52:07 +00:00
|
|
|
|
, installShellFiles
|
2022-04-03 18:54:34 +00:00
|
|
|
|
, which
|
|
|
|
|
, python3
|
2020-11-12 09:05:59 +00:00
|
|
|
|
}:
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
|
|
# Make a custom wrapper. If `wrapProgram` is used, arcanist thinks .arc-wrapped is being
|
|
|
|
|
# invoked and complains about it being an unknown toolset. We could use `makeWrapper`, but
|
|
|
|
|
# then we’d need to still craft a script that does the `php libexec/arcanist/bin/...` dance
|
|
|
|
|
# anyway... So just do everything at once.
|
|
|
|
|
let makeArcWrapper = toolset: ''
|
2020-11-12 09:05:59 +00:00
|
|
|
|
cat << WRAPPER > $out/bin/${toolset}
|
|
|
|
|
#!$shell -e
|
2022-04-03 18:54:34 +00:00
|
|
|
|
export PATH='${php}/bin:${which}/bin'\''${PATH:+':'}\$PATH
|
2020-11-12 09:05:59 +00:00
|
|
|
|
exec ${php}/bin/php $out/libexec/arcanist/bin/${toolset} "\$@"
|
|
|
|
|
WRAPPER
|
|
|
|
|
chmod +x $out/bin/${toolset}
|
2020-08-20 17:08:02 +00:00
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
pname = "arcanist";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
version = "20220517";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "phacility";
|
|
|
|
|
repo = "arcanist";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
rev = "85c953ebe4a6fef332158fd757d97c5a58682d3a";
|
|
|
|
|
sha256 = "0x847fw74mzrbhzpgc4iqgvs6dsf4svwfa707dsbxi78fn2lxbl7";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
|
patches = [
|
|
|
|
|
./dont-require-python3-in-path.patch
|
|
|
|
|
./shellcomplete-strlen-null.patch
|
|
|
|
|
];
|
2022-04-03 18:54:34 +00:00
|
|
|
|
|
|
|
|
|
buildInputs = [ php python3 ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ bison flex installShellFiles ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
|
postPatch = lib.optionalString stdenv.isAarch64 ''
|
2020-08-20 17:08:02 +00:00
|
|
|
|
substituteInPlace support/xhpast/Makefile \
|
2020-04-24 23:36:52 +00:00
|
|
|
|
--replace "-minline-all-stringops" ""
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
buildPhase = ''
|
2021-09-18 10:52:07 +00:00
|
|
|
|
runHook preBuild
|
|
|
|
|
make cleanall -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
|
|
|
|
|
make xhpast -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
|
|
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
installPhase = ''
|
2021-09-18 10:52:07 +00:00
|
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
|
mkdir -p $out/bin $out/libexec
|
2021-09-18 10:52:07 +00:00
|
|
|
|
make install -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
|
|
|
|
|
make cleanall -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
|
2020-11-12 09:05:59 +00:00
|
|
|
|
cp -R . $out/libexec/arcanist
|
2021-10-08 15:17:17 +00:00
|
|
|
|
ln -sf ${cacert}/etc/ssl/certs/ca-bundle.crt $out/libexec/arcanist/resources/ssl/default.pem
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
|
|
${makeArcWrapper "arc"}
|
|
|
|
|
${makeArcWrapper "phage"}
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
|
|
$out/bin/arc shell-complete --generate --
|
|
|
|
|
installShellCompletion --cmd arc --bash $out/libexec/arcanist/support/shell/rules/bash-rules.sh
|
|
|
|
|
installShellCompletion --cmd phage --bash $out/libexec/arcanist/support/shell/rules/bash-rules.sh
|
|
|
|
|
runHook postInstall
|
2020-08-20 17:08:02 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
|
$out/bin/arc help diff -- > /dev/null
|
|
|
|
|
$out/bin/phage help alias -- > /dev/null
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
|
description = "Command line interface to Phabricator";
|
2020-11-12 09:05:59 +00:00
|
|
|
|
homepage = "http://phabricator.org";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
license = lib.licenses.asl20;
|
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
|
maintainers = [ lib.maintainers.thoughtpolice ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
}
|