1{ lib, stdenv, fetchFromGitHub, which }:
2
3stdenv.mkDerivation rec {
4 pname = "libpg_query";
5 version = "13-2.0.4";
6
7 src = fetchFromGitHub {
8 owner = "pganalyze";
9 repo = "libpg_query";
10 rev = version;
11 sha256 = "0d88fh613kh1izb6w288bfh7s3db4nz8cxyhmhq3lb7gl4axs2pv";
12 };
13
14 nativeBuildInputs = [ which ];
15
16 makeFlags = [ "build" ];
17
18 installPhase = ''
19 install -Dm644 -t $out/lib libpg_query.a
20 install -Dm644 -t $out/include pg_query.h
21 '';
22
23 meta = with lib; {
24 homepage = "https://github.com/pganalyze/libpg_query";
25 description = "C library for accessing the PostgreSQL parser outside of the server environment";
26 changelog = "https://github.com/pganalyze/libpg_query/raw/${version}/CHANGELOG.md";
27 license = licenses.bsd3;
28 platforms = platforms.x86_64;
29 maintainers = [ maintainers.marsam ];
30 };
31}