22 stdenv ,
33 lib ,
44 fetchFromGitHub ,
5- v8 ,
5+ nodejs ,
66 perl ,
77 postgresql ,
88 # For passthru test on various systems, and local development on macos
99 # not we are not currently using passthru tests but retaining for possible contrib
10- # to nixpkgs
10+ # to nixpkgs
1111 clang ,
1212 xcbuild ,
1313 darwin ,
@@ -40,7 +40,7 @@ stdenv.mkDerivation (finalAttrs: {
4040
4141 buildInputs =
4242 [
43- v8
43+ nodejs . libv8
4444 postgresql
4545 ]
4646 ++ lib . optionals stdenv . isDarwin [
@@ -54,20 +54,20 @@ stdenv.mkDerivation (finalAttrs: {
5454 [
5555 # Nixpkgs build a v8 monolith instead of separate v8_libplatform.
5656 "USE_SYSTEM_V8=1"
57- "V8_OUTDIR=${ v8 } /lib"
57+ "V8_OUTDIR=${ nodejs . libv8 } /lib"
5858 "PG_CONFIG=${ postgresql } /bin/pg_config"
5959 ]
6060 ++ lib . optionals stdenv . isDarwin [
6161 "CC=${ clang } /bin/clang"
6262 "CXX=${ clang } /bin/clang++"
63- "SHLIB_LINK=-L${ v8 } /lib -lv8_monolith -Wl,-rpath,${ v8 } /lib"
63+ "SHLIB_LINK=-L${ nodejs . libv8 } /lib -lv8_monolith -Wl,-rpath,${ nodejs . libv8 } /lib"
6464 ]
6565 ++ lib . optionals ( ! stdenv . isDarwin ) [ "SHLIB_LINK=-lv8" ] ;
6666
6767 NIX_LDFLAGS = (
6868 lib . optionals stdenv . isDarwin [
6969 "-L${ postgresql } /lib"
70- "-L${ v8 } /lib"
70+ "-L${ nodejs . libv8 } /lib"
7171 "-lv8_monolith"
7272 "-lpq"
7373 "-lpgcommon"
@@ -119,30 +119,26 @@ stdenv.mkDerivation (finalAttrs: {
119119 sed -i 's|module_pathname = '"'"'$libdir/plv8-[0-9.]*'"'"'|module_pathname = '"'"'$libdir/plv8'"'"'|' "$out/share/postgresql/extension/plls.control"
120120
121121 ${ lib . optionalString stdenv . isDarwin ''
122- install_name_tool -add_rpath "${ v8 } /lib" $out/lib/plv8.so
122+ install_name_tool -add_rpath "${ nodejs . libv8 } /lib" $out/lib/plv8.so
123123 install_name_tool -add_rpath "${ postgresql } /lib" $out/lib/plv8.so
124124 install_name_tool -add_rpath "${ stdenv . cc . cc . lib } /lib" $out/lib/plv8.so
125- install_name_tool -change @rpath/libv8_monolith.dylib ${ v8 } /lib/libv8_monolith.dylib $out/lib/plv8.so
125+ install_name_tool -change @rpath/libv8_monolith.dylib ${ nodejs . libv8 } /lib/libv8_monolith.dylib $out/lib/plv8.so
126126 '' }
127127
128- ${
129- lib . optionalString ( ! stdenv . isDarwin ) ''
130- ${ patchelf } /bin/patchelf --set-rpath "${ v8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8.so
131- ''
132- }
128+ ${ lib . optionalString ( ! stdenv . isDarwin ) ''
129+ ${ patchelf } /bin/patchelf --set-rpath "${ nodejs . libv8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8.so
130+ '' }
133131 else
134132 ${ lib . optionalString stdenv . isDarwin ''
135- install_name_tool -add_rpath "${ v8 } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
133+ install_name_tool -add_rpath "${ nodejs . libv8 } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
136134 install_name_tool -add_rpath "${ postgresql } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
137135 install_name_tool -add_rpath "${ stdenv . cc . cc . lib } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
138- install_name_tool -change @rpath/libv8_monolith.dylib ${ v8 } /lib/libv8_monolith.dylib $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 }
139137 '' }
140138
141- ${
142- lib . optionalString ( ! stdenv . isDarwin ) ''
143- ${ patchelf } /bin/patchelf --set-rpath "${ v8 } /lib:${ postgresql } /lib:${ stdenv . cc . cc . lib } /lib" $out/lib/plv8-${ finalAttrs . version } ${ postgresql . dlSuffix }
144- ''
145- }
139+ ${ 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 }
141+ '' }
146142 fi
147143 '' ;
148144
0 commit comments