Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 which, 6 squawk, 7 protobufc, 8 xxHash, 9}: 10stdenv.mkDerivation rec { 11 pname = "libpg_query"; 12 version = "17-6.1.0"; 13 14 src = fetchFromGitHub { 15 owner = "pganalyze"; 16 repo = "libpg_query"; 17 tag = version; 18 hash = "sha256-UXba2WYyIO7RcFcNZeLL+Q9CwlloMZ5oFfHfL7+j4dU="; 19 }; 20 21 nativeBuildInputs = [ which ]; 22 23 makeFlags = [ 24 "build" 25 "build_shared" 26 ]; 27 28 installPhase = '' 29 runHook preInstall 30 31 install -Dm644 libpg_query.a -t $out/lib 32 install -Dm644 libpg_query${stdenv.hostPlatform.extensions.sharedLibrary} -t $out/lib 33 cp -r src/include $out/include 34 cp -r src/postgres/include/* $out/include 35 cp -r protobuf $out/include/protobuf 36 ln -s ${protobufc.dev}/include/protobuf-c $out/include/protobuf-c 37 cp -r ${protobufc.dev}/include/protobuf-c/* $out/include 38 ln -s ${xxHash}/include $out/include/xxhash 39 install -Dm644 pg_query.h -t $out/include 40 41 runHook postInstall 42 ''; 43 44 doCheck = true; 45 46 checkTarget = "test"; 47 48 passthru.tests = { 49 inherit squawk; 50 }; 51 52 meta = { 53 homepage = "https://github.com/pganalyze/libpg_query"; 54 description = "C library for accessing the PostgreSQL parser outside of the server environment"; 55 changelog = "https://github.com/pganalyze/libpg_query/blob/${version}/CHANGELOG.md"; 56 license = lib.licenses.bsd3; 57 platforms = lib.platforms.unix; 58 maintainers = [ ]; 59 }; 60}