Skip to content

Commit 61c6b20

Browse files
committed
feat: bring back to 3.1.10 to both support pg 16 and retain plcoffee/plls
1 parent 9242eba commit 61c6b20

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed
Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
11
diff --git a/Makefile b/Makefile
2-
index a705c11..08b952b 100644
2+
index 38879cc..6e78eeb 100644
33
--- a/Makefile
44
+++ b/Makefile
5-
@@ -13,11 +13,14 @@ OBJS = $(SRCS:.cc=.o)
5+
@@ -20,6 +20,7 @@ OBJS = $(SRCS:.cc=.o)
66
MODULE_big = plv8-$(PLV8_VERSION)
77
EXTENSION = plv8
88
PLV8_DATA = plv8.control plv8--$(PLV8_VERSION).sql
99
+USE_SYSTEM_V8 = 0
1010

11-
ifeq ($(OS),Windows_NT)
12-
# noop for now
13-
else
14-
+ ifeq ($(USE_SYSTEM_V8),0)
15-
SHLIB_LINK += -Ldeps/v8-cmake/build
16-
+ endif
17-
UNAME_S := $(shell uname -s)
18-
ifeq ($(UNAME_S),Darwin)
19-
CCFLAGS += -stdlib=libc++
20-
@@ -34,6 +37,7 @@ ifeq ($(NUMPROC),0)
21-
NUMPROC = 1
22-
endif
23-
24-
+ifeq ($(USE_SYSTEM_V8),0)
25-
SHLIB_LINK += -Ldeps/v8-cmake/build
2611

27-
all: v8 $(OBJS)
28-
@@ -46,11 +50,16 @@ deps/v8-cmake/build/libv8_libbase.a:
29-
@cd deps/v8-cmake && mkdir -p build && cd build && cmake -Denable-fPIC=ON -DCMAKE_BUILD_TYPE=Release ../ && make -j $(NUMPROC)
12+
# Platform detection
13+
@@ -41,6 +42,7 @@ PGXS := $(shell $(PG_CONFIG) --pgxs)
14+
PG_VERSION_NUM := $(shell cat `$(PG_CONFIG) --includedir-server`/pg_config*.h \
15+
| perl -ne 'print $$1 and exit if /PG_VERSION_NUM\s+(\d+)/')
3016

31-
v8: deps/v8-cmake/build/libv8_libbase.a
32-
+else
33-
+all: $(OBJS)
17+
+ifeq ($(USE_SYSTEM_V8),0)
18+
AUTOV8_DIR = build/v8
19+
AUTOV8_OUT = build/v8/out.gn/obj
20+
AUTOV8_STATIC_LIBS = -lv8_libplatform -lv8_libbase
21+
@@ -66,6 +68,7 @@ v8:
22+
make -f Makefiles/Makefile.macos v8
23+
endif
24+
endif
3425
+endif
3526

3627
# enable direct jsonb conversion by default
3728
CCFLAGS += -DJSONB_DIRECT_CONVERSION
29+
@@ -83,6 +86,7 @@ ifdef BIGINT_GRACEFUL
30+
endif
31+
3832

3933
+ifeq ($(USE_SYSTEM_V8),0)
40-
CCFLAGS += -Ideps/v8-cmake/v8/include -std=c++17
34+
# We're gonna build static link. Rip it out after include Makefile
35+
SHLIB_LINK := $(filter-out -lv8, $(SHLIB_LINK))
36+
37+
@@ -101,6 +105,7 @@ else
38+
SHLIB_LINK += -lrt -std=c++14
39+
endif
40+
endif
4141
+endif
4242

43-
ifdef EXECUTION_TIMEOUT
44-
CCFLAGS += -DEXECUTION_TIMEOUT
43+
DATA = $(PLV8_DATA)
44+
ifndef DISABLE_DIALECT
45+
--
46+
2.37.3

nix/ext/plv8.nix

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ stdenv
22
, lib
33
, fetchFromGitHub
4-
, nodejs_20
4+
, v8
55
, perl
66
, postgresql
77
# For test
@@ -10,17 +10,15 @@
1010
, gnugrep
1111
}:
1212

13-
let
14-
libv8 = nodejs_20.libv8;
15-
in stdenv.mkDerivation (finalAttrs: {
13+
stdenv.mkDerivation (finalAttrs: {
1614
pname = "plv8";
17-
version = "3.2.2";
15+
version = "3.1.10";
1816

1917
src = fetchFromGitHub {
2018
owner = "plv8";
2119
repo = "plv8";
2220
rev = "v${finalAttrs.version}";
23-
hash = "sha256-azO33v22EF+/sTNmwswxyDR0PhrvWfTENuLu6JgSGJ0=";
21+
hash = "sha256-g1A/XPC0dX2360Gzvmo9/FSQnM6Wt2K4eR0pH0p9fz4=";
2422
};
2523

2624
patches = [
@@ -34,7 +32,7 @@ in stdenv.mkDerivation (finalAttrs: {
3432
];
3533

3634
buildInputs = [
37-
libv8
35+
v8
3836
postgresql
3937
];
4038

@@ -44,7 +42,7 @@ in stdenv.mkDerivation (finalAttrs: {
4442
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
4543
"USE_SYSTEM_V8=1"
4644
"SHLIB_LINK=-lv8"
47-
"V8_OUTDIR=${libv8}/lib"
45+
"V8_OUTDIR=${v8}/lib"
4846
];
4947

5048
installFlags = [
@@ -57,6 +55,8 @@ in stdenv.mkDerivation (finalAttrs: {
5755

5856
postPatch = ''
5957
patchShebangs ./generate_upgrade.sh
58+
substituteInPlace generate_upgrade.sh \
59+
--replace " 2.3.10 " " 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.15 "
6060
'';
6161

6262
postInstall = ''

0 commit comments

Comments
 (0)