4
4
, v8
5
5
, perl
6
6
, 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
8
10
, runCommand
9
11
, coreutils
10
12
, gnugrep
11
13
, clang
12
- , patchelf
13
14
, xcbuild
14
15
, darwin
16
+ , patchelf
15
17
} :
16
18
17
19
stdenv . mkDerivation ( finalAttrs : {
18
20
pname = "plv8" ;
19
- version = "3.1.5 " ;
21
+ version = "3.1.10 " ;
20
22
21
23
src = fetchFromGitHub {
22
24
owner = "plv8" ;
23
25
repo = "plv8" ;
24
26
rev = "v${ finalAttrs . version } " ;
25
- hash = "sha256-LodC2eQJSm5fLckrjm2RuejZhmOyQMJTv9b0iPCnzKQ =" ;
27
+ hash = "sha256-g1A/XPC0dX2360Gzvmo9/FSQnM6Wt2K4eR0pH0p9fz4 =" ;
26
28
} ;
27
29
28
30
patches = [
31
+ # Allow building with system v8.
32
+ # https://github.com/plv8/plv8/pull/505 (rejected)
29
33
./0001-build-Allow-using-V8-from-system.patch
30
34
] ;
31
35
@@ -37,9 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
37
41
] ;
38
42
39
43
buildInputs = [
40
- ( v8 . overrideAttrs ( oldAttrs : {
41
- version = "9.7.106.18" ;
42
- } ) )
44
+ v8
43
45
postgresql
44
46
] ++ lib . optionals stdenv . isDarwin [
45
47
darwin . apple_sdk . frameworks . CoreFoundation
@@ -49,15 +51,16 @@ stdenv.mkDerivation (finalAttrs: {
49
51
buildFlags = [ "all" ] ;
50
52
51
53
makeFlags = [
54
+ # Nixpkgs build a v8 monolith instead of separate v8_libplatform.
52
55
"USE_SYSTEM_V8=1"
53
56
"V8_OUTDIR=${ v8 } /lib"
54
- "PG_CONFIG=${ postgresql } /bin/pg_config"
57
+ "PG_CONFIG=${ postgresql } /bin/pg_config"
55
58
] ++ lib . optionals stdenv . isDarwin [
56
59
"CC=${ clang } /bin/clang"
57
60
"CXX=${ clang } /bin/clang++"
58
61
"SHLIB_LINK=-L${ v8 } /lib -lv8_monolith -Wl,-rpath,${ v8 } /lib"
59
62
] ++ lib . optionals ( ! stdenv . isDarwin ) [
60
- "SHLIB_LINK=-L ${ v8 } /lib -lv8_monolith -Wl,-rpath, ${ v8 } /lib "
63
+ "SHLIB_LINK=-lv8 "
61
64
] ;
62
65
63
66
NIX_LDFLAGS = ( lib . optionals stdenv . isDarwin [
@@ -73,45 +76,31 @@ stdenv.mkDerivation (finalAttrs: {
73
76
"-framework" "Kerberos"
74
77
"-undefined" "dynamic_lookup"
75
78
"-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
+ ] ) ;
91
80
92
81
installFlags = [
82
+ # PGXS only supports installing to postgresql prefix so we need to redirect this
93
83
"DESTDIR=${ placeholder "out" } "
94
84
] ;
95
85
86
+ # No configure script.
96
87
dontConfigure = true ;
97
88
98
89
postPatch = ''
99
90
patchShebangs ./generate_upgrade.sh
100
91
substituteInPlace generate_upgrade.sh \
101
92
--replace " 2.3.10 " " 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.15 "
102
-
93
+
103
94
${ lib . optionalString stdenv . isDarwin ''
104
95
# Replace g++ with clang++ in Makefile
105
96
sed -i 's/g++/clang++/g' Makefile
106
97
'' }
107
98
'' ;
108
99
109
- preBuild = lib . optionalString stdenv . isDarwin ''
110
- export CC=${ clang } /bin/clang
111
- export CXX=${ clang } /bin/clang++
112
- '' ;
113
-
114
100
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.
115
104
mv "$out/nix/store"/*/* "$out"
116
105
rmdir "$out/nix/store"/* "$out/nix/store" "$out/nix"
117
106
@@ -133,9 +122,8 @@ stdenv.mkDerivation (finalAttrs: {
133
122
postgresqlWithSelf = postgresql . withPackages ( _ : [
134
123
finalAttrs . finalPackage
135
124
] ) ;
136
- in
137
- {
138
- smoke = runCommand "plv8-smoke-test" { } ''
125
+ in {
126
+ smoke = runCommand "plv8-smoke-test" { } ''
139
127
export PATH=${ lib . makeBinPath [
140
128
postgresqlWithSelf
141
129
coreutils
@@ -198,6 +186,5 @@ stdenv.mkDerivation (finalAttrs: {
198
186
maintainers = with maintainers ; [ samrose ] ;
199
187
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ] ;
200
188
license = licenses . postgresql ;
201
- #broken = postgresql.jitSupport;
202
189
} ;
203
- } )
190
+ } )
0 commit comments