Skip to content

Commit d64c0b7

Browse files
committed
WIP
1 parent 9eb301c commit d64c0b7

File tree

3 files changed

+35
-37
lines changed

3 files changed

+35
-37
lines changed

nix/ext/plv8.nix

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414
}:
1515
let
1616
# plv8 3.1 requires an older version of v8 (we cannot use nodejs.libv8)
17-
node_pkgs = import (fetchTarball {
18-
url = "https://github.com/nixos/nixpkgs/archive/a76c4553d7e741e17f289224eda135423de0491d.tar.gz";
19-
sha256 = "0rwdzp942b8ay625lqgra83qrp64b3wqm6w9a0i4z593df8x822v";
20-
}) { system = stdenv.system; };
21-
inherit (node_pkgs) v8;
17+
v8 = nodejs_20.libv8;
2218
in
2319
stdenv.mkDerivation (finalAttrs: {
2420
pname = "plv8";
@@ -37,36 +33,33 @@ stdenv.mkDerivation (finalAttrs: {
3733
./0001-build-Allow-using-V8-from-system.patch
3834
];
3935

40-
nativeBuildInputs = [
41-
perl
42-
]
43-
++ lib.optionals stdenv.isDarwin [
44-
clang
45-
xcbuild
46-
];
36+
nativeBuildInputs =
37+
[ perl ]
38+
++ lib.optionals stdenv.isDarwin [
39+
clang
40+
xcbuild
41+
];
4742

4843
buildInputs = [
4944
v8
5045
postgresql
51-
]
52-
++ lib.optionals stdenv.isDarwin [
53-
apple-sdk_11
54-
];
46+
] ++ lib.optionals stdenv.isDarwin [ apple-sdk_11 ];
5547

5648
buildFlags = [ "all" ];
5749

58-
makeFlags = [
59-
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
60-
"USE_SYSTEM_V8=1"
61-
"V8_OUTDIR=${v8}/lib"
62-
"PG_CONFIG=${postgresql}/bin/pg_config"
63-
]
64-
++ lib.optionals stdenv.isDarwin [
65-
"CC=${clang}/bin/clang"
66-
"CXX=${clang}/bin/clang++"
67-
"SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib"
68-
]
69-
++ lib.optionals (!stdenv.isDarwin) [ "SHLIB_LINK=-lv8" ];
50+
makeFlags =
51+
[
52+
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
53+
"USE_SYSTEM_V8=1"
54+
"V8_OUTDIR=${v8}/lib"
55+
"PG_CONFIG=${postgresql}/bin/pg_config"
56+
]
57+
++ lib.optionals stdenv.isDarwin [
58+
"CC=${clang}/bin/clang"
59+
"CXX=${clang}/bin/clang++"
60+
"SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib"
61+
]
62+
++ lib.optionals (!stdenv.isDarwin) [ "SHLIB_LINK=-lv8" ];
7063

7164
NIX_LDFLAGS = (
7265
lib.optionals stdenv.isDarwin [
@@ -127,9 +120,11 @@ stdenv.mkDerivation (finalAttrs: {
127120
install_name_tool -change @rpath/libv8_monolith.dylib ${v8}/lib/libv8_monolith.dylib $out/lib/plv8.so
128121
''}
129122
130-
${lib.optionalString (!stdenv.isDarwin) ''
131-
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${stdenv.cc.cc.lib}/lib" $out/lib/plv8.so
132-
''}
123+
${
124+
lib.optionalString (!stdenv.isDarwin) ''
125+
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${stdenv.cc.cc.lib}/lib" $out/lib/plv8.so
126+
''
127+
}
133128
else
134129
${lib.optionalString stdenv.isDarwin ''
135130
install_name_tool -add_rpath "${v8}/lib" $out/lib/plv8-${finalAttrs.version}${postgresql.dlSuffix}
@@ -138,9 +133,11 @@ stdenv.mkDerivation (finalAttrs: {
138133
install_name_tool -change @rpath/libv8_monolith.dylib ${v8}/lib/libv8_monolith.dylib $out/lib/plv8-${finalAttrs.version}${postgresql.dlSuffix}
139134
''}
140135
141-
${lib.optionalString (!stdenv.isDarwin) ''
142-
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${stdenv.cc.cc.lib}/lib" $out/lib/plv8-${finalAttrs.version}${postgresql.dlSuffix}
143-
''}
136+
${
137+
lib.optionalString (!stdenv.isDarwin) ''
138+
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${stdenv.cc.cc.lib}/lib" $out/lib/plv8-${finalAttrs.version}${postgresql.dlSuffix}
139+
''
140+
}
144141
fi
145142
'';
146143

nix/ext/plv8/default.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
stdenv,
33
lib,
44
fetchFromGitHub,
5-
v8,
65
perl,
76
postgresql,
87
# For passthru test on various systems, and local development on macos
@@ -36,15 +35,15 @@ let
3635
lib.mapAttrs (name: value: build name value.hash) supportedVersions
3736
);
3837

38+
v8 = nodejs_20.libv8;
39+
3940
# Build function for individual versions
4041
build =
4142
version: hash:
4243
stdenv.mkDerivation (finalAttrs: {
4344
inherit pname version;
4445
#version = "3.1.10";
4546

46-
v8 = (if (builtins.compareVersions "3.1.10" version >= 0) then v8 else nodejs_20.libv8);
47-
4847
src = fetchFromGitHub {
4948
owner = "plv8";
5049
repo = "plv8";

nix/postgresql/generic.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ let
6565
# detection of crypt fails when using llvm stdenv, so we add it manually
6666
# for <13 (where it got removed: https://github.com/postgres/postgres/commit/c45643d618e35ec2fe91438df15abd4f3c0d85ca)
6767
libxcrypt,
68+
69+
isOrioleDB ? false,
6870
}@args:
6971
let
7072
atLeast = lib.versionAtLeast version;

0 commit comments

Comments
 (0)