Merge pull request #258755 from marsam/postgresql-pg_hint_plan-support-more-versions

postgresqlPackages.pg_hint_plan: support more PostgreSQL versions

authored by Mario Rodas and committed by GitHub 3bbc6d88 76dc04b0

+41 -11
+41 -11
pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix
··· 1 1 { lib, stdenv, fetchFromGitHub, postgresql }: 2 2 3 - stdenv.mkDerivation rec { 3 + let 4 + source = { 5 + "16" = { 6 + version = "1.6.0"; 7 + hash = "sha256-lg7N0QblluTgtNo1tGZjirNJSyQXtcAEs9Jqd3zx0Sg="; 8 + }; 9 + "15" = { 10 + version = "1.5.1"; 11 + hash = "sha256-o8Hepf/Mc1ClRTLZ6PBdqU4jSdlz+ijVgl2vJKmIc6M="; 12 + }; 13 + "14" = { 14 + version = "1.4.2"; 15 + hash = "sha256-nGyKcNY57RdQdZKSaBPk2/YbT0Annz1ZevH0lKswdhA="; 16 + }; 17 + "13" = { 18 + version = "1.3.9"; 19 + hash = "sha256-KGcHDwk8CgNHPZARfLBfS8r7TRCP9LPjT+m4fNSnnW0="; 20 + }; 21 + "12" = { 22 + version = "1.3.9"; 23 + hash = "sha256-64/dlm6e4flCxMQ8efsxfKSlja+Tko0zsghTgLatN+Y="; 24 + }; 25 + "11" = { 26 + version = "1.3.9"; 27 + hash = "sha256-8t/HhB/2Kjx4xMItmmKv3g9gba5VCBHdplYtYD/3UhA="; 28 + }; 29 + }.${lib.versions.major postgresql.version} or (throw "Source for pg_hint_plan is not available for ${postgresql.version}"); 30 + in 31 + stdenv.mkDerivation { 4 32 pname = "pg_hint_plan"; 5 - version = "14-1.4.0"; 33 + inherit (source) version; 6 34 7 35 src = fetchFromGitHub { 8 36 owner = "ossc-db"; 9 - repo = pname; 10 - rev = "REL${builtins.replaceStrings ["-" "."] ["_" "_"] version}"; 11 - sha256 = "sha256-2hYDn/69264x2lMRVIp/I5chjocL6UqIw5ry1qdRcDM="; 37 + repo = "pg_hint_plan"; 38 + rev = "REL${lib.versions.major postgresql.version}_${builtins.replaceStrings ["."] ["_"] source.version}"; 39 + inherit (source) hash; 12 40 }; 13 41 42 + postPatch = lib.optionalString (lib.versionOlder postgresql.version "14") '' 43 + # https://github.com/ossc-db/pg_hint_plan/commit/e9e564ad59b8bd4a03e0f13b95b5122712e573e6 44 + substituteInPlace Makefile --replace "LDFLAGS+=-Wl,--build-id" "" 45 + ''; 46 + 14 47 buildInputs = [ postgresql ]; 15 48 16 49 installPhase = '' 17 - mkdir -p $out/{lib,share/postgresql/extension} 18 - 19 - cp *.so $out/lib 20 - cp *.sql $out/share/postgresql/extension 21 - cp *.control $out/share/postgresql/extension 50 + install -D -t $out/lib pg_hint_plan.so 51 + install -D -t $out/share/postgresql/extension *.sql 52 + install -D -t $out/share/postgresql/extension *.control 22 53 ''; 23 54 24 55 meta = with lib; { ··· 27 58 maintainers = with maintainers; [ _1000101 ]; 28 59 platforms = postgresql.meta.platforms; 29 60 license = licenses.bsd3; 30 - broken = versionOlder postgresql.version "14"; 31 61 }; 32 62 }