| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d1eb7b3 commit 2a711f4
262 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -196,7 +196,7 @@ jobs: | |||
| 196 | 196 | --arg ccache "${NIX_SCCACHE:-null}" \ | |
| 197 | 197 | --arg devTools '[]' \ | |
| 198 | 198 | --arg benchmarkTools '[]' \ | |
| 199 | - ${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }} | ||
| 199 | + ${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg withFFI false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }} | ||
| 200 | 200 | --run ' | |
| 201 | 201 | make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS" | |
| 202 | 202 | ' "$TAR_DIR/shell.nix" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ on: | |||
| 26 | 26 | - histogram | |
| 27 | 27 | - icu | |
| 28 | 28 | - inspector_protocol | |
| 29 | + - libffi | ||
| 29 | 30 | - libuv | |
| 30 | 31 | - llhttp | |
| 31 | 32 | - minimatch | |
@@ -161,6 +162,14 @@ jobs: | |||
| 161 | 162 | cat temp-output | |
| 162 | 163 | tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | |
| 163 | 164 | rm temp-output | |
| 165 | + - id: libffi | ||
| 166 | + subsystem: deps | ||
| 167 | + label: dependencies, ffi | ||
| 168 | + run: | | ||
| 169 | + ./tools/dep_updaters/update-libffi.sh > temp-output | ||
| 170 | + cat temp-output | ||
| 171 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 172 | + rm temp-output | ||
| 164 | 173 | - id: libuv | |
| 165 | 174 | subsystem: deps | |
| 166 | 175 | label: dependencies | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -318,7 +318,7 @@ v8: ## Build deps/v8. | |||
| 318 | 318 | tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) | |
| 319 | 319 | ||
| 320 | 320 | .PHONY: jstest | |
| 321 | - jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests ## Run addon tests and JS tests. | ||
| 321 | + jstest: build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests ## Run addon tests and JS tests. | ||
| 322 | 322 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ | |
| 323 | 323 | $(TEST_CI_ARGS) \ | |
| 324 | 324 | --skip-tests=$(CI_SKIP_TESTS) \ | |
@@ -344,6 +344,7 @@ test: all ## Run default tests and build docs. | |||
| 344 | 344 | $(MAKE) -s build-js-native-api-tests | |
| 345 | 345 | $(MAKE) -s build-node-api-tests | |
| 346 | 346 | $(MAKE) -s build-sqlite-tests | |
| 347 | + $(MAKE) -s build-ffi-tests | ||
| 347 | 348 | $(MAKE) -s cctest | |
| 348 | 349 | $(MAKE) -s jstest | |
| 349 | 350 | ||
@@ -353,6 +354,7 @@ test-only: all ## Run default tests without building the docs. | |||
| 353 | 354 | $(MAKE) build-js-native-api-tests | |
| 354 | 355 | $(MAKE) build-node-api-tests | |
| 355 | 356 | $(MAKE) build-sqlite-tests | |
| 357 | + $(MAKE) build-ffi-tests | ||
| 356 | 358 | $(MAKE) cctest | |
| 357 | 359 | $(MAKE) jstest | |
| 358 | 360 | $(MAKE) tooltest | |
@@ -364,6 +366,7 @@ test-cov: all ## Run coverage tests. | |||
| 364 | 366 | $(MAKE) build-js-native-api-tests | |
| 365 | 367 | $(MAKE) build-node-api-tests | |
| 366 | 368 | $(MAKE) build-sqlite-tests | |
| 369 | + $(MAKE) build-ffi-tests | ||
| 367 | 370 | $(MAKE) cctest | |
| 368 | 371 | CI_SKIP_TESTS=$(COV_SKIP_TESTS) $(MAKE) jstest | |
| 369 | 372 | ||
@@ -542,6 +545,29 @@ else | |||
| 542 | 545 | build-sqlite-tests: | |
| 543 | 546 | endif | |
| 544 | 547 | ||
| 548 | + FFI_BINDING_GYPS := $(wildcard test/ffi/*/binding.gyp) | ||
| 549 | + | ||
| 550 | + FFI_BINDING_SOURCES := \ | ||
| 551 | + $(wildcard test/ffi/*/*.c) \ | ||
| 552 | + $(wildcard test/ffi/*/*.def) | ||
| 553 | + | ||
| 554 | + ifndef NOFFI | ||
| 555 | + # Depends on $(NODE_EXE) as order-only to avoid ETXTBSY on AIX when make | ||
| 556 | + # tries to execute node while it is still being linked in parallel. | ||
| 557 | + test/ffi/.buildstamp: $(ADDONS_PREREQS) \ | ||
| 558 | + $(FFI_BINDING_GYPS) $(FFI_BINDING_SOURCES) | $(NODE_EXE) | ||
| 559 | + @$(call run_build_addons,"$$PWD/test/ffi",$@) | ||
| 560 | + else | ||
| 561 | + test/ffi/.buildstamp: | ||
| 562 | + endif | ||
| 563 | + | ||
| 564 | + .PHONY: build-ffi-tests | ||
| 565 | + ifndef NOFFI | ||
| 566 | + build-ffi-tests: | test/ffi/.buildstamp ## Build FFI tests. | ||
| 567 | + else | ||
| 568 | + build-ffi-tests: | ||
| 569 | + endif | ||
| 570 | + | ||
| 545 | 571 | .PHONY: clear-stalled | |
| 546 | 572 | clear-stalled: ## Clear any stalled processes. | |
| 547 | 573 | $(info Clean up any leftover processes but don't error if found.) | |
@@ -552,7 +578,7 @@ clear-stalled: ## Clear any stalled processes. | |||
| 552 | 578 | fi | |
| 553 | 579 | ||
| 554 | 580 | .PHONY: test-build | |
| 555 | - test-build: | all build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests ## Build all tests. | ||
| 581 | + test-build: | all build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests ## Build all tests. | ||
| 556 | 582 | ||
| 557 | 583 | .PHONY: test-build-js-native-api | |
| 558 | 584 | test-build-js-native-api: all build-js-native-api-tests ## Build JS Native-API tests. | |
@@ -563,6 +589,8 @@ test-build-node-api: all build-node-api-tests ## Build Node-API tests. | |||
| 563 | 589 | .PHONY: test-build-sqlite | |
| 564 | 590 | test-build-sqlite: all build-sqlite-tests ## Build SQLite tests. | |
| 565 | 591 | ||
| 592 | + .PHONY: test-build-ffi | ||
| 593 | + test-build-ffi: all build-ffi-tests ## Build FFI tests. | ||
| 566 | 594 | ||
| 567 | 595 | .PHONY: test-all | |
| 568 | 596 | test-all: test-build ## Run default tests with both Debug and Release builds. | |
@@ -591,7 +619,7 @@ endif | |||
| 591 | 619 | ||
| 592 | 620 | # Related CI job: node-test-commit-arm-fanned | |
| 593 | 621 | test-ci-native: LOGLEVEL := info ## Build and test addons without building anything else. | |
| 594 | - test-ci-native: | benchmark/napi/.buildstamp test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/sqlite/.buildstamp | ||
| 622 | + test-ci-native: | benchmark/napi/.buildstamp test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/sqlite/.buildstamp test/ffi/.buildstamp | ||
| 595 | 623 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ | |
| 596 | 624 | --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ | |
| 597 | 625 | $(TEST_CI_ARGS) $(CI_NATIVE_SUITES) | |
@@ -614,7 +642,7 @@ test-ci-js: | clear-stalled ## Build and test JavaScript with building anything | |||
| 614 | 642 | .PHONY: test-ci | |
| 615 | 643 | # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned | |
| 616 | 644 | test-ci: LOGLEVEL := info ## Build and test everything (CI). | |
| 617 | - test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests doc-only | ||
| 645 | + test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tests build-node-api-tests build-sqlite-tests build-ffi-tests doc-only | ||
| 618 | 646 | out/Release/cctest --gtest_output=xml:out/junit/cctest.xml | |
| 619 | 647 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ | |
| 620 | 648 | --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ | |
@@ -632,6 +660,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes | |||
| 632 | 660 | build-ci: ## Build everything (CI). | |
| 633 | 661 | $(PYTHON) ./configure --verbose $(CONFIG_FLAGS) | |
| 634 | 662 | $(MAKE) | |
| 663 | + $(MAKE) build-ffi-tests | ||
| 635 | 664 | ||
| 636 | 665 | .PHONY: run-ci | |
| 637 | 666 | # Run by CI tests, exceptions: | |
@@ -734,6 +763,16 @@ test-sqlite-clean: ## Remove SQLite testing artifacts. | |||
| 734 | 763 | $(RM) -r test/sqlite/*/build | |
| 735 | 764 | $(RM) test/sqlite/.buildstamp | |
| 736 | 765 | ||
| 766 | + .PHONY: test-ffi | ||
| 767 | + test-ffi: test-build-ffi ## Run FFI tests. | ||
| 768 | + $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) ffi | ||
| 769 | + | ||
| 770 | + .PHONY: test-ffi-clean | ||
| 771 | + .NOTPARALLEL: test-ffi-clean | ||
| 772 | + test-ffi-clean: ## Remove FFI testing artifacts. | ||
| 773 | + $(RM) -r test/ffi/*/build | ||
| 774 | + $(RM) test/ffi/.buildstamp | ||
| 775 | + | ||
| 737 | 776 | .PHONY: test-addons | |
| 738 | 777 | test-addons: test-build test-js-native-api test-node-api ## Run addon tests. | |
| 739 | 778 | $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons | |
@@ -1228,6 +1267,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1) | |||
| 1228 | 1267 | $(RM) -r $(TARNAME)/deps/icu-small | |
| 1229 | 1268 | $(RM) -r $(TARNAME)/deps/icu-tmp | |
| 1230 | 1269 | $(RM) -r $(TARNAME)/deps/LIEF | |
| 1270 | + $(RM) -r $(TARNAME)/deps/libffi | ||
| 1231 | 1271 | $(RM) -r $(TARNAME)/deps/llhttp | |
| 1232 | 1272 | $(RM) -r $(TARNAME)/deps/merve | |
| 1233 | 1273 | $(RM) -r $(TARNAME)/deps/nbytes | |
@@ -1502,6 +1542,7 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ | |||
| 1502 | 1542 | test/embedding/*.cc \ | |
| 1503 | 1543 | test/embedding/*.h \ | |
| 1504 | 1544 | test/sqlite/*/*.c \ | |
| 1545 | + test/ffi/*/*.c \ | ||
| 1505 | 1546 | test/fixtures/*.c \ | |
| 1506 | 1547 | test/js-native-api/*/*.cc \ | |
| 1507 | 1548 | test/node-api/*/*.cc \ | |
@@ -1526,6 +1567,7 @@ FORMAT_CPP_FILES += $(wildcard \ | |||
| 1526 | 1567 | test/node-api/*/*.c \ | |
| 1527 | 1568 | test/node-api/*/*.h \ | |
| 1528 | 1569 | test/sqlite/*/*.c \ | |
| 1570 | + test/ffi/*/*.c \ | ||
| 1529 | 1571 | ) | |
| 1530 | 1572 | ||
| 1531 | 1573 | # Code blocks don't have newline at the end, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -686,6 +686,28 @@ | |||
| 686 | 686 | dest='shared_sqlite_libpath', | |
| 687 | 687 | help='a directory to search for the shared sqlite DLL') | |
| 688 | 688 | ||
| 689 | + shared_optgroup.add_argument('--shared-ffi', | ||
| 690 | + action='store_true', | ||
| 691 | + dest='shared_ffi', | ||
| 692 | + default=None, | ||
| 693 | + help='link to a shared libffi DLL instead of static linking') | ||
| 694 | + | ||
| 695 | + shared_optgroup.add_argument('--shared-ffi-includes', | ||
| 696 | + action='store', | ||
| 697 | + dest='shared_ffi_includes', | ||
| 698 | + help='directory containing libffi header files') | ||
| 699 | + | ||
| 700 | + shared_optgroup.add_argument('--shared-ffi-libname', | ||
| 701 | + action='store', | ||
| 702 | + dest='shared_ffi_libname', | ||
| 703 | + default='ffi', | ||
| 704 | + help='alternative libffi name to link to [default: %(default)s]') | ||
| 705 | + | ||
| 706 | + shared_optgroup.add_argument('--shared-ffi-libpath', | ||
| 707 | + action='store', | ||
| 708 | + dest='shared_ffi_libpath', | ||
| 709 | + help='a directory to search for the shared libffi DLL') | ||
| 710 | + | ||
| 689 | 711 | shared_optgroup.add_argument('--shared-temporal_capi', | |
| 690 | 712 | action='store_true', | |
| 691 | 713 | dest='shared_temporal_capi', | |
@@ -1017,6 +1039,12 @@ | |||
| 1017 | 1039 | default=None, | |
| 1018 | 1040 | help='build without SQLite (disables SQLite and Web Storage API)') | |
| 1019 | 1041 | ||
| 1042 | + parser.add_argument('--without-ffi', | ||
| 1043 | + action='store_true', | ||
| 1044 | + dest='without_ffi', | ||
| 1045 | + default=None, | ||
| 1046 | + help='build without FFI (Foreign Function Interface) support') | ||
| 1047 | + | ||
| 1020 | 1048 | parser.add_argument('--experimental-quic', | |
| 1021 | 1049 | action='store_true', | |
| 1022 | 1050 | dest='experimental_quic', | |
@@ -2237,6 +2265,43 @@ def without_sqlite_error(option): | |||
| 2237 | 2265 | ||
| 2238 | 2266 | configure_library('sqlite', o, pkgname='sqlite3') | |
| 2239 | 2267 | ||
| 2268 | + def bundled_ffi_supported(os_name, target_arch): | ||
| 2269 | + supported = { | ||
| 2270 | + 'freebsd': {'arm', 'arm64', 'x64'}, | ||
| 2271 | + 'linux': {'arm', 'arm64', 'x64'}, | ||
| 2272 | + 'mac': {'arm64', 'x64'}, | ||
| 2273 | + 'win': {'arm64', 'x64'}, | ||
| 2274 | + } | ||
| 2275 | + | ||
| 2276 | + if target_arch == 'x86': | ||
| 2277 | + target_arch = 'ia32' | ||
| 2278 | + | ||
| 2279 | + return target_arch in supported.get(os_name, set()) | ||
| 2280 | + | ||
| 2281 | + def configure_ffi(o): | ||
| 2282 | + use_ffi = not options.without_ffi | ||
| 2283 | + | ||
| 2284 | + if use_ffi and not options.shared_ffi: | ||
| 2285 | + target_arch = o['variables']['target_arch'] | ||
| 2286 | + if not bundled_ffi_supported(flavor, target_arch): | ||
| 2287 | + warn(f'FFI is disabled for {flavor}/{target_arch}: the bundled libffi ' | ||
| 2288 | + 'integration is not available on this platform. Use --shared-ffi ' | ||
| 2289 | + 'to provide a system libffi or --without-ffi to silence this ' | ||
| 2290 | + 'warning.') | ||
| 2291 | + use_ffi = False | ||
| 2292 | + | ||
| 2293 | + o['variables']['node_use_ffi'] = b(use_ffi) | ||
| 2294 | + | ||
| 2295 | + if options.without_ffi: | ||
| 2296 | + if options.shared_ffi: | ||
| 2297 | + error('--without-ffi is incompatible with --shared-ffi') | ||
| 2298 | + return | ||
| 2299 | + | ||
| 2300 | + if not use_ffi: | ||
| 2301 | + return | ||
| 2302 | + | ||
| 2303 | + configure_library('ffi', o, pkgname='libffi') | ||
| 2304 | + | ||
| 2240 | 2305 | def configure_quic(o): | |
| 2241 | 2306 | o['variables']['node_use_quic'] = b(options.experimental_quic and | |
| 2242 | 2307 | not options.without_ssl) | |
@@ -2690,6 +2755,7 @@ def make_bin_override(): | |||
| 2690 | 2755 | configure_library('ngtcp2', output, pkgname='libngtcp2') | |
| 2691 | 2756 | configure_lief(output); | |
| 2692 | 2757 | configure_sqlite(output); | |
| 2758 | + configure_ffi(output); | ||
| 2693 | 2759 | configure_library('temporal_capi', output) | |
| 2694 | 2760 | configure_library('uvwasi', output) | |
| 2695 | 2761 | configure_library('zstd', output, pkgname='libzstd') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments