Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LeSuisse/9c706a4eda97f6cfe8bf296ce6102e87 to your computer and use it in GitHub Desktop.
Save LeSuisse/9c706a4eda97f6cfe8bf296ce6102e87 to your computer and use it in GitHub Desktop.
plv8 upgrade with system v8 12.5.227.9
From 51a84e5fc23be16ec5c2751271dd07eec9151e4a Mon Sep 17 00:00:00 2001
Date: Sat, 25 May 2024 13:24:45 +0200
Subject: [PATCH] postgresqlPackages.plv8: 3.1.10 -> 3.2.2
Changes:
https://github.com/plv8/plv8/blob/v3.2.2/Changes
---
...001-build-Allow-using-V8-from-system.patch | 55 +++++++++----------
.../sql/postgresql/ext/plv8/default.nix | 7 +--
2 files changed, 28 insertions(+), 34 deletions(-)
diff --git a/pkgs/servers/sql/postgresql/ext/plv8/0001-build-Allow-using-V8-from-system.patch b/pkgs/servers/sql/postgresql/ext/plv8/0001-build-Allow-using-V8-from-system.patch
index 05f607911f20..e6099771ea1a 100644
--- a/pkgs/servers/sql/postgresql/ext/plv8/0001-build-Allow-using-V8-from-system.patch
+++ b/pkgs/servers/sql/postgresql/ext/plv8/0001-build-Allow-using-V8-from-system.patch
@@ -1,47 +1,44 @@
diff --git a/Makefile b/Makefile
-index 38879cc..6e78eeb 100644
+index a705c11..08b952b 100644
--- a/Makefile
+++ b/Makefile
-@@ -20,6 +20,7 @@ OBJS = $(SRCS:.cc=.o)
+@@ -13,11 +13,14 @@ OBJS = $(SRCS:.cc=.o)
MODULE_big = plv8-$(PLV8_VERSION)
EXTENSION = plv8
PLV8_DATA = plv8.control plv8--$(PLV8_VERSION).sql
+USE_SYSTEM_V8 = 0
-
- # Platform detection
-@@ -41,6 +42,7 @@ PGXS := $(shell $(PG_CONFIG) --pgxs)
- PG_VERSION_NUM := $(shell cat `$(PG_CONFIG) --includedir-server`/pg_config*.h \
- | perl -ne 'print $$1 and exit if /PG_VERSION_NUM\s+(\d+)/')
+ ifeq ($(OS),Windows_NT)
+ # noop for now
+ else
++ ifeq ($(USE_SYSTEM_V8),0)
+ SHLIB_LINK += -Ldeps/v8-cmake/build
++ endif
+ UNAME_S := $(shell uname -s)
+ ifeq ($(UNAME_S),Darwin)
+ CCFLAGS += -stdlib=libc++
+@@ -34,6 +37,7 @@ ifeq ($(NUMPROC),0)
+ NUMPROC = 1
+ endif
+ifeq ($(USE_SYSTEM_V8),0)
- AUTOV8_DIR = build/v8
- AUTOV8_OUT = build/v8/out.gn/obj
- AUTOV8_STATIC_LIBS = -lv8_libplatform -lv8_libbase
-@@ -66,6 +68,7 @@ v8:
- make -f Makefiles/Makefile.macos v8
- endif
- endif
+ SHLIB_LINK += -Ldeps/v8-cmake/build
+
+ all: v8 $(OBJS)
+@@ -46,11 +50,16 @@ deps/v8-cmake/build/libv8_libbase.a:
+ @cd deps/v8-cmake && mkdir -p build && cd build && cmake -Denable-fPIC=ON -DCMAKE_BUILD_TYPE=Release ../ && make -j $(NUMPROC)
+
+ v8: deps/v8-cmake/build/libv8_libbase.a
++else
++all: $(OBJS)
+endif
# enable direct jsonb conversion by default
CCFLAGS += -DJSONB_DIRECT_CONVERSION
-@@ -83,6 +86,7 @@ ifdef BIGINT_GRACEFUL
- endif
-
+ifeq ($(USE_SYSTEM_V8),0)
- # We're gonna build static link. Rip it out after include Makefile
- SHLIB_LINK := $(filter-out -lv8, $(SHLIB_LINK))
-
-@@ -101,6 +105,7 @@ else
- SHLIB_LINK += -lrt -std=c++14
- endif
- endif
+ CCFLAGS += -Ideps/v8-cmake/v8/include -std=c++17
+endif
- DATA = $(PLV8_DATA)
- ifndef DISABLE_DIALECT
---
-2.37.3
-
+ ifdef EXECUTION_TIMEOUT
+ CCFLAGS += -DEXECUTION_TIMEOUT
diff --git a/pkgs/servers/sql/postgresql/ext/plv8/default.nix b/pkgs/servers/sql/postgresql/ext/plv8/default.nix
index 2e8ac591a2dd..34f7e87b3b21 100644
--- a/pkgs/servers/sql/postgresql/ext/plv8/default.nix
+++ b/pkgs/servers/sql/postgresql/ext/plv8/default.nix
@@ -13,13 +13,13 @@
stdenv.mkDerivation (finalAttrs: {
pname = "plv8";
- version = "3.1.10";
+ version = "3.2.2";
src = fetchFromGitHub {
owner = "plv8";
repo = "plv8";
rev = "v${finalAttrs.version}";
- hash = "sha256-g1A/XPC0dX2360Gzvmo9/FSQnM6Wt2K4eR0pH0p9fz4=";
+ hash = "sha256-azO33v22EF+/sTNmwswxyDR0PhrvWfTENuLu6JgSGJ0=";
};
patches = [
@@ -56,9 +56,6 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
patchShebangs ./generate_upgrade.sh
- # https://github.com/plv8/plv8/pull/506
- substituteInPlace generate_upgrade.sh \
- --replace " 2.3.10 " " 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.15 "
'';
postInstall = ''
--
2.45.1
plv8> make: *** [Makefile:102: plv8.o] Error 1
error: builder for '/nix/store/h092y67qi0fhp0b0hn8kjfmjpzsygzb5-plv8-3.2.2.drv' failed with exit code 2;
last 24 log lines:
> Running phase: unpackPhase
> unpacking source archive /nix/store/lsczf149qh557mdvwklhpxky3a31ydn9-source
> source root is source
> Running phase: patchPhase
> applying patch /nix/store/117hf0qpcsn3vgm53gnn3c1b3l1wdmb1-0001-build-Allow-using-V8-from-system.patch
> patching file Makefile
> patching script interpreter paths in ./generate_upgrade.sh
> ./generate_upgrade.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash"
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: buildPhase
> build flags: SHELL=/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash USE_SYSTEM_V8=1 SHLIB_LINK=-lv8 V8_OUTDIR=/nix/store/va71m87nkgc6znlkm2wp7zr0d9h3indd-v8-12.5.227.9/lib all
> sed -e 's/^#undef PLV8_VERSION/#define PLV8_VERSION "3.2.2"/' plv8_config.h.in > plv8_config.h
> g++ -DJSONB_DIRECT_CONVERSION -std=c++17 -Wall -std=c++17 -fno-rtti -O2 -fPIC -Wall -Wno-register -xc++ -I. -I./ -I/nix/store/07s64wxjzk6z1glwxvl3yq81vdn42k40-postgresql-15.7/include/server -I/nix/store/07s64wxjzk6z1glwxvl3yq81vdn42k40-postgresql-15.7/include/internal -I/nix/store/zfi1y943q15js1ysgl4vk6lp2bzrngn2-icu4c-73.2-dev/include -D_GNU_SOURCE -I/nix/store/37979sqc7yw9ps0c4xl9jjkhq0w1hw8b-libxml2-2.12.7-dev/include/libxml2 -I/nix/store/ks2x6si7bkxb6ay1s80ld1s5997qllpa-lz4-1.9.4-dev/include -I/nix/store/9ynakmwsf7nqhlv3phl05yybc5ad754l-zstd-1.5.6-dev/include -fPIC -c -o plv8.o plv8.cc
> In file included from /nix/store/va71m87nkgc6znlkm2wp7zr0d9h3indd-v8-12.5.227.9/include/v8-array-buffer.h:12,
> from /nix/store/va71m87nkgc6znlkm2wp7zr0d9h3indd-v8-12.5.227.9/include/v8.h:24,
> from plv8.h:12,
> from plv8.cc:8:
> /nix/store/va71m87nkgc6znlkm2wp7zr0d9h3indd-v8-12.5.227.9/include/v8-local-handle.h: In instantiation of 'v8::Local<T>::Local(v8::Local<S>) [with S = v8::Data; T = v8::Value]':
> plv8.h:226:65: required from here
> /nix/store/va71m87nkgc6znlkm2wp7zr0d9h3indd-v8-12.5.227.9/include/v8-local-handle.h:269:42: error: static assertion failed: type check
> 269 | static_assert(std::is_base_of<T, S>::value, "type check");
> | ^~~~~
> /nix/store/va71m87nkgc6znlkm2wp7zr0d9h3indd-v8-12.5.227.9/include/v8-local-handle.h:269:42: note: 'std::integral_constant<bool, false>::value' evaluates to false
> make: *** [Makefile:102: plv8.o] Error 1
For full logs, run 'nix log /nix/store/h092y67qi0fhp0b0hn8kjfmjpzsygzb5-plv8-3.2.2.drv'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment