2
2
stdenv ,
3
3
lib ,
4
4
fetchFromGitHub ,
5
- nodejs ,
6
5
perl ,
7
6
postgresql ,
8
7
# For passthru test on various systems, and local development on macos
13
12
darwin ,
14
13
patchelf ,
15
14
} :
16
-
15
+ let
16
+ # 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 ;
22
+ in
17
23
stdenv . mkDerivation ( finalAttrs : {
18
24
pname = "plv8" ;
19
25
version = "3.1.10" ;
@@ -40,7 +46,7 @@ stdenv.mkDerivation (finalAttrs: {
40
46
41
47
buildInputs =
42
48
[
43
- nodejs . libv8
49
+ v8
44
50
postgresql
45
51
]
46
52
++ lib . optionals stdenv . isDarwin [
@@ -54,20 +60,20 @@ stdenv.mkDerivation (finalAttrs: {
54
60
[
55
61
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
56
62
"USE_SYSTEM_V8=1"
57
- "V8_OUTDIR=${ nodejs . libv8 } /lib"
63
+ "V8_OUTDIR=${ v8 } /lib"
58
64
"PG_CONFIG=${ postgresql } /bin/pg_config"
59
65
]
60
66
++ lib . optionals stdenv . isDarwin [
61
67
"CC=${ clang } /bin/clang"
62
68
"CXX=${ clang } /bin/clang++"
63
- "SHLIB_LINK=-L${ nodejs . libv8 } /lib -lv8_monolith -Wl,-rpath,${ nodejs . libv8 } /lib"
69
+ "SHLIB_LINK=-L${ v8 } /lib -lv8_monolith -Wl,-rpath,${ v8 } /lib"
64
70
]
65
71
++ lib . optionals ( ! stdenv . isDarwin ) [ "SHLIB_LINK=-lv8" ] ;
66
72
67
73
NIX_LDFLAGS = (
68
74
lib . optionals stdenv . isDarwin [
69
75
"-L${ postgresql } /lib"
70
- "-L${ nodejs . libv8 } /lib"
76
+ "-L${ v8 } /lib"
71
77
"-lv8_monolith"
72
78
"-lpq"
73
79
"-lpgcommon"
@@ -119,25 +125,25 @@ stdenv.mkDerivation (finalAttrs: {
119
125
sed -i 's|module_pathname = '"'"'$libdir/plv8-[0-9.]*'"'"'|module_pathname = '"'"'$libdir/plv8'"'"'|' "$out/share/postgresql/extension/plls.control"
120
126
121
127
${ lib . optionalString stdenv . isDarwin ''
122
- install_name_tool -add_rpath "${ nodejs . libv8 } /lib" $out/lib/plv8.so
128
+ install_name_tool -add_rpath "${ v8 } /lib" $out/lib/plv8.so
123
129
install_name_tool -add_rpath "${ postgresql } /lib" $out/lib/plv8.so
124
130
install_name_tool -add_rpath "${ stdenv . cc . cc . lib } /lib" $out/lib/plv8.so
125
- install_name_tool -change @rpath/libv8_monolith.dylib ${ nodejs . libv8 } /lib/libv8_monolith.dylib $out/lib/plv8.so
131
+ install_name_tool -change @rpath/libv8_monolith.dylib ${ v8 } /lib/libv8_monolith.dylib $out/lib/plv8.so
126
132
'' }
127
133
128
134
${ lib . optionalString ( ! stdenv . isDarwin ) ''
129
- ${ patchelf } /bin/patchelf --set-rpath "${ nodejs . libv8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8.so
135
+ ${ patchelf } /bin/patchelf --set-rpath "${ v8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8.so
130
136
'' }
131
137
else
132
138
${ lib . optionalString stdenv . isDarwin ''
133
- install_name_tool -add_rpath "${ nodejs . libv8 } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
139
+ install_name_tool -add_rpath "${ v8 } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
134
140
install_name_tool -add_rpath "${ postgresql } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
135
141
install_name_tool -add_rpath "${ stdenv . cc . cc . lib } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
136
- install_name_tool -change @rpath/libv8_monolith.dylib ${ nodejs . libv8 } /lib/libv8_monolith.dylib $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
142
+ install_name_tool -change @rpath/libv8_monolith.dylib ${ v8 } /lib/libv8_monolith.dylib $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
137
143
'' }
138
144
139
145
${ lib . optionalString ( ! stdenv . isDarwin ) ''
140
- ${ patchelf } /bin/patchelf --set-rpath "${ nodejs . libv8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
146
+ ${ patchelf } /bin/patchelf --set-rpath "${ v8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
141
147
'' }
142
148
fi
143
149
'' ;
0 commit comments