Unverified Commit 60c81d33 authored by Elis Hirwing's avatar Elis Hirwing
Browse files

php.packages.box: Build from source

parent d84cc41f
Loading
Loading
Loading
Loading
+14 −25
Original line number Diff line number Diff line
{ mkDerivation, fetchurl, makeWrapper, lib, php }:
{ lib, php, fetchFromGitHub }:

let
php.buildComposerProject (finalAttrs: {
  pname = "box";
  version = "4.3.8";
in
mkDerivation {
  inherit pname version;

  src = fetchurl {
    url = "https://github.com/box-project/box/releases/download/${version}/box.phar";
    sha256 = "sha256-g9Y92yTsyXU4NWuQwyB3PRrKJxLRSBO9J77jumXPOxg=";
  src = fetchFromGitHub {
    owner = "box-project";
    repo = "box";
    rev = finalAttrs.version;
    hash = "sha256-v1J84nqaX36DrLLH5kld+8NIymqtt5/5nJWJNCBVFRE=";
  };

  dontUnpack = true;
  vendorHash = "sha256-LWggAUBMKljxa7HNdJMqOD/sx3IWCOQSqbYEnGntjN0=";

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    install -D $src $out/libexec/box/box.phar
    makeWrapper ${php}/bin/php $out/bin/box \
      --add-flags "-d phar.readonly=0 $out/libexec/box/box.phar"
    runHook postInstall
  '';

  meta = with lib; {
    changelog = "https://github.com/box-project/box/releases/tag/${version}";
  meta = {
    changelog = "https://github.com/box-project/box/releases/tag/${finalAttrs.version}";
    description = "An application for building and managing Phars";
    license = licenses.mit;
    license = lib.licenses.mit;
    homepage = "https://github.com/box-project/box";
    maintainers = with maintainers; [ ] ++ teams.php.members;
    maintainers = lib.teams.php.members;
    mainProgram = "box";
  };
}
})