@@ -1,20 +1,24 @@
1−{ stdenv, fetchFromGitHub, php, flex }:
1+{ bison
2+, fetchFromGitHub
3+, flex
4+, php
5+, stdenv
6+}:
27
38# Make a custom wrapper. If `wrapProgram` is used, arcanist thinks .arc-wrapped is being
49# invoked and complains about it being an unknown toolset. We could use `makeWrapper`, but
510# then we’d need to still craft a script that does the `php libexec/arcanist/bin/...` dance
611# anyway... So just do everything at once.
712let makeArcWrapper = toolset: ''
8− cat << WRAPPER > $out/bin/${toolset}
9− #!$shell -e
10− export PATH='${php}/bin/'\''${PATH:+':'}\$PATH
11− exec ${php}/bin/php $out/libexec/arcanist/bin/${toolset} "\$@"
12− WRAPPER
13− chmod +x $out/bin/${toolset}
13+ cat << WRAPPER > $out/bin/${toolset}
14+ #!$shell -e
15+ export PATH='${php}/bin/'\''${PATH:+':'}\$PATH
16+ exec ${php}/bin/php $out/libexec/arcanist/bin/${toolset} "\$@"
17+ WRAPPER
18+ chmod +x $out/bin/${toolset}
1419'';
1520
1621in
17−
1822stdenv.mkDerivation {
1923 pname = "arcanist";
2024 version = "20200711";
@@ -25,7 +29,7 @@ stdenv.mkDerivation {
2529 rev = "2565cc7b4d1dbce6bc7a5b3c4e72ae94be4712fe";
2630 sha256 = "0jiv4aj4m5750dqw9r8hizjkwiyxk4cg4grkr63sllsa2dpiibxw";
2731 };
28− buildInputs = [ php flex ];
32+ buildInputs = [ bison flex php ];
2933
3034 postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
3135 substituteInPlace support/xhpast/Makefile \
@@ -33,13 +37,15 @@ stdenv.mkDerivation {
3337 '';
3438
3539 buildPhase = ''
40+ make cleanall -C support/xhpast
3641 make xhpast -C support/xhpast
3742 '';
3843
3944 installPhase = ''
4045 mkdir -p $out/bin $out/libexec
4146 make install -C support/xhpast
42− cp -R $src $out/libexec/arcanist
47+ make cleanall -C support/xhpast
48+ cp -R . $out/libexec/arcanist
4349
4450 ${makeArcWrapper "arc"}
4551 ${makeArcWrapper "phage"}
@@ -53,9 +59,9 @@ stdenv.mkDerivation {
5359
5460 meta = {
5561 description = "Command line interface to Phabricator";
56− homepage = "http://phabricator.org";
57− license = stdenv.lib.licenses.asl20;
58− platforms = stdenv.lib.platforms.unix;
62+ homepage = "http://phabricator.org";
63+ license = stdenv.lib.licenses.asl20;
64+ platforms = stdenv.lib.platforms.unix;
5965 maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
6066 };
6167}