Skip to content

Commit

Permalink
fix: Build static postgrest with GSSAPI support
Browse files Browse the repository at this point in the history
Resolves #2815
  • Loading branch information
wolfgangwalther committed Jan 25, 2024
1 parent b3ec091 commit f9d96f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- #3149, Misleading "Starting PostgREST.." logs on schema cache reloading - @steve-chavez
- #2815, Build static executable with GSSAPI support - @wolfgangwalther

### Deprecated

Expand Down
9 changes: 8 additions & 1 deletion nix/libpq.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ stdenv.mkDerivation {
"--without-gssapi"
"--without-icu"
"--without-readline"
"--with-gssapi"
"--with-openssl"
"--with-system-tzdata=${tzdata}/share/zoneinfo"
];

nativeBuildInputs = [ pkg-config tzdata ];
buildInputs = [ openssl zlib ];
buildInputs = [ libkrb5 openssl zlib ];

buildFlags = [ "submake-libpq" "submake-libpgport" ];

Expand All @@ -48,6 +49,12 @@ stdenv.mkDerivation {
runHook postInstall
'';

# To avoid linking errors in the static build with gssapi
postInstall = ''
substituteInPlace $out/lib/pkgconfig/libpq.pc\
--replace "Requires.private:" "Requires.private: krb5-gssapi,"
'';

outputs = [ "out" ];

meta = with lib; {
Expand Down
7 changes: 5 additions & 2 deletions nix/static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ let
# static libs for libpq.
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.pkgsStatic.pkg-config ];

buildInputs = [
pkgsStatic.openssl
buildInputs = prevAttrs.buildInputs ++ [
(pkgsStatic.libkrb5.overrideAttrs (finalAttrs: prevAttrs: {
# disable keyutils dependency, to avoid linking errors
configureFlags = prevAttrs.configureFlags ++ [ "--without-keyutils" ];
}))
];
});
});
Expand Down

0 comments on commit f9d96f6

Please sign in to comment.