Skip to content

Instantly share code, notes, and snippets.

@lovesegfault
Last active April 7, 2020 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovesegfault/9b7570446afd3524fe86533eb019d261 to your computer and use it in GitHub Desktop.
Save lovesegfault/9b7570446afd3524fe86533eb019d261 to your computer and use it in GitHub Desktop.
{ stdenv, fetchFromGitHub, php, flex, makeWrapper }:
let
libphutil = fetchFromGitHub {
owner = "phacility";
repo = "libphutil";
rev = "cc2a3dbf590389400da55563cb6993f321ec6d73";
sha256 = "1k7sr3racwz845i7r5kdwvgqrz8gldz07pxj3yw77s58rqbix3ad";
};
arcanist = fetchFromGitHub {
owner = "phacility";
repo = "arcanist";
rev = "21a1828ea06cf031e93082db8664d73efc88290a";
sha256 = "05rq9l9z7446ks270viay57r5ibx702b5bnlf4ck529zc4abympx";
};
phpWithExts = php.withExtensions (e: with e; [ curl json ]);
in
stdenv.mkDerivation {
pname = "arcanist";
version = "20200127";
src = [ arcanist libphutil ];
buildInputs = [ phpWithExts makeWrapper flex ];
unpackPhase = ''
cp -aR ${libphutil} libphutil
cp -aR ${arcanist} arcanist
chmod +w -R libphutil arcanist
'';
postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
substituteInPlace libphutil/support/xhpast/Makefile \
--replace "-minline-all-stringops" ""
'';
buildPhase = ''
(
cd libphutil/support/xhpast
make clean all install
)
'';
installPhase = ''
mkdir -p $out/bin $out/libexec
cp -R libphutil $out/libexec/libphutil
cp -R arcanist $out/libexec/arcanist
ln -s $out/libexec/arcanist/bin/arc $out/bin
patchShebangs --host "${phpWithExts}/bin"
wrapProgram $out/bin/arc \
--prefix PATH : "${phpWithExts}/bin"
'';
doInstallCheck = true;
installCheckPhase = ''
./arcanist/bin/arc help || exit 1
'';
# dontFixup = true;
meta = {
description = "Command line interface to Phabricator";
homepage = "http://phabricator.org";
license = stdenv.lib.licenses.asl20;
platforms = stdenv.lib.platforms.unix;
maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment