Unverified Commit d653d780 authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

phpPackages.phan: use `buildComposerProject` builder

parent 7491aa43
Loading
Loading
Loading
Loading
+15 −27
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, php
, mkDerivation
, fetchurl
, makeWrapper
}:
let
  php' = php.withExtensions ({ enabled, all }: enabled ++ [ all.ast ]);
in
mkDerivation rec {

(php.withExtensions({ enabled, all }: enabled ++ (with all; [ ast ]))).buildComposerProject (finalAttrs: {
  pname = "phan";
  version = "5.4.3";

  src = fetchurl {
    url = "https://github.com/phan/phan/releases/download/${version}/phan.phar";
    hash = "sha256-wZU6YIlH0q18iD044y6Z5gSscBn7cI0AwRwZgT/YhOo=";
  src = fetchFromGitHub {
    owner = "phan";
    repo = "phan";
    rev = finalAttrs.version;
    hash = "sha256-O0dtnDsz6X99B99VbRQf3Wr/xJfsJqd+2l5Z5iWxHyU=";
  };

  dontUnpack = true;

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    install -D $src $out/libexec/phan/phan.phar
    makeWrapper ${php'}/bin/php $out/bin/phan \
      --add-flags "$out/libexec/phan/phan.phar"
    runHook postInstall
  '';
  vendorHash = "sha256-yE85MBseJa0VGV5EbjT0te4QT3697YvtumGkMMfZtxI=";

  meta = with lib; {
  meta = {
    description = "Static analyzer for PHP";
    homepage = "https://github.com/phan/phan";
    license = lib.licenses.mit;
    longDescription = ''
      Phan is a static analyzer for PHP. Phan prefers to avoid false-positives
      and attempts to prove incorrectness rather than correctness.
    '';
    license = licenses.mit;
    homepage = "https://github.com/phan/phan";
    maintainers = [ maintainers.apeschar ];
    mainProgram = "phan";
    maintainers = with lib.maintainers; [ apeschar ] ++ lib.teams.php.members;
  };
}
})