mirror of https://github.com/electron/electron
71 lines
2.4 KiB
Diff
71 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Attard <sattard@salesforce.com>
|
|
Date: Wed, 13 Jul 2022 13:56:12 -0700
|
|
Subject: build: ensure native module compilation fails if not using a new
|
|
enough builder
|
|
|
|
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
|
|
|
|
diff --git a/common.gypi b/common.gypi
|
|
index 292cd621dd6d2a6bfcbf959c5910563446492fd9..722b4c3d376ce6eaa683397b693f9bad8f2aa584 100644
|
|
--- a/common.gypi
|
|
+++ b/common.gypi
|
|
@@ -86,6 +86,8 @@
|
|
'v8_use_perfetto': 0,
|
|
'tsan%': 0,
|
|
|
|
+ 'using_electron_config_gypi%': 0,
|
|
+
|
|
##### end V8 defaults #####
|
|
|
|
# When building native modules using 'npm install' with the system npm,
|
|
@@ -285,6 +287,7 @@
|
|
# Defines these mostly for node-gyp to pickup.
|
|
'defines': [
|
|
'_GLIBCXX_USE_CXX11_ABI=1',
|
|
+ 'ELECTRON_ENSURE_CONFIG_GYPI',
|
|
],
|
|
|
|
# Forcibly disable -Werror. We support a wide range of compilers, it's
|
|
@@ -391,6 +394,11 @@
|
|
}],
|
|
],
|
|
}],
|
|
+ ['using_electron_config_gypi == 1', {
|
|
+ 'defines': [
|
|
+ 'USING_ELECTRON_CONFIG_GYPI',
|
|
+ ],
|
|
+ }],
|
|
# The defines bellow must include all things from the external_v8_defines
|
|
# list in v8/BUILD.gn.
|
|
['v8_enable_v8_checks == 1', {
|
|
diff --git a/configure.py b/configure.py
|
|
index 00c8513d6820ec862bffb06063e9b1ae27d6043d..8169c674d672b7206b3765bcbf68cde04ba2d915 100755
|
|
--- a/configure.py
|
|
+++ b/configure.py
|
|
@@ -1496,6 +1496,7 @@ def configure_library(lib, output, pkgname=None):
|
|
|
|
|
|
def configure_v8(o):
|
|
+ o['variables']['using_electron_config_gypi'] = 1
|
|
o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
|
|
o['variables']['v8_enable_javascript_promise_hooks'] = 1
|
|
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
|
|
diff --git a/src/node.h b/src/node.h
|
|
index 13e29b98d0c91badee41b53c37b4763f73e02e87..16c3ad349e942b83764c7772178baa5057cd64f3 100644
|
|
--- a/src/node.h
|
|
+++ b/src/node.h
|
|
@@ -22,6 +22,12 @@
|
|
#ifndef SRC_NODE_H_
|
|
#define SRC_NODE_H_
|
|
|
|
+#ifdef ELECTRON_ENSURE_CONFIG_GYPI
|
|
+#ifndef USING_ELECTRON_CONFIG_GYPI
|
|
+#error "It looks like you are building this native module without using the right config.gypi. This normally means that you need to update electron-rebuild (>=3.2.8) or node-gyp (>=9.0.0) if you're building modules directly."
|
|
+#endif
|
|
+#endif
|
|
+
|
|
#ifdef _WIN32
|
|
# ifndef BUILDING_NODE_EXTENSION
|
|
# define NODE_EXTERN __declspec(dllexport)
|