Skip to content

Commit 9b5146e

Browse files
authored
Sam/plv8 version update (#1226)
* feat: wip plv8 update on aarch64-linux * feat: bring back to 3.1.10 to both support pg 16 and retain plcoffee/plls * feat: update to latest that retain plcoffee and plls and pg16 --------- Co-authored-by: Sam Rose <[email protected]>
1 parent 64c0dea commit 9b5146e

File tree

2 files changed

+23
-36
lines changed

2 files changed

+23
-36
lines changed

Diff for: nix/ext/0001-build-Allow-using-V8-from-system.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ index 38879cc..6e78eeb 100644
55
@@ -20,6 +20,7 @@ OBJS = $(SRCS:.cc=.o)
66
MODULE_big = plv8-$(PLV8_VERSION)
77
EXTENSION = plv8
8-
PLV8_DATA = plv8.control plv8--$(PLV8_VERSION).sql $(wildcard upgrade/*.sql)
8+
PLV8_DATA = plv8.control plv8--$(PLV8_VERSION).sql
99
+USE_SYSTEM_V8 = 0
1010

1111

Diff for: nix/ext/plv8.nix

+22-35
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,32 @@
44
, v8
55
, perl
66
, postgresql
7-
# For test
7+
# For passthru test on various systems, and local development on macos
8+
# not we are not currently using passthru tests but retaining for possible contrib
9+
# to nixpkgs
810
, runCommand
911
, coreutils
1012
, gnugrep
1113
, clang
12-
, patchelf
1314
, xcbuild
1415
, darwin
16+
, patchelf
1517
}:
1618

1719
stdenv.mkDerivation (finalAttrs: {
1820
pname = "plv8";
19-
version = "3.1.5";
21+
version = "3.1.10";
2022

2123
src = fetchFromGitHub {
2224
owner = "plv8";
2325
repo = "plv8";
2426
rev = "v${finalAttrs.version}";
25-
hash = "sha256-LodC2eQJSm5fLckrjm2RuejZhmOyQMJTv9b0iPCnzKQ=";
27+
hash = "sha256-g1A/XPC0dX2360Gzvmo9/FSQnM6Wt2K4eR0pH0p9fz4=";
2628
};
2729

2830
patches = [
31+
# Allow building with system v8.
32+
# https://github.com/plv8/plv8/pull/505 (rejected)
2933
./0001-build-Allow-using-V8-from-system.patch
3034
];
3135

@@ -37,9 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
3741
];
3842

3943
buildInputs = [
40-
(v8.overrideAttrs (oldAttrs: {
41-
version = "9.7.106.18";
42-
}))
44+
v8
4345
postgresql
4446
] ++ lib.optionals stdenv.isDarwin [
4547
darwin.apple_sdk.frameworks.CoreFoundation
@@ -49,15 +51,16 @@ stdenv.mkDerivation (finalAttrs: {
4951
buildFlags = [ "all" ];
5052

5153
makeFlags = [
54+
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
5255
"USE_SYSTEM_V8=1"
5356
"V8_OUTDIR=${v8}/lib"
54-
"PG_CONFIG=${postgresql}/bin/pg_config"
57+
"PG_CONFIG=${postgresql}/bin/pg_config"
5558
] ++ lib.optionals stdenv.isDarwin [
5659
"CC=${clang}/bin/clang"
5760
"CXX=${clang}/bin/clang++"
5861
"SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib"
5962
] ++ lib.optionals (!stdenv.isDarwin) [
60-
"SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib"
63+
"SHLIB_LINK=-lv8"
6164
];
6265

6366
NIX_LDFLAGS = (lib.optionals stdenv.isDarwin [
@@ -73,45 +76,31 @@ stdenv.mkDerivation (finalAttrs: {
7376
"-framework" "Kerberos"
7477
"-undefined" "dynamic_lookup"
7578
"-flat_namespace"
76-
]) ++ (lib.optionals (!stdenv.isDarwin) [
77-
"-L${postgresql}/lib"
78-
"-L${v8}/lib"
79-
"-lv8_monolith"
80-
"-lpq"
81-
"-lpgcommon"
82-
"-lpgport"
83-
]);
84-
85-
NIX_CFLAGS_COMPILE = [
86-
"-I${v8}/include"
87-
"-I${postgresql}/include"
88-
"-I${postgresql}/include/server"
89-
"-I${postgresql}/include/internal"
90-
];
79+
]);
9180

9281
installFlags = [
82+
# PGXS only supports installing to postgresql prefix so we need to redirect this
9383
"DESTDIR=${placeholder "out"}"
9484
];
9585

86+
# No configure script.
9687
dontConfigure = true;
9788

9889
postPatch = ''
9990
patchShebangs ./generate_upgrade.sh
10091
substituteInPlace generate_upgrade.sh \
10192
--replace " 2.3.10 " " 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.15 "
102-
93+
10394
${lib.optionalString stdenv.isDarwin ''
10495
# Replace g++ with clang++ in Makefile
10596
sed -i 's/g++/clang++/g' Makefile
10697
''}
10798
'';
10899

109-
preBuild = lib.optionalString stdenv.isDarwin ''
110-
export CC=${clang}/bin/clang
111-
export CXX=${clang}/bin/clang++
112-
'';
113-
114100
postInstall = ''
101+
# Move the redirected to proper directory.
102+
# There appear to be no references to the install directories
103+
# so changing them does not cause issues.
115104
mv "$out/nix/store"/*/* "$out"
116105
rmdir "$out/nix/store"/* "$out/nix/store" "$out/nix"
117106
@@ -133,9 +122,8 @@ stdenv.mkDerivation (finalAttrs: {
133122
postgresqlWithSelf = postgresql.withPackages (_: [
134123
finalAttrs.finalPackage
135124
]);
136-
in
137-
{
138-
smoke = runCommand "plv8-smoke-test" { } ''
125+
in {
126+
smoke = runCommand "plv8-smoke-test" {} ''
139127
export PATH=${lib.makeBinPath [
140128
postgresqlWithSelf
141129
coreutils
@@ -198,6 +186,5 @@ stdenv.mkDerivation (finalAttrs: {
198186
maintainers = with maintainers; [ samrose ];
199187
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
200188
license = licenses.postgresql;
201-
#broken = postgresql.jitSupport;
202189
};
203-
})
190+
})

0 commit comments

Comments
 (0)