Skip to content

Commit f3cb3be

Browse files
committed
fixup! build: add --without-bundled-v8-third_party configure flag
1 parent 276bef8 commit f3cb3be

File tree

10 files changed

+131
-46
lines changed

10 files changed

+131
-46
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,10 +1251,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
12511251
$(RM) -r $(TARNAME)/deps/sqlite
12521252
$(RM) -r $(TARNAME)/deps/uv
12531253
$(RM) -r $(TARNAME)/deps/uvwasi
1254-
$(RM) -r $(TARNAME)/deps/v8/third_party/abseil-cpp
1255-
$(RM) -r $(TARNAME)/deps/v8/third_party/highway
1256-
$(RM) -r $(TARNAME)/deps/v8/third_party/simdutf
1257-
$(RM) -r $(TARNAME)/deps/v8/third_party/zlib
1254+
$(RM) -r $(TARNAME)/deps/v8/third_party
12581255
$(RM) -r $(TARNAME)/deps/zlib
12591256
$(RM) -r $(TARNAME)/deps/zstd
12601257
else

node.gyp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@
894894
'<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
895895
],
896896
'dependencies': [
897-
'tools/v8_gypfiles/abseil.gyp:abseil',
898897
'node_js2c#host',
899898
],
900899

@@ -955,6 +954,11 @@
955954
'src/node_snapshot_stub.cc',
956955
]
957956
}],
957+
[ 'node_use_bundled_v8_third_party!="false"', {
958+
'dependencies': [
959+
'tools/v8_gypfiles/abseil.gyp:abseil',
960+
],
961+
}],
958962
[ 'node_shared_gtest=="false"', {
959963
'dependencies': [
960964
'deps/googletest/googletest.gyp:gtest_prod',
@@ -1275,7 +1279,6 @@
12751279

12761280
'dependencies': [
12771281
'<(node_lib_target_name)',
1278-
'tools/v8_gypfiles/abseil.gyp:abseil',
12791282
],
12801283

12811284
'includes': [
@@ -1309,6 +1312,11 @@
13091312
[ 'node_shared_gtest=="true"', {
13101313
'libraries': [ '-lgtest_main' ],
13111314
}],
1315+
[ 'node_use_bundled_v8_third_party!="false"', {
1316+
'dependencies': [
1317+
'tools/v8_gypfiles/abseil.gyp:abseil',
1318+
],
1319+
}],
13121320
[ 'node_shared_hdr_histogram=="false"', {
13131321
'dependencies': [
13141322
'deps/histogram/histogram.gyp:histogram',
@@ -1547,7 +1555,7 @@
15471555
[ 'OS=="mac"', {
15481556
'libraries': [ '-framework CoreFoundation -framework Security' ],
15491557
}],
1550-
[ 'node_shared_simdutf=="false"', {
1558+
[ 'node_shared_simdutf=="false" and node_use_bundled_v8_third_party!="false"', {
15511559
'dependencies': [ 'tools/v8_gypfiles/v8.gyp:simdutf#host' ],
15521560
}],
15531561
[ 'node_shared_libuv=="false"', {

tools/nix/v8-third_party/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ symlinkJoin {
2525

2626
paths = [
2727
(callPackage ./abseil-cpp.nix { })
28+
(callPackage ./fp16.nix { })
2829
(callPackage ./highway.nix { })
2930
(callPackage ./simdutf.nix { })
3031
(callPackage ./zlib.nix { })
@@ -63,7 +64,7 @@ symlinkJoin {
6364
"-lv8_zlib"
6465
]
6566
}
66-
Cflags: -I$out/include
67+
Cflags: -I$out/include -I$out/include/third_party/simdutf
6768
EOF
6869
install -Dm0644 v8-third_party.pc -t $out/lib/pkgconfig
6970
'';

tools/nix/v8-third_party/fp16.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
stdenv,
3+
fetchgit,
4+
cmake,
5+
skipCheck ? false, # update-v8-dep-nix.sh uses this to parse the file
6+
}:
7+
8+
let
9+
# Values from deps/v8/DEPS - third_party/fp16
10+
url = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git";
11+
rev = "3d2de1816307bac63c16a297e8c4dc501b4076df";
12+
13+
hash =
14+
let
15+
v8Deps = builtins.match (
16+
".*'chromium_url': '([^']+)',.*"
17+
+ "'third_party/fp16/src':"
18+
+ "[^']+Var\\('chromium_url'\\) ?\\+ ?'([^']+)' ?\\+ ?'@' ?\\+ ?'([a-f0-9]+)',.*"
19+
) (builtins.readFile ../../../deps/v8/DEPS);
20+
expectedURL =
21+
if v8Deps == null then
22+
throw "v8/DEPS missing or not parsable"
23+
else
24+
"${builtins.elemAt v8Deps 0}${builtins.elemAt v8Deps 1}";
25+
expectedRev = builtins.elemAt v8Deps 2;
26+
in
27+
if skipCheck == false && (expectedURL != url || expectedRev != rev) then
28+
throw "Please run tools/nix/v8-third_party/update-dep-nix.sh fp16\n - Expected: ${expectedURL}@${expectedRev}\n - Got: ${url}@${rev}"
29+
else
30+
"sha256-CR7h1d9RFE86l6btk4N8vbQxy0KQDxSMvckbiO87JEg=";
31+
in
32+
stdenv.mkDerivation (finalAttrs: {
33+
pname = "fp16";
34+
version = "0-unstable-2022-10-24";
35+
36+
src = fetchgit {
37+
inherit url rev hash;
38+
};
39+
40+
doBuild = false;
41+
installPhase = ''
42+
install -Dm0644 include/fp16.h -t $out/include/third_party/fp16/src/include
43+
install -Dm0644 include/fp16/*.h -t $out/include/third_party/fp16/src/include/fp16
44+
'';
45+
})

tools/nix/v8-third_party/highway.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ let
2929
"sha256-HNrlqtAs1vKCoSJ5TASs34XhzjEbLW+ISco1NQON+BI=";
3030
version = "1.3.0";
3131
in
32-
libhwy.overrideAttrs {
32+
libhwy.overrideAttrs (old: {
3333
inherit version;
3434

3535
src = fetchgit {
3636
inherit url rev hash;
3737
};
38-
}
38+
39+
postPatch = ''
40+
substituteInPlace hwy/ops/set_macros-inl.h \
41+
--replace-fail '",avx10.2-512"' '""'
42+
'';
43+
44+
doCheck = false;
45+
})

tools/nix/v8-third_party/simdutf.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ stdenv.mkDerivation {
4141
buildPhase =
4242
if stdenv.buildPlatform.isDarwin then
4343
''
44-
$CXX -dynamiclib simdutf.cpp \
44+
$CXX -std=c++20 -dynamiclib simdutf.cpp \
4545
-o libsimdutf.dylib \
4646
-install_name $out/lib/libsimdutf.dylib
4747
''
4848
else
4949
''
50-
$CXX -fPIC -shared simdutf.cpp \
51-
-o libsimdutf.dylib
50+
$CXX -std=c++20 -fPIC -shared simdutf.cpp \
51+
-o libsimdutf.so
5252
'';
5353
installPhase = ''
54-
install -Dm0644 libsimdutf.dylib -t $out/lib
54+
install -Dm0644 libsimdutf.* -t $out/lib
5555
install -Dm0644 simdutf.h -t $out/include/third_party/simdutf
5656
5757
cat -> simdutf.pc <<EOF

tools/nix/v8-third_party/update-dep-nix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fi
2121

2222
echo "Extracting values from deps/v8/DEPS..."
2323

24-
DEP_SRC=$(awk "/^ *\u0027third_party[\u002f]$DEP_NAME([\u002f]src)?\u0027: ?\{?$/{ getline; print }" "$DEPS_FILE")
24+
DEP_SRC=$(sed -n "/^ \\{0,\\}'third_party.$DEP_NAME\\(.src\\)\\{0,1\\}': \\{0,1\\}{\\{0,1\\}\$/{n;p;}" "$DEPS_FILE")
2525

2626
echo "$DEP_SRC" | grep -q "Var('chromium_url') \?+ \?'.\+' \?+ \?'@' \?+ \?'.\+',$" || {
2727
echo "Unexpected format for $DEP_NAME source URL: $DEP_SRC"

tools/nix/v8-third_party/zlib.nix

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,34 @@ let
2525
expectedRev = builtins.elemAt v8Deps 2;
2626
in
2727
if skipCheck == false && (expectedURL != url || expectedRev != rev) then
28-
throw "Please run tools/nix/update-v8-dep-nix.sh zlib\n - Expected: ${expectedURL}@${expectedRev}\n - Got: ${url}@${rev}"
28+
throw "Please run tools/nix/v8-third_party/update-dep-nix.sh zlib\n - Expected: ${expectedURL}@${expectedRev}\n - Got: ${url}@${rev}"
2929
else
3030
"sha256-d01Vdo+kZ43AhES5MYGFae67fH6L6ATh3xQadMu7Hw0=";
3131
in
32-
stdenv.mkDerivation {
32+
stdenv.mkDerivation (finalAttrs: {
3333
pname = "v8_zlib";
3434
version = "1.3.1";
3535

3636
src = fetchgit {
3737
inherit url rev hash;
3838
};
3939
postPatch = ''
40-
substituteInPlace CMakeLists.txt --replace-fail 'OUTPUT_NAME z' 'OUTPUT_NAME v8_zlib'
40+
substituteInPlace CMakeLists.txt \
41+
--replace-fail 'OUTPUT_NAME z' 'OUTPUT_NAME v8_zlib' \
42+
--replace-fail 'set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"''${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")' ' ' \
43+
--replace-fail 'INSTALL_INC_DIR "''${CMAKE_INSTALL_PREFIX}/include"' 'INSTALL_INC_DIR "''${CMAKE_INSTALL_PREFIX}/include/third_party/zlib"' \
44+
--replace-fail 'set(ZLIB_PUBLIC_HDRS' 'set(ZLIB_PUBLIC_HDRS chromeconf.h google/compression_utils_portable.h' \
45+
--replace-fail 'set(ZLIB_SRCS' 'set(ZLIB_SRCS google/compression_utils_portable.cc'
46+
'';
47+
48+
NIX_CFLAGS_COMPILE = ''
49+
-DZLIB_IMPLEMENTATION
50+
-include ${finalAttrs.src}/chromeconf.h
4151
'';
4252

4353
nativeBuildInputs = [ cmake ];
4454
postInstall = ''
45-
mkdir -p $out/include/third_party/zlib
46-
mv $out/include/*.h $out/include/third_party/zlib/.
55+
mkdir $out/include/third_party/zlib/google
56+
mv $out/include/third_party/zlib/compression_utils_portable.h $out/include/third_party/zlib/google/.
4757
'';
48-
}
58+
})

tools/nix/v8.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
4141
../../configure.py
4242
../../deps/inspector_protocol/inspector_protocol.gyp
4343
../../deps/ncrypto/ncrypto.gyp
44-
../../deps/v8
44+
(fileset.difference ../../deps/v8 ../../deps/v8/third_party)
4545
../../node.gyp
4646
../../node.gypi
4747
../../src/inspector/node_inspector.gypi

0 commit comments

Comments
 (0)