2020-11-12 09:05:59 +00:00
|
|
|
|
{ bison
|
|
|
|
|
, fetchFromGitHub
|
|
|
|
|
, flex
|
|
|
|
|
, php
|
2021-02-05 17:12:51 +00:00
|
|
|
|
, lib, stdenv
|
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
|
|
|
|
|
export PATH='${php}/bin/'\''${PATH:+':'}\$PATH
|
|
|
|
|
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";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
version = "20200711";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "phacility";
|
|
|
|
|
repo = "arcanist";
|
|
|
|
|
rev = "2565cc7b4d1dbce6bc7a5b3c4e72ae94be4712fe";
|
|
|
|
|
sha256 = "0jiv4aj4m5750dqw9r8hizjkwiyxk4cg4grkr63sllsa2dpiibxw";
|
|
|
|
|
};
|
2020-11-12 09:05:59 +00:00
|
|
|
|
buildInputs = [ bison flex php ];
|
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 = ''
|
2020-11-12 09:05:59 +00:00
|
|
|
|
make cleanall -C support/xhpast
|
2020-08-20 17:08:02 +00:00
|
|
|
|
make xhpast -C support/xhpast
|
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 = ''
|
|
|
|
|
mkdir -p $out/bin $out/libexec
|
2020-08-20 17:08:02 +00:00
|
|
|
|
make install -C support/xhpast
|
2020-11-12 09:05:59 +00:00
|
|
|
|
make cleanall -C support/xhpast
|
|
|
|
|
cp -R . $out/libexec/arcanist
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
|
|
${makeArcWrapper "arc"}
|
|
|
|
|
${makeArcWrapper "phage"}
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
}
|