Commit 6d50b4ba authored by Connor Feeley's avatar Connor Feeley Committed by Cole Helbling
Browse files

pgbadger: fix build on darwin

The pgbadger build was failing on darwin due to an error while trying to
generate the package's documentation.

The pgbadger script is executed during the build to dump the help text.
The script's shebang line is too long on Darwin and needs to be
shortened using 'shortenPerlShebang' for it to execute.
parent 042dce1f
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
{ buildPerlPackage, stdenv, lib, fetchFromGitHub, which, bzip2, PodMarkdown, JSONXS
{ buildPerlPackage, shortenPerlShebang, stdenv, lib, fetchFromGitHub, which, bzip2, PodMarkdown, JSONXS
, TextCSV_XS }:
buildPerlPackage rec {
  pname = "pgbadger";
@@ -14,11 +14,19 @@ buildPerlPackage rec {
    patchShebangs ./pgbadger
  '';

  # pgbadger has too many `-Idir` flags on its shebang line on Darwin,
  # causing the build to fail when trying to generate the documentation.
  # Rewrite the -I flags in `use lib` form.
  preBuild = lib.optionalString stdenv.isDarwin ''
    shortenPerlShebang ./pgbadger
  '';

  outputs = [ "out" ];

  PERL_MM_OPT = "INSTALL_BASE=${placeholder "out"}";

  buildInputs = [ PodMarkdown JSONXS TextCSV_XS ];
  nativeBuildInputs = lib.optionals stdenv.isDarwin [ shortenPerlShebang ];

  nativeCheckInputs = [ which bzip2 ];

@@ -28,6 +36,5 @@ buildPerlPackage rec {
    changelog = "https://github.com/darold/pgbadger/raw/v${version}/ChangeLog";
    license = lib.licenses.postgresql;
    maintainers = lib.teams.determinatesystems.members;
    broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/pgbadger.x86_64-darwin
  };
}