nodejs: [WIP] Initial support mingw for gyp build
This commit is contained in:
@@ -15,7 +15,7 @@ index 3990c59e..2705cefe 100644
|
||||
'defines!': [
|
||||
'NODE_PLATFORM="win"',
|
||||
],
|
||||
+ 'defines': [ '_WIN32_WINNT=0x0600' ],
|
||||
+ 'defines': [ '_WIN32_WINNT=0x0601' ],
|
||||
'defines': [
|
||||
'FD_SETSIZE=1024',
|
||||
# we need to use node's preferred "win32" rather than gyp's preferred "win"
|
||||
|
||||
72
mingw-w64-nodejs/0024-gyp-mingw.patch
Normal file
72
mingw-w64-nodejs/0024-gyp-mingw.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
diff -Naur node-v11.15.0-orig/configure.py node-v11.15.0/configure.py
|
||||
--- node-v11.15.0-orig/configure.py
|
||||
+++ node-v11.15.0/configure.py
|
||||
@@ -1687,7 +1687,7 @@
|
||||
|
||||
if options.use_ninja:
|
||||
gyp_args += ['-f', 'ninja']
|
||||
-elif flavor == 'win' and sys.platform != 'msys':
|
||||
+elif flavor == 'win' and sys.platform != 'msys' and not ('GCC' in sys.version):
|
||||
gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto']
|
||||
else:
|
||||
gyp_args += ['-f', 'make-' + flavor]
|
||||
diff -Naur node-v11.15.0-orig/tools/gyp/pylib/gyp/generator/make.py node-v11.15.0/tools/gyp/pylib/gyp/generator/make.py
|
||||
--- node-v11.15.0-orig/tools/gyp/pylib/gyp/generator/make.py 2019-04-30 20:31:53.000000000 +0300
|
||||
+++ node-v11.15.0/tools/gyp/pylib/gyp/generator/make.py 2019-06-28 08:07:23.053184000 +0300
|
||||
@@ -94,6 +94,8 @@
|
||||
default_variables.setdefault('OS', operating_system)
|
||||
if flavor == 'aix':
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.a')
|
||||
+ elif flavor == 'win':
|
||||
+ default_variables.setdefault('SHARED_LIB_SUFFIX', '.dll')
|
||||
else:
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
|
||||
default_variables.setdefault('SHARED_LIB_DIR','$(builddir)/lib.$(TOOLSET)')
|
||||
@@ -172,6 +174,26 @@
|
||||
cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
|
||||
"""
|
||||
|
||||
+LINK_COMMANDS_WINMINGW = """\
|
||||
+quiet_cmd_alink = AR($(TOOLSET)) $@
|
||||
+cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
|
||||
+
|
||||
+quiet_cmd_alink_thin = AR($(TOOLSET)) $@
|
||||
+cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
|
||||
+
|
||||
+# Due to circular dependencies between libraries :(, we wrap the
|
||||
+# special "figure out circular dependencies" flags around the entire
|
||||
+# input list during linking.
|
||||
+quiet_cmd_link = LINK($(TOOLSET)) $@
|
||||
+cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group
|
||||
+
|
||||
+quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
||||
+cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--out-implib,$(@F).a -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
|
||||
+
|
||||
+quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
||||
+cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--out-implib,$(@F).a -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
|
||||
+"""
|
||||
+
|
||||
LINK_COMMANDS_MAC = """\
|
||||
quiet_cmd_alink = LIBTOOL-STATIC $@
|
||||
cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
|
||||
@@ -1354,6 +1376,8 @@
|
||||
target_prefix = 'lib'
|
||||
if self.flavor == 'aix':
|
||||
target_ext = '.a'
|
||||
+ elif self.flavor == 'win':
|
||||
+ target_ext = '.dll'
|
||||
else:
|
||||
target_ext = '.so'
|
||||
elif self.type == 'none':
|
||||
@@ -2060,6 +2084,11 @@
|
||||
header_params.update({
|
||||
'copy_archive_args': copy_archive_arguments,
|
||||
})
|
||||
+ elif flavor == 'win':
|
||||
+ copy_archive_arguments = '-pPRf'
|
||||
+ header_params.update({
|
||||
+ 'link_commands': LINK_COMMANDS_WINMINGW,
|
||||
+ })
|
||||
elif flavor == 'aix':
|
||||
copy_archive_arguments = '-pPRf'
|
||||
header_params.update({
|
||||
11
mingw-w64-nodejs/0025-mingw-missing-features.patch
Normal file
11
mingw-w64-nodejs/0025-mingw-missing-features.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- node-v11.15.0-orig/deps/v8/src/base/platform/platform-win32.cc.orig 2019-06-28 08:53:22.904659200 +0300
|
||||
+++ node-v11.15.0/deps/v8/src/base/platform/platform-win32.cc 2019-06-28 08:53:44.904690000 +0300
|
||||
@@ -36,7 +36,7 @@
|
||||
// Extra functions for MinGW. Most of these are the _s functions which are in
|
||||
// the Microsoft Visual Studio C++ CRT.
|
||||
#ifdef __MINGW32__
|
||||
-
|
||||
+#define PAGE_TARGETS_INVALID 0x40000000
|
||||
|
||||
#ifndef __MINGW64_VERSION_MAJOR
|
||||
|
||||
@@ -46,6 +46,8 @@ source=("https://nodejs.org/dist/v${pkgver}/node-v${pkgver}.tar.xz"
|
||||
'0021-Use-wide-character-Win32-API-functions-to-handle-wch.patch'
|
||||
'0022-Disable-MSVC_HACK.patch'
|
||||
'0023-Make-sure-that-__rdtsc-is-declared.patch'
|
||||
'0024-gyp-mingw.patch'
|
||||
'0025-mingw-missing-features.patch'
|
||||
'node')
|
||||
|
||||
prepare() {
|
||||
@@ -71,6 +73,8 @@ prepare() {
|
||||
patch -Np1 -i "${srcdir}/0021-Use-wide-character-Win32-API-functions-to-handle-wch.patch"
|
||||
patch -Np1 -i "${srcdir}/0022-Disable-MSVC_HACK.patch"
|
||||
patch -Np1 -i "${srcdir}/0023-Make-sure-that-__rdtsc-is-declared.patch"
|
||||
patch -Np1 -i "${srcdir}/0024-gyp-mingw.patch"
|
||||
patch -Np1 -i "${srcdir}/0025-mingw-missing-features.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
@@ -111,8 +115,8 @@ build() {
|
||||
# Work around the problem where the protocol files would be generated into a
|
||||
# subdirectory relative to deps/v8/src/inspector instead of relative to the
|
||||
# top-level directory.
|
||||
CXXFLAGS=-D_WIN32_WINNT=0x0600 make out/Release/obj/gen/src/inspector/protocol/Forward.h
|
||||
CXXFLAGS=-D_WIN32_WINNT=0x0600 make
|
||||
#CXXFLAGS=-D_WIN32_WINNT=0x0601 make out/Release/obj/gen/src/inspector/protocol/Forward.h
|
||||
CXXFLAGS=-D_WIN32_WINNT=0x0601 make
|
||||
|
||||
# flatten the nested node_modules/ hierarchy
|
||||
test -z "$(find deps/npm/node_modules | grep '^.\{140,\}$')" ||
|
||||
@@ -155,7 +159,7 @@ sha256sums=('68a776c5d8b8b91a8f2adac2ca4ce4390ae1804883ec7ec9c0d6a6a64d306a76'
|
||||
'7a0f96ba5b8639807a22c592d25e87bceae623d382c41bfc7f994367aa9b8ffb'
|
||||
'8c21a199822d3e106eacbc8e4ef923508293026edc8c55ad838c316cea5bda45'
|
||||
'a8640f1b7b90469ecc5314dd710ee18ae33ef18133263fdb497ff302dd38bc41'
|
||||
'024f46581402936d1ef118e3db9249366157eeea3c1db60ad605eaa465a45476'
|
||||
'afdc52f2aa8b2234ff0824521ad284bf6e3e1261fbd76e96a146643e6e47e4ff'
|
||||
'f15e5266eece74443bedfa9d6d1243083ef30b27cdf621cb4b4267866660387c'
|
||||
'6e1535166dc3fc75540f0e5e3fc25253cf488cb40a98a4b23f7b24e0059ca9f5'
|
||||
'59b052ff5e50f4ab49619bad1d8c388f8a5183256361452e262ffa9e079c99b6'
|
||||
@@ -170,4 +174,6 @@ sha256sums=('68a776c5d8b8b91a8f2adac2ca4ce4390ae1804883ec7ec9c0d6a6a64d306a76'
|
||||
'71e6b87542013c68641bcc8f98a769236f7181125960b2dcd1e7af516b1447ac'
|
||||
'44a8d757584cb725760c9d9bd661fb23ee0a2b555ffca8a449573e4d03db7dcc'
|
||||
'8cc3ef3ce149e5f0869d434538a9bd0a934afc52f0f571f6436694ce11587d12'
|
||||
'fcfe335b02a40cd47623b938505141421a9eb8de8c840d59ef62ff53499d45da'
|
||||
'6e223d2996f4cc02080c7b57521da6f7d29b41f41d4e225f8d1c941d25c1f963'
|
||||
'284251ff443506cd61530a026afb421d0084e4ad25c037bcfe3a045246d729a2')
|
||||
|
||||
Reference in New Issue
Block a user