Skip to content

Commit 163aaa6

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

File tree

15 files changed

+311
-131
lines changed

15 files changed

+311
-131
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,10 +1251,18 @@ 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+
find $(TARNAME)/deps/v8/third_party -maxdepth 1 -type f -exec $(RM) {} +
1255+
find $(TARNAME)/deps/v8/third_party -mindepth 1 -maxdepth 1 -type d \
1256+
-not -name inspector_protocol \
1257+
-not -name jinja2 \
1258+
-not -name markupsafe \
1259+
-not -name rapidhash-v8 \
1260+
-not -name siphash \
1261+
-not -name utf8-decoder \
1262+
-not -name v8 \
1263+
-not -name wasm-api \
1264+
-exec $(RM) -r {} +
1265+
$(RM) -r $(TARNAME)/deps/v8/third_party
12581266
$(RM) -r $(TARNAME)/deps/zlib
12591267
$(RM) -r $(TARNAME)/deps/zstd
12601268
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/abseil-cpp.nix

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,13 @@
55
}:
66

77
let
8-
# Values from deps/v8/DEPS - third_party/abseil-cpp
98
url = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git";
109
rev = "3fb321d9764442ceaf2e17b6e68ab6b6836bc78a";
1110

12-
hash =
13-
let
14-
v8Deps = builtins.match (
15-
".*'chromium_url': '([^']+)',.*"
16-
+ "'third_party/abseil-cpp': \\{"
17-
+ "[^']+'url': ?Var\\('chromium_url'\\) ?\\+ ?'([^']+)' ?\\+ ?'@' ?\\+ ?'([a-f0-9]+)',.*"
18-
) (builtins.readFile ../../../deps/v8/DEPS);
19-
expectedURL =
20-
if v8Deps == null then
21-
throw "v8/DEPS missing or not parsable"
22-
else
23-
"${builtins.elemAt v8Deps 0}${builtins.elemAt v8Deps 1}";
24-
expectedRev = builtins.elemAt v8Deps 2;
25-
in
26-
if skipCheck == false && (expectedURL != url || expectedRev != rev) then
27-
throw "Please run tools/nix/update-absl-nix.sh\n - Expected: ${expectedURL}@${expectedRev}\n - Got: ${url}@${rev}"
28-
else
29-
"sha256-KpjXpyWp9x0cSmyh3uwn0fwKreHA0Cb8c0rD+RHYB80=";
11+
hash = import ./utils/up-to-date-hash.nix {
12+
pname = "abseil-cpp";
13+
inherit skipCheck url rev;
14+
} "sha256-KpjXpyWp9x0cSmyh3uwn0fwKreHA0Cb8c0rD+RHYB80=";
3015
in
3116
(abseil-cpp.overrideAttrs {
3217
src = fetchgit {

tools/nix/v8-third_party/default.nix

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

2626
paths = [
2727
(callPackage ./abseil-cpp.nix { })
28+
(callPackage ./dragonbox.nix { })
29+
(callPackage ./fast_float.nix { })
30+
(callPackage ./fp16.nix { })
31+
(callPackage ./googletest.nix { })
2832
(callPackage ./highway.nix { })
2933
(callPackage ./simdutf.nix { })
3034
(callPackage ./zlib.nix { })
@@ -63,7 +67,7 @@ symlinkJoin {
6367
"-lv8_zlib"
6468
]
6569
}
66-
Cflags: -I$out/include
70+
Cflags: -I$out/include -I$out/include/third_party/simdutf
6771
EOF
6872
install -Dm0644 v8-third_party.pc -t $out/lib/pkgconfig
6973
'';
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
stdenv,
3+
fetchgit,
4+
skipCheck ? false, # update-v8-dep-nix.sh uses this to parse the file
5+
}:
6+
7+
let
8+
# Values from deps/v8/DEPS - third_party/dragonbox
9+
url = "https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox.git";
10+
rev = "6c7c925b571d54486b9ffae8d9d18a822801cbda";
11+
12+
pname = "dragonbox";
13+
hash = import ./utils/up-to-date-hash.nix {
14+
inherit
15+
pname
16+
skipCheck
17+
url
18+
rev
19+
;
20+
} "sha256-AOniXMPgwKpkJqivRd+GazEnhdw53FzhxKqG+GdU+cc=";
21+
in
22+
stdenv.mkDerivation {
23+
inherit pname;
24+
version = "1.8.0";
25+
26+
src = fetchgit {
27+
inherit url rev hash;
28+
};
29+
30+
doBuild = false;
31+
installPhase = ''
32+
install -Dm0644 include/${pname}/*.h -t $out/include/third_party/${pname}/src/include/${pname}
33+
'';
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
stdenv,
3+
fetchgit,
4+
skipCheck ? false, # update-v8-dep-nix.sh uses this to parse the file
5+
}:
6+
7+
let
8+
# Values from deps/v8/DEPS - third_party/fast_float
9+
url = "https://chromium.googlesource.com/external/github.com/fastfloat/fast_float.git";
10+
rev = "cb1d42aaa1e14b09e1452cfdef373d051b8c02a4";
11+
12+
pname = "fast_float";
13+
hash = import ./utils/up-to-date-hash.nix {
14+
inherit
15+
pname
16+
skipCheck
17+
url
18+
rev
19+
;
20+
} "sha256-CG5je117WYyemTe5PTqznDP0bvY5TeXn8Vu1Xh5yUzQ=";
21+
in
22+
stdenv.mkDerivation {
23+
inherit pname;
24+
version = "7.0.0";
25+
26+
src = fetchgit {
27+
inherit url rev hash;
28+
};
29+
30+
doBuild = false;
31+
installPhase = ''
32+
install -Dm0644 include/${pname}/*.h -t $out/include/third_party/${pname}/src/include/${pname}
33+
'';
34+
}

tools/nix/v8-third_party/fp16.nix

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
stdenv,
3+
fetchgit,
4+
skipCheck ? false, # update-v8-dep-nix.sh uses this to parse the file
5+
}:
6+
7+
let
8+
# Values from deps/v8/DEPS - third_party/fp16
9+
url = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git";
10+
rev = "3d2de1816307bac63c16a297e8c4dc501b4076df";
11+
12+
pname = "fp16";
13+
hash = import ./utils/up-to-date-hash.nix {
14+
inherit
15+
pname
16+
skipCheck
17+
url
18+
rev
19+
;
20+
} "sha256-CR7h1d9RFE86l6btk4N8vbQxy0KQDxSMvckbiO87JEg=";
21+
in
22+
stdenv.mkDerivation {
23+
inherit pname;
24+
version = "0-unstable-2022-10-24";
25+
26+
src = fetchgit {
27+
inherit url rev hash;
28+
};
29+
30+
doBuild = false;
31+
installPhase = ''
32+
install -Dm0644 include/${pname}.h -t $out/include/third_party/${pname}/src/include
33+
install -Dm0644 include/${pname}/*.h -t $out/include/third_party/${pname}/src/include/${pname}
34+
ln -s $out/include/third_party/${pname}/src/include/${pname} $out/include/${pname}
35+
'';
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
stdenv,
3+
fetchgit,
4+
skipCheck ? false, # update-v8-dep-nix.sh uses this to parse the file
5+
}:
6+
7+
let
8+
# Values from deps/v8/DEPS - third_party/googletest
9+
url = "https://chromium.googlesource.com/external/github.com/google/googletest.git";
10+
rev = "b2b9072ecbe874f5937054653ef8f2731eb0f010";
11+
12+
pname = "googletest";
13+
hash = import ./utils/up-to-date-hash.nix {
14+
inherit
15+
pname
16+
skipCheck
17+
url
18+
rev
19+
;
20+
} "sha256-cTPx19WAXlyXDK4nY0pxbMI4oRojaARgIeASA+MB3NY=";
21+
in
22+
stdenv.mkDerivation {
23+
inherit pname;
24+
version = "1.8.0";
25+
26+
src = fetchgit {
27+
inherit url rev hash;
28+
# sparseCheckout = [ "*.h" ];
29+
# nonConeMode = true;
30+
};
31+
32+
doBuild = false;
33+
installPhase = ''
34+
install -Dm0644 googletest/include/gtest/*.h -t $out/include/third_party/${pname}/src/googletest/include/gtest
35+
'';
36+
}

tools/nix/v8-third_party/highway.nix

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,22 @@ let
99
url = "https://chromium.googlesource.com/external/github.com/google/highway.git";
1010
rev = "84379d1c73de9681b54fbe1c035a23c7bd5d272d";
1111

12-
hash =
13-
let
14-
v8Deps = builtins.match (
15-
".*'chromium_url': '([^']+)',.*"
16-
+ "'third_party/highway/src':"
17-
+ "[^']+Var\\('chromium_url'\\) ?\\+ ?'([^']+)' ?\\+ ?'@' ?\\+ ?'([a-f0-9]+)',.*"
18-
) (builtins.readFile ../../../deps/v8/DEPS);
19-
expectedURL =
20-
if v8Deps == null then
21-
throw "v8/DEPS missing or not parsable"
22-
else
23-
"${builtins.elemAt v8Deps 0}${builtins.elemAt v8Deps 1}";
24-
expectedRev = builtins.elemAt v8Deps 2;
25-
in
26-
if skipCheck == false && (expectedURL != url || expectedRev != rev) then
27-
throw "Please run `tools/nix/v8-third_party/update-dep-nix.sh highway`\n - Expected: ${expectedURL}@${expectedRev}\n - Got: ${url}@${rev}"
28-
else
29-
"sha256-HNrlqtAs1vKCoSJ5TASs34XhzjEbLW+ISco1NQON+BI=";
30-
version = "1.3.0";
12+
hash = import ./utils/up-to-date-hash.nix {
13+
pname = "highway";
14+
inherit skipCheck url rev;
15+
} "sha256-HNrlqtAs1vKCoSJ5TASs34XhzjEbLW+ISco1NQON+BI=";
3116
in
32-
libhwy.overrideAttrs {
33-
inherit version;
17+
libhwy.overrideAttrs (old: {
18+
version = "1.3.0";
3419

3520
src = fetchgit {
3621
inherit url rev hash;
3722
};
38-
}
23+
24+
postPatch = ''
25+
substituteInPlace hwy/ops/set_macros-inl.h \
26+
--replace-fail '",avx10.2-512"' '""'
27+
'';
28+
29+
doCheck = false;
30+
})

tools/nix/v8-third_party/simdutf.nix

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,19 @@ let
1010
url = "https://chromium.googlesource.com/chromium/src/third_party/simdutf";
1111
rev = "acd71a451c1bcb808b7c3a77e0242052909e381e";
1212

13-
hash =
14-
let
15-
v8Deps = builtins.match (
16-
".*'chromium_url': '([^']+)',.*"
17-
+ "'third_party/simdutf':"
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 simdutf`\n - Expected: ${expectedURL}@${expectedRev}\n - Got: ${url}@${rev}"
29-
else
30-
"sha256-2fW4Bz1BWJp8EZqZBvvEuoI3Szfepe8muF8v9KpGk7E=";
13+
pname = "simdutf";
14+
hash = import ./utils/up-to-date-hash.nix {
15+
inherit
16+
pname
17+
skipCheck
18+
url
19+
rev
20+
;
21+
} "sha256-2fW4Bz1BWJp8EZqZBvvEuoI3Szfepe8muF8v9KpGk7E=";
3122
version = "7.3.3";
3223
in
3324
stdenv.mkDerivation {
34-
pname = "v8_simdutf";
35-
inherit version;
25+
inherit pname version;
3626

3727
src = fetchgit {
3828
inherit url rev hash;
@@ -41,17 +31,17 @@ stdenv.mkDerivation {
4131
buildPhase =
4232
if stdenv.buildPlatform.isDarwin then
4333
''
44-
$CXX -dynamiclib simdutf.cpp \
34+
$CXX -std=c++20 -dynamiclib simdutf.cpp \
4535
-o libsimdutf.dylib \
4636
-install_name $out/lib/libsimdutf.dylib
4737
''
4838
else
4939
''
50-
$CXX -fPIC -shared simdutf.cpp \
51-
-o libsimdutf.dylib
40+
$CXX -std=c++20 -fPIC -shared simdutf.cpp \
41+
-o libsimdutf.so
5242
'';
5343
installPhase = ''
54-
install -Dm0644 libsimdutf.dylib -t $out/lib
44+
install -Dm0644 libsimdutf.* -t $out/lib
5545
install -Dm0644 simdutf.h -t $out/include/third_party/simdutf
5646
5747
cat -> simdutf.pc <<EOF

0 commit comments

Comments
 (0)