- node-gyp-addon-gypi.patch: refreshed

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs21?expand=0&rev=25
This commit is contained in:
Adam Majer 2024-04-09 12:50:48 +00:00 committed by Git OBS Bridge
parent c2da7b7524
commit b2d354a373
3 changed files with 86 additions and 31 deletions

View File

@ -1,7 +1,7 @@
Index: node-v20.10.0/addon-rpm.gypi
Index: node-v21.7.1/addon-rpm.gypi
===================================================================
--- /dev/null
+++ node-v20.10.0/addon-rpm.gypi
+++ node-v21.7.1/addon-rpm.gypi
@@ -0,0 +1,35 @@
+{
+ 'target_defaults': {
@ -38,10 +38,10 @@ Index: node-v20.10.0/addon-rpm.gypi
+ ]
+ }
+}
Index: node-v20.10.0/deps/npm/node_modules/node-gyp/lib/configure.js
Index: node-v21.7.1/deps/npm/node_modules/node-gyp/lib/configure.js
===================================================================
--- node-v20.10.0.orig/deps/npm/node_modules/node-gyp/lib/configure.js
+++ node-v20.10.0/deps/npm/node_modules/node-gyp/lib/configure.js
--- node-v21.7.1.orig/deps/npm/node_modules/node-gyp/lib/configure.js
+++ node-v21.7.1/deps/npm/node_modules/node-gyp/lib/configure.js
@@ -36,10 +36,6 @@ async function configure (gyp, argv) {
if ('v' + release.version !== process.version) {
// if --target was given, then determine a target version to compile for
@ -66,13 +66,47 @@ Index: node-v20.10.0/deps/npm/node_modules/node-gyp/lib/configure.js
}
return createBuildDir()
@@ -201,7 +203,8 @@ async function configure (gyp, argv) {
@@ -201,8 +203,16 @@ async function configure (gyp, argv) {
// this logic ported from the old `gyp_addon` python file
const gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
- const addonGypi = path.resolve(__dirname, '..', 'addon.gypi')
- let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
+ let addon_gypi_file = gyp.opts.target || gyp.opts.nodedir ? 'addon.gypi' : 'addon-rpm.gypi'
+ var addonGypi = path.resolve(__dirname, '..', addon_gypi_file)
let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
+ let addonGypi = path.resolve(__dirname, '..', addon_gypi_file)
+ let commonGypi = path.resolve(nodeDir, 'include/node21/common.gypi')
+
+ try {
+ await fs.stat(commonGypi)
+ } catch (err) {
+ commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
+ }
+
try {
await fs.stat(commonGypi)
} catch (err) {
Index: node-v21.7.1/deps/npm/node_modules/node-gyp/addon.gypi
===================================================================
--- node-v21.7.1.orig/deps/npm/node_modules/node-gyp/addon.gypi
+++ node-v21.7.1/deps/npm/node_modules/node-gyp/addon.gypi
@@ -18,6 +18,7 @@
],
'include_dirs': [
+ '<(node_root_dir)/include/node21',
'<(node_root_dir)/include/node',
'<(node_root_dir)/src',
'<(node_root_dir)/deps/openssl/config',
Index: node-v21.7.1/tools/build_addons.py
===================================================================
--- node-v21.7.1.orig/tools/build_addons.py
+++ node-v21.7.1/tools/build_addons.py
@@ -27,7 +27,7 @@ def generate_headers(headers_dir, instal
def rebuild_addons(args):
headers_dir = os.path.abspath(args.headers_dir)
out_dir = os.path.abspath(args.out_dir)
- node_bin = os.path.join(out_dir, 'node')
+ node_bin = os.path.join(out_dir, 'node21')
if args.is_win:
node_bin += '.exe'

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Apr 9 12:30:22 UTC 2024 - Adam Majer <adam.majer@suse.de>
- node-gyp-addon-gypi.patch: refreshed
-------------------------------------------------------------------
Tue Apr 2 13:54:32 UTC 2024 - Adam Majer <adam.majer@suse.de>

View File

@ -15,7 +15,17 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
###########################################################
#
# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
#
# This spec file is generated from a template hosted at
# https://github.com/AdamMajer/nodejs-packaging
#
###########################################################
# Fedora doesn't have rpm-config-SUSE which provides
# ext_man in /usr/lib/rpm/macros.d/macros.obs
%if 0%{?fedora_version}
%define ext_man .gz
%endif
@ -140,6 +150,8 @@ Patch5: sle12_python3_compat.patch
Patch7: manual_configure.patch
Patch13: openssl_binary_detection.patch
## Patches specific to SUSE and openSUSE
Patch100: linker_lto_jobs.patch
# PATCH-FIX-OPENSUSE -- set correct path for dtrace if it is built
@ -166,8 +178,8 @@ Patch305: qemu_timeouts_arches.patch
Patch308: node-gyp-config.patch
Patch309: gcc13.patch
BuildRequires: fdupes
BuildRequires: pkg-config
BuildRequires: fdupes
BuildRequires: procps
BuildRequires: xz
BuildRequires: zlib-devel
@ -187,10 +199,10 @@ BuildRequires: config(netcfg)
%if 0%{?suse_version} == 1110
# GCC 5 is only available in the SUSE:SLE-11:SP4:Update repository (SDK).
%if %node_version_number >= 8
BuildRequires: gcc5-c++
BuildRequires: gcc5-c++
%define forced_gcc_version 5
%else
BuildRequires: gcc48-c++
BuildRequires: gcc48-c++
%define forced_gcc_version 4.8
%endif
%endif
@ -200,15 +212,15 @@ BuildRequires: gcc48-c++
# for SLE-12:Update targets
%if 0%{?suse_version} == 1315
%if %node_version_number >= 17
BuildRequires: gcc12-c++
BuildRequires: gcc12-c++
%define forced_gcc_version 12
%else
%if %node_version_number >= 14
BuildRequires: gcc9-c++
BuildRequires: gcc9-c++
%define forced_gcc_version 9
%else
%if %node_version_number >= 8
BuildRequires: gcc7-c++
BuildRequires: gcc7-c++
%define forced_gcc_version 7
%endif
%endif
@ -217,7 +229,7 @@ BuildRequires: gcc7-c++
%if 0%{?suse_version} == 1500
%if %node_version_number >= 17
BuildRequires: gcc12-c++
BuildRequires: gcc12-c++
%define forced_gcc_version 12
%endif
%endif
@ -228,6 +240,7 @@ BuildRequires: gcc12-c++
BuildRequires: gcc-c++
%endif
# Python dependencies
%if %node_version_number >= 14
@ -253,8 +266,8 @@ BuildRequires: python
%endif
%if 0%{?suse_version} >= 1500 && %{node_version_number} >= 10
BuildRequires: group(nobody)
BuildRequires: user(nobody)
BuildRequires: group(nobody)
%endif
# shared openssl
@ -269,10 +282,11 @@ BuildRequires: openssl >= %{openssl_req_ver}
BuildRequires: (libopenssl1_1-hmac if libopenssl-1_1-devel)
BuildRequires: (libopenssl3-hmac if libopenssl-3-devel)
%else
BuildRequires: libopenssl1_1-hmac
BuildRequires: openssl-1_1 >= %{openssl_req_ver}
BuildRequires: libopenssl1_1-hmac
%endif
# /suse_version
%endif
@ -355,8 +369,8 @@ ExclusiveArch: not_buildable
%endif
%endif
Provides: bundled(libuv) = 1.48.0
Provides: bundled(uvwasi) = 0.0.20
Provides: bundled(libuv) = 1.48.0
Provides: bundled(v8) = 11.8.172.17
%if %{with intree_brotli}
Provides: bundled(brotli) = 1.1.0
@ -364,11 +378,12 @@ Provides: bundled(brotli) = 1.1.0
BuildRequires: pkgconfig(libbrotlidec)
%endif
Provides: bundled(base64) = 0.5.2
Provides: bundled(llhttp) = 9.1.3
Provides: bundled(ngtcp2) = 1.3.0
Provides: bundled(simdjson) = 3.7.0
Provides: bundled(base64) = 0.5.2
Provides: bundled(simdutf) = 4.0.8
Provides: bundled(simdjson) = 3.7.0
# bundled url-ada parser, not ada
Provides: bundled(ada) = 2.7.6
@ -389,8 +404,8 @@ provided by npm.
Summary: Development headers for NodeJS 21.x
Group: Development/Languages/NodeJS
Provides: nodejs-devel = %{version}
Requires: %{name} = %{version}
Requires: npm21 = %{version}
Requires: %{name} = %{version}
%description devel
This package provides development headers for Node.js needed for creation
@ -407,12 +422,12 @@ Requires: nodejs-common
Requires: nodejs21 = %{version}
Provides: nodejs-npm = %{version}
Obsoletes: nodejs-npm < 4.0.0
Provides: npm = %{version}
Provides: npm(npm) = 10.5.0
Provides: npm = %{version}
%if 0%{?suse_version} >= 1500
%if %{node_version_number} >= 10
Requires: group(nobody)
Requires: user(nobody)
Requires: group(nobody)
%endif
%endif
Provides: bundled(node-abbrev) = 2.0.0
@ -699,6 +714,8 @@ find -name \*~ -print0 -delete
# abnormalities from patching
find \( -name \*.js.orig -or -name \*.md.orig -or -name \*.1.orig \) -delete
%build
# normalize shebang
%if %{node_version_number} >= 12
@ -1047,7 +1064,7 @@ make test-ci
%{_bindir}/corepack%{node_version_number}
%{_libdir}/node_modules/corepack%{node_version_number}
%dir %{_datadir}/libalternatives/corepack
%{_datadir}/libalternatives/corepack/18.conf
%{_datadir}/libalternatives/corepack/%{node_version_number}.conf
%if ! %{with libalternatives}
%ghost %{_bindir}/corepack-default
%ghost %{_mandir}/man1/corepack.1%{ext_man}
@ -1084,7 +1101,6 @@ update-alternatives --remove corepack-default %{_bindir}/corepack%{node_version_
%endif
%else
%pre
# remove files that are no longer owned but provided by update-alternatives
if ! [ -L %{_mandir}/man1/node.1%{ext_man} ]; then