From c2768f1e12a0cfce140d972e078ea5a948c2cc0d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Sat, 25 Jan 2020 23:05:50 +0100 Subject: [PATCH] - up to 12.14.1 --- 0001-Disable-running-gyp-on-shared-deps.patch | 29 +++++ ...Install-both-binaries-and-use-libdir.patch | 86 ++++++++++++++ nodejs-lib64path.patch | 16 +-- nodejs-shared.patch | 112 ------------------ nodejs-soname.patch | 10 -- nodejs.spec | 58 ++++----- uv-fpic.patch | 20 ---- 7 files changed, 152 insertions(+), 179 deletions(-) create mode 100644 0001-Disable-running-gyp-on-shared-deps.patch create mode 100644 0002-Install-both-binaries-and-use-libdir.patch delete mode 100644 nodejs-shared.patch delete mode 100644 nodejs-soname.patch delete mode 100644 uv-fpic.patch diff --git a/0001-Disable-running-gyp-on-shared-deps.patch b/0001-Disable-running-gyp-on-shared-deps.patch new file mode 100644 index 0000000..668ff55 --- /dev/null +++ b/0001-Disable-running-gyp-on-shared-deps.patch @@ -0,0 +1,29 @@ +From a560ff12ff44d9732ce325ca4bcde6e536fe3ed0 Mon Sep 17 00:00:00 2001 +From: Zuzana Svetlikova +Date: Thu, 27 Apr 2017 14:25:42 +0200 +Subject: [PATCH 1/3] Disable running gyp on shared deps + +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 0947300f24028d00bcfb79b38d96bded136228e3..5d4f88a705053fbdd6b56ec85e9997670c6a69c5 100644 +--- a/Makefile ++++ b/Makefile +@@ -141,9 +141,9 @@ test-code-cache: with-code-cache + echo "'test-code-cache' target is a noop" + + out/Makefile: config.gypi common.gypi node.gyp \ +- deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp \ +- tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \ +- tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp ++ deps/http_parser/http_parser.gyp \ ++ tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \ ++ tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp + $(PYTHON) tools/gyp_node.py -f make + + # node_version.h is listed because the N-API version is taken from there +-- +2.23.0 + diff --git a/0002-Install-both-binaries-and-use-libdir.patch b/0002-Install-both-binaries-and-use-libdir.patch new file mode 100644 index 0000000..cabec6e --- /dev/null +++ b/0002-Install-both-binaries-and-use-libdir.patch @@ -0,0 +1,86 @@ +From cf581096dd350cf7267e5a12ff26159120274c5c Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Tue, 19 Mar 2019 23:22:40 -0400 +Subject: [PATCH 2/3] Install both binaries and use libdir. + +This allows us to build with a shared library for other users while +still providing the normal executable. + +Signed-off-by: Elliott Sales de Andrade +--- + configure.py | 7 +++++++ + tools/install.py | 29 +++++++++++++---------------- + 2 files changed, 20 insertions(+), 16 deletions(-) + +diff --git a/configure.py b/configure.py +index 20cce214dbb113aeef8f1044d7af88d842a11fd7..e2d78a2a51ef81621618cb20fa76f4a1421bf9e0 100755 +--- a/configure.py ++++ b/configure.py +@@ -559,6 +559,12 @@ parser.add_option('--shared', + help='compile shared library for embedding node in another project. ' + + '(This mode is not officially supported for regular applications)') + ++parser.add_option('--libdir', ++ action='store', ++ dest='libdir', ++ default='lib', ++ help='a directory to install the shared library into') ++ + parser.add_option('--without-v8-platform', + action='store_true', + dest='without_v8_platform', +@@ -1103,6 +1109,7 @@ def configure_node(o): + if o['variables']['want_separate_host_toolset'] == 0: + o['variables']['node_code_cache'] = 'yes' # For testing + o['variables']['node_shared'] = b(options.shared) ++ o['variables']['libdir'] = options.libdir + node_module_version = getmoduleversion.get_version() + + if sys.platform == 'darwin': +diff --git a/tools/install.py b/tools/install.py +index 655802980a6ea94d1d4ca1dc63c8c8e905fbb83a..fe4723bf15012c8aacacb0393dc8294c049b0503 100755 +--- a/tools/install.py ++++ b/tools/install.py +@@ -121,26 +121,23 @@ def subdir_files(path, dest, action): + + def files(action): + is_windows = sys.platform == 'win32' +- output_file = 'node' + output_prefix = 'out/Release/' ++ output_libprefix = output_prefix + +- if 'false' == variables.get('node_shared'): +- if is_windows: +- output_file += '.exe' ++ if is_windows: ++ output_bin = 'node.exe' ++ output_lib = 'node.dll' + else: +- if is_windows: +- output_file += '.dll' +- else: +- output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix') +- # GYP will output to lib.target except on OS X, this is hardcoded +- # in its source - see the _InstallableTargetInstallPath function. +- if sys.platform != 'darwin': +- output_prefix += 'lib.target/' ++ output_bin = 'node' ++ output_lib = 'libnode.' + variables.get('shlib_suffix') ++ # GYP will output to lib.target except on OS X, this is hardcoded ++ # in its source - see the _InstallableTargetInstallPath function. ++ if sys.platform != 'darwin': ++ output_libprefix += 'lib.target/' + +- if 'false' == variables.get('node_shared'): +- action([output_prefix + output_file], 'bin/' + output_file) +- else: +- action([output_prefix + output_file], 'lib/' + output_file) ++ action([output_prefix + output_bin], 'bin/' + output_bin) ++ if 'true' == variables.get('node_shared'): ++ action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib) + + if 'true' == variables.get('node_use_dtrace'): + action(['out/Release/node.d'], 'lib/dtrace/node.d') +-- +2.23.0 + diff --git a/nodejs-lib64path.patch b/nodejs-lib64path.patch index bb7e68d..f2dbc57 100644 --- a/nodejs-lib64path.patch +++ b/nodejs-lib64path.patch @@ -1,11 +1,11 @@ ---- node-v10.16.0/lib/internal/modules/cjs/loader.js~ 2019-05-28 23:32:23.000000000 +0200 -+++ node-v10.16.0/lib/internal/modules/cjs/loader.js 2019-06-03 09:11:35.662170541 +0200 -@@ -861,7 +861,7 @@ Module._initPaths = function() { - } else { - prefixDir = path.resolve(process.execPath, '..', '..'); - } -- var paths = [path.resolve(prefixDir, 'lib', 'node')]; -+ var paths = ["/usr/lib64/node", "/usr/lib/node", "/usr/lib/node_modules", path.resolve(prefixDir, 'lib', 'node')]; +--- node-v12.14.1/lib/internal/modules/cjs/loader.js~ 2020-01-07 13:16:01.000000000 +0100 ++++ node-v12.14.1/lib/internal/modules/cjs/loader.js 2020-01-25 16:53:22.188427110 +0100 +@@ -1095,7 +1095,7 @@ Module._initPaths = function() { + path.resolve(process.execPath, '..') : + path.resolve(process.execPath, '..', '..'); + +- let paths = [path.resolve(prefixDir, 'lib', 'node')]; ++ let paths = ["/usr/lib64/node", "/usr/lib/node", "/usr/lib/node_modules", path.resolve(prefixDir, 'lib', 'node')]; if (homeDir) { paths.unshift(path.resolve(homeDir, '.node_libraries')); diff --git a/nodejs-shared.patch b/nodejs-shared.patch deleted file mode 100644 index c22719e..0000000 --- a/nodejs-shared.patch +++ /dev/null @@ -1,112 +0,0 @@ ---- node-v0.10.3/common.gypi~ 2013-04-03 20:30:57.000000000 +0300 -+++ node-v0.10.3/common.gypi 2013-04-08 15:50:00.327121152 +0300 -@@ -8,6 +8,8 @@ - 'component%': 'static_library', # NB. these names match with what V8 expects - 'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way - 'gcc_version%': 'unknown', -+ # For a shared library build, results in "libnode.so.<(soname_version)". -+ 'soname_version%': '', - 'clang%': 0, - 'python%': 'python', - ---- node-v0.10.3-o/node.gyp 2013-04-03 11:30:57.000000000 -0600 -+++ node-v0.10.3/node.gyp 2013-04-03 19:30:22.000000000 -0600 -@@ -67,17 +67,35 @@ - 'type': 'executable', - - 'dependencies': [ -- 'node_js2c#host', -+ 'libnode' - ], - -- 'include_dirs': [ -- 'src', -- 'tools/msvs/genfiles', -- 'deps/uv/src/ares', -- '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h -+ 'conditions': [ -+ [ 'node_shared_libuv=="false"', { -+ 'dependencies': [ 'deps/uv/uv.gyp:libuv' ], -+ }], - ], - - 'sources': [ -+ 'src/node_main.cc', -+ # node.gyp is added to the project by default. -+ 'common.gypi', -+ ], -+ -+ 'defines': [ -+ 'NODE_WANT_INTERNALS=1', -+ 'ARCH="<(target_arch)"', -+ 'PLATFORM="<(OS)"', -+ ], -+ }, -+ { -+ 'target_name': 'libnode', -+ 'type': 'shared_library', -+ 'product_extension': 'so.<(soname_version)', -+ 'soname_version': '<(soname_version)', -+ 'cflags': ['-fPIC'], -+ -+ 'sources': [ - 'src/fs_event_wrap.cc', - 'src/cares_wrap.cc', - 'src/handle_wrap.cc', -@@ -88,7 +106,6 @@ - 'src/node_file.cc', - 'src/node_http_parser.cc', - 'src/node_javascript.cc', -- 'src/node_main.cc', - 'src/node_os.cc', - 'src/node_script.cc', - 'src/node_stat_watcher.cc', -@@ -137,6 +154,17 @@ - 'common.gypi', - ], - -+ 'include_dirs': [ -+ 'src', -+ 'tools/msvs/genfiles', -+ 'deps/uv/src/ares', -+ '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h -+ ], -+ -+ 'dependencies': [ -+ 'node_js2c#host', -+ ], -+ - 'defines': [ - 'NODE_WANT_INTERNALS=1', - 'ARCH="<(target_arch)"', ---- node-v0.10.3-o/tools/install.py 2013-04-03 11:30:57.000000000 -0600 -+++ node-v0.10.3/tools/install.py 2013-04-03 19:31:32.000000000 -0600 -@@ -119,7 +119,9 @@ - assert(0) # unhandled action type - - def files(action): -+ global lib_dir - action(['out/Release/node'], 'bin/node') -+ action(['out/Release/lib.target/libnode.so.10'], lib_dir + '/libnode.so.10.3.0') - - # install unconditionally, checking if the platform supports dtrace doesn't - # work when cross-compiling and besides, there's at least one linux flavor -@@ -134,7 +136,7 @@ - if 'true' == variables.get('node_install_npm'): npm_files(action) - - def run(args): -- global dst_dir, node_prefix, target_defaults, variables -+ global dst_dir, node_prefix, target_defaults, variables, lib_dir - - # chdir to the project's top-level directory - os.chdir(abspath(os.path.dirname(__file__), '..')) -@@ -147,6 +149,9 @@ - dst_dir = node_prefix = variables.get('node_prefix') or '/usr/local' - if len(args) > 2: dst_dir = abspath(args[2] + '/' + dst_dir) - -+ lib_dir = 'lib' -+ if len(args) > 3: lib_dir = args[3] -+ - cmd = args[1] if len(args) > 1 else 'install' - if cmd == 'install': return files(install) - if cmd == 'uninstall': return files(uninstall) diff --git a/nodejs-soname.patch b/nodejs-soname.patch deleted file mode 100644 index 812c7de..0000000 --- a/nodejs-soname.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- node-v0.4.3-o//wscript 2011-03-18 17:27:18.000000000 -0600 -+++ node-v0.4.3/wscript 2011-03-18 22:36:52.000000000 -0600 -@@ -803,6 +803,7 @@ - node.add_objects = 'eio http_parser' - if product_type_is_lib: - node.install_path = '${LIBDIR}' -+ node.vnum = "10.0.0" # Fixme, derive from version - else: - node.install_path = '${PREFIX}/bin' - node.chmod = 0755 diff --git a/nodejs.spec b/nodejs.spec index 89a7f1e..b68ab05 100644 --- a/nodejs.spec +++ b/nodejs.spec @@ -4,7 +4,7 @@ # Conditional build: %bcond_without system_uv # system uv -%bcond_with shared # build libnode.so shared library +%bcond_with httpparse # use system http-parser and llhttp # NOTES: # - https://nodejs.org/en/download/releases/ @@ -14,31 +14,38 @@ # add-on binaries can be loaded in to without needing to be re-compiled. It # used to be stored as hex value in earlier versions, but is now represented as # an integer. -%define node_module_version 64 +%define node_module_version 72 Summary: Asynchronous JavaScript Engine Summary(pl.UTF-8): Asynchroniczny silnik JavaScriptu Name: nodejs -# 10.x LTS - https://github.com/nodejs/Release -# Active start: 2018-10-30 -# Maintenance start: April 2020 -# Maintenance end: April 2021 -Version: 10.18.1 +# 12.x LTS - https://github.com/nodejs/Release +# Active start: 2019-10-21 +# Maintenance start: October 2020 +# Maintenance end: April 2022 +Version: 12.14.1 Release: 1 License: BSD and MIT and Apache v2.0 and GPL v3 Group: Development/Languages Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz -# Source0-md5: 8efb618a632def2b24e8b3f432b6db14 -Patch1: %{name}-shared.patch +# Source0-md5: 7f2fa2f5df2b8179b5b00ec7de361b34 + # force node to use /usr/lib/node as the systemwide module directory Patch2: %{name}-libpath.patch # use /usr/lib64/node as an arch-specific module dir when appropriate Patch3: %{name}-lib64path.patch -Patch5: uv-fpic.patch +Patch4: 0001-Disable-running-gyp-on-shared-deps.patch +Patch5: 0002-Install-both-binaries-and-use-libdir.patch URL: https://nodejs.org/ +BuildRequires: c-ares-devel >= 1.14.0 BuildRequires: gcc >= 6:4.8 +%if %{with httpparse} BuildRequires: http-parser-devel >= 2.9.2 +BuildRequires: llhttp-devel +%endif +BuildRequires: libicu-devel >= 0.64 BuildRequires: libstdc++-devel >= 6:4.8 %{?with_system_uv:BuildRequires: libuv-devel >= 1.29.0} +BuildRequires: nghttp2-devel >= 1.39.1 BuildRequires: openssl-devel >= 1.0.1 BuildRequires: pkgconfig BuildRequires: python >= 1:2.7 @@ -81,7 +88,7 @@ Summary(pl.UTF-8): Pliki nagłówkowe nodejs Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: gcc -Requires: http-parser-devel >= 2.9.2 +%{?with_http_parse:Requires: http-parser-devel >= 2.9.2} Requires: libstdc++-devel %{?with_system_uv:Requires: libuv-devel >= 1.29.0} Requires: openssl-devel @@ -132,19 +139,19 @@ Sondy systemtap/dtrace dla Node.js. %prep %setup -q -n node-v%{version} -%{?with_shared:%patch1 -p1} #%patch1 -p1 %if %{_lib} == "lib64" %patch3 -p1 %else %patch2 -p1 %endif -#%{?with_system_uv:%patch5 -p1} +%patch4 -p1 +%patch5 -p1 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},' %{__rm} -r deps/npm -%{__rm} -r deps/http_parser +%{?with_httpparse:%{__rm} -r deps/http_parser} %{__rm} -r deps/openssl %{?with_system_uv:%{__rm} -r deps/uv} %{__rm} -r deps/zlib @@ -159,13 +166,17 @@ CXX="%{__cxx}" \ GYP_DEFINES="soname_version=%{sover}" \ ./configure \ --openssl-use-def-ca-store \ - %{?0:--shared-cares} \ + --shared \ + --shared-cares \ --shared-openssl \ - --shared-http-parser \ + %{?with_http_parse:--shared-http-parser} \ + --shared-nghttp2 \ + --with-intl=system-icu \ %{?with_system_uv:--shared-libuv} \ --shared-zlib \ --without-npm \ --without-dtrace \ + --libdir=%{_lib} \ --prefix=%{_prefix} # add LFS defines from libuv (RHBZ#892601) @@ -181,11 +192,7 @@ rm -rf $RPM_BUILD_ROOT %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}" -%if %{with shared} -lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*) -ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10 -ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so -%endif +ln -s libnode.so.%{node_module_version} $RPM_BUILD_ROOT%{_libdir}/libnode.so echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1 @@ -229,20 +236,15 @@ cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version} %clean rm -rf $RPM_BUILD_ROOT -%if %{with shared} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig -%endif %files %defattr(644,root,root,755) %doc README.md AUTHORS CHANGELOG.md LICENSE %attr(755,root,root) %{_bindir}/node %attr(755,root,root) %{_bindir}/nodejs -%if %{with shared} -%attr(755,root,root) %{_libdir}/libnode.so.*.*.* -%attr(755,root,root) %ghost %{_libdir}/libnode.so.10 -%endif +%attr(755,root,root) %{_libdir}/libnode.so.%{node_module_version} %if "%{_lib}" != "lib" %dir %{_libdir}/node %endif @@ -253,9 +255,7 @@ rm -rf $RPM_BUILD_ROOT %files devel %defattr(644,root,root,755) -%if %{with shared} %attr(755,root,root) %{_libdir}/libnode.so -%endif %{_includedir}/node %{_pkgconfigdir}/nodejs.pc %{_usrsrc}/%{name} diff --git a/uv-fpic.patch b/uv-fpic.patch deleted file mode 100644 index 6c26e78..0000000 --- a/uv-fpic.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- node-v0.6.19/deps/uv/config-unix.mk~ 2012-06-06 03:46:27.000000000 +0300 -+++ node-v0.6.19/deps/uv/config-unix.mk 2012-06-14 22:23:21.230218071 +0300 -@@ -26,6 +26,7 @@ - - CPPFLAGS += -D_LARGEFILE_SOURCE - CPPFLAGS += -D_FILE_OFFSET_BITS=64 -+CPPFLAGS += -fPIC - - OBJS += src/unix/core.o - OBJS += src/unix/dl.o ---- node-v0.10.40/deps/uv/uv.gyp~ 2015-07-09 23:19:36.000000000 +0200 -+++ node-v0.10.40/deps/uv/uv.gyp 2016-01-01 17:30:58.139553119 +0100 -@@ -126,6 +126,7 @@ - '-Wall', - '-Wextra', - '-Wno-unused-parameter', -+ '-fPIC', - ], - 'sources': [ - 'include/uv-private/uv-unix.h', -- 2.44.0