From bda3ee6276d76a10d2b5564da5709db4c21b8f13 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 13 Aug 2020 21:54:13 -0700 Subject: nodejs: Upgrade to 12.18.3 Drop already upstreamed patches use builtin uv, it does not build without it Signed-off-by: Khem Raj --- ...allow-passing-multiple-libs-to-pkg_config.patch | 41 ----- .../0001-deps-V8-backport-3f8dc4b2e5ba.patch | 194 --------------------- ...uild-allow-use-of-system-installed-brotli.patch | 66 ------- ...0003-Install-both-binaries-and-use-libdir.patch | 28 ++- meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb | 164 ----------------- meta-oe/recipes-devtools/nodejs/nodejs_12.18.3.bb | 160 +++++++++++++++++ 6 files changed, 170 insertions(+), 483 deletions(-) delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs_12.18.3.bb diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch deleted file mode 100644 index 13edf229b3..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch +++ /dev/null @@ -1,41 +0,0 @@ -From fdaa0e3bef93c5c72a7258b5f1e30718e7d81f9b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andr=C3=A9=20Draszik?= -Date: Mon, 2 Mar 2020 12:17:09 +0000 -Subject: [PATCH 1/2] build: allow passing multiple libs to pkg_config -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Sometimes it's necessary to pass multiple library names to pkg-config, -e.g. the brotli shared libraries can be pulled in with - pkg-config libbrotlienc libbrotlidec - -Update the code to handle both, strings (as used so far), and lists -of strings. - -Signed-off-by: André Draszik ---- -Upstream-Status: Submitted [https://github.com/nodejs/node/pull/32046] - configure.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/configure.py b/configure.py -index beb08df088..e3f78f2fed 100755 ---- a/configure.py -+++ b/configure.py -@@ -680,7 +680,11 @@ def pkg_config(pkg): - retval = () - for flag in ['--libs-only-l', '--cflags-only-I', - '--libs-only-L', '--modversion']: -- args += [flag, pkg] -+ args += [flag] -+ if isinstance(pkg, list): -+ args += pkg -+ else: -+ args += [pkg] - try: - proc = subprocess.Popen(shlex.split(pkg_config) + args, - stdout=subprocess.PIPE) --- -2.25.0 - diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch deleted file mode 100644 index 07dbdfe564..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0001-deps-V8-backport-3f8dc4b2e5ba.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 836311710ca8d49fdf4d619e3a738a445c413605 Mon Sep 17 00:00:00 2001 -From: Ujjwal Sharma -Date: Wed, 22 Apr 2020 12:20:17 +0530 -Subject: [PATCH] deps: V8: backport 3f8dc4b2e5ba -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Original commit message: - - [intl] Remove soon-to-be removed getAllFieldPositions - - Needed to land ICU67.1 soon. - - Bug: v8:10393 - Change-Id: I3c7737ca600d6ccfdc46ffaddfb318ce60bc7618 - Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2136489 - Reviewed-by: Jakob Kummerow - Commit-Queue: Frank Tang - Cr-Commit-Position: refs/heads/master@{#67027} - -Refs: https://github.com/v8/v8/commit/3f8dc4b2e5baf77b463334c769af85b79d8c1463 - -PR-URL: https://github.com/nodejs/node/pull/32993 -Reviewed-By: Michaël Zasso -Reviewed-By: Matheus Marchini -Reviewed-By: Steven R Loomis -Reviewed-By: Richard Lau ---- - common.gypi | 2 +- - deps/v8/src/objects/js-number-format.cc | 72 +++++++++++++------------ - 2 files changed, 38 insertions(+), 36 deletions(-) - -diff --git a/common.gypi b/common.gypi -index b86e5e0..a7b37e6 100644 ---- a/common.gypi -+++ b/common.gypi -@@ -38,7 +38,7 @@ - - # Reset this number to 0 on major V8 upgrades. - # Increment by one for each non-official patch applied to deps/v8. -- 'v8_embedder_string': '-node.16', -+ 'v8_embedder_string': '-node.17', - - ##### V8 defaults for Node.js ##### - -diff --git a/deps/v8/src/objects/js-number-format.cc b/deps/v8/src/objects/js-number-format.cc -index d1e3ef4..757c665 100644 ---- a/deps/v8/src/objects/js-number-format.cc -+++ b/deps/v8/src/objects/js-number-format.cc -@@ -1252,42 +1252,31 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, - } - - namespace { --Maybe IcuFormatNumber( -+Maybe IcuFormatNumber( - Isolate* isolate, - const icu::number::LocalizedNumberFormatter& number_format, -- Handle numeric_obj, icu::FieldPositionIterator* fp_iter) { -+ Handle numeric_obj, icu::number::FormattedNumber* formatted) { - // If it is BigInt, handle it differently. - UErrorCode status = U_ZERO_ERROR; -- icu::number::FormattedNumber formatted; - if (numeric_obj->IsBigInt()) { - Handle big_int = Handle::cast(numeric_obj); - Handle big_int_string; - ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, big_int_string, - BigInt::ToString(isolate, big_int), -- Nothing()); -- formatted = number_format.formatDecimal( -+ Nothing()); -+ *formatted = number_format.formatDecimal( - {big_int_string->ToCString().get(), big_int_string->length()}, status); - } else { - double number = numeric_obj->Number(); -- formatted = number_format.formatDouble(number, status); -+ *formatted = number_format.formatDouble(number, status); - } - if (U_FAILURE(status)) { - // This happen because of icu data trimming trim out "unit". - // See https://bugs.chromium.org/p/v8/issues/detail?id=8641 -- THROW_NEW_ERROR_RETURN_VALUE(isolate, -- NewTypeError(MessageTemplate::kIcuError), -- Nothing()); -- } -- if (fp_iter) { -- formatted.getAllFieldPositions(*fp_iter, status); -+ THROW_NEW_ERROR_RETURN_VALUE( -+ isolate, NewTypeError(MessageTemplate::kIcuError), Nothing()); - } -- icu::UnicodeString result = formatted.toString(status); -- if (U_FAILURE(status)) { -- THROW_NEW_ERROR_RETURN_VALUE(isolate, -- NewTypeError(MessageTemplate::kIcuError), -- Nothing()); -- } -- return Just(result); -+ return Just(true); - } - - } // namespace -@@ -1298,10 +1287,16 @@ MaybeHandle JSNumberFormat::FormatNumeric( - Handle numeric_obj) { - DCHECK(numeric_obj->IsNumeric()); - -- Maybe maybe_format = -- IcuFormatNumber(isolate, number_format, numeric_obj, nullptr); -+ icu::number::FormattedNumber formatted; -+ Maybe maybe_format = -+ IcuFormatNumber(isolate, number_format, numeric_obj, &formatted); - MAYBE_RETURN(maybe_format, Handle()); -- return Intl::ToString(isolate, maybe_format.FromJust()); -+ UErrorCode status = U_ZERO_ERROR; -+ icu::UnicodeString result = formatted.toString(status); -+ if (U_FAILURE(status)) { -+ THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), String); -+ } -+ return Intl::ToString(isolate, result); - } - - namespace { -@@ -1414,12 +1409,18 @@ std::vector FlattenRegionsToParts( - } - - namespace { --Maybe ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, -- icu::FieldPositionIterator* fp_iter, -+Maybe ConstructParts(Isolate* isolate, -+ icu::number::FormattedNumber* formatted, - Handle result, int start_index, - Handle numeric_obj, bool style_is_unit) { -+ UErrorCode status = U_ZERO_ERROR; -+ icu::UnicodeString formatted_text = formatted->toString(status); -+ if (U_FAILURE(status)) { -+ THROW_NEW_ERROR_RETURN_VALUE( -+ isolate, NewTypeError(MessageTemplate::kIcuError), Nothing()); -+ } - DCHECK(numeric_obj->IsNumeric()); -- int32_t length = formatted.length(); -+ int32_t length = formatted_text.length(); - int index = start_index; - if (length == 0) return Just(index); - -@@ -1428,13 +1429,14 @@ Maybe ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, - // other region covers some part of the formatted string. It's possible - // there's another field with exactly the same begin and end as this backdrop, - // in which case the backdrop's field_id of -1 will give it lower priority. -- regions.push_back(NumberFormatSpan(-1, 0, formatted.length())); -+ regions.push_back(NumberFormatSpan(-1, 0, formatted_text.length())); - - { -- icu::FieldPosition fp; -- while (fp_iter->next(fp)) { -- regions.push_back(NumberFormatSpan(fp.getField(), fp.getBeginIndex(), -- fp.getEndIndex())); -+ icu::ConstrainedFieldPosition cfp; -+ cfp.constrainCategory(UFIELD_CATEGORY_NUMBER); -+ while (formatted->nextPosition(cfp, status)) { -+ regions.push_back( -+ NumberFormatSpan(cfp.getField(), cfp.getStart(), cfp.getLimit())); - } - } - -@@ -1456,7 +1458,7 @@ Maybe ConstructParts(Isolate* isolate, const icu::UnicodeString& formatted, - Handle substring; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, substring, -- Intl::ToString(isolate, formatted, part.begin_pos, part.end_pos), -+ Intl::ToString(isolate, formatted_text, part.begin_pos, part.end_pos), - Nothing()); - Intl::AddElement(isolate, result, index, field_type_string, substring); - ++index; -@@ -1476,14 +1478,14 @@ MaybeHandle JSNumberFormat::FormatToParts( - number_format->icu_number_formatter().raw(); - CHECK_NOT_NULL(fmt); - -- icu::FieldPositionIterator fp_iter; -- Maybe maybe_format = -- IcuFormatNumber(isolate, *fmt, numeric_obj, &fp_iter); -+ icu::number::FormattedNumber formatted; -+ Maybe maybe_format = -+ IcuFormatNumber(isolate, *fmt, numeric_obj, &formatted); - MAYBE_RETURN(maybe_format, Handle()); - - Handle result = factory->NewJSArray(0); - Maybe maybe_format_to_parts = ConstructParts( -- isolate, maybe_format.FromJust(), &fp_iter, result, 0, numeric_obj, -+ isolate, &formatted, result, 0, numeric_obj, - number_format->style() == JSNumberFormat::Style::UNIT); - MAYBE_RETURN(maybe_format_to_parts, Handle()); - --- -2.26.2 - diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch deleted file mode 100644 index fc038f3aae..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch +++ /dev/null @@ -1,66 +0,0 @@ -From f0f927feee8cb1fb173835d5c3f6beb6bf7d5e54 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andr=C3=A9=20Draszik?= -Date: Mon, 2 Mar 2020 12:17:35 +0000 -Subject: [PATCH 2/2] build: allow use of system-installed brotli -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -brotli is available as a shared library since 2016, so it makes sense -to allow its use as a system-installed version. - -Some of the infrastructure was in place already (node.gyp and -node.gypi), but some bits in the configure script here were missing. - -Add them, keeping the default as before, to use the bundled version. - -Refs: https://github.com/google/brotli/pull/421 -Signed-off-by: André Draszik ---- -Upstream-Status: Submitted [https://github.com/nodejs/node/pull/32046] - configure.py | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/configure.py b/configure.py -index e3f78f2fed..0190e31b41 100755 ---- a/configure.py -+++ b/configure.py -@@ -301,6 +301,27 @@ shared_optgroup.add_option('--shared-zlib-libpath', - dest='shared_zlib_libpath', - help='a directory to search for the shared zlib DLL') - -+shared_optgroup.add_option('--shared-brotli', -+ action='store_true', -+ dest='shared_brotli', -+ help='link to a shared brotli DLL instead of static linking') -+ -+shared_optgroup.add_option('--shared-brotli-includes', -+ action='store', -+ dest='shared_brotli_includes', -+ help='directory containing brotli header files') -+ -+shared_optgroup.add_option('--shared-brotli-libname', -+ action='store', -+ dest='shared_brotli_libname', -+ default='brotlidec,brotlienc', -+ help='alternative lib name to link to [default: %default]') -+ -+shared_optgroup.add_option('--shared-brotli-libpath', -+ action='store', -+ dest='shared_brotli_libpath', -+ help='a directory to search for the shared brotli DLL') -+ - shared_optgroup.add_option('--shared-cares', - action='store_true', - dest='shared_cares', -@@ -1692,6 +1713,7 @@ configure_napi(output) - configure_library('zlib', output) - configure_library('http_parser', output) - configure_library('libuv', output) -+configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc']) - configure_library('cares', output, pkgname='libcares') - configure_library('nghttp2', output, pkgname='libnghttp2') - configure_v8(output) --- -2.25.0 - diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir.patch index 599f742b2f..92386fa779 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0003-Install-both-binaries-and-use-libdir.patch @@ -20,11 +20,9 @@ Signed-off-by: Andreas Müller tools/install.py | 31 ++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) -diff --git a/configure.py b/configure.py -index 20cce214db..e2d78a2a51 100755 --- a/configure.py +++ b/configure.py -@@ -559,6 +559,12 @@ parser.add_option('--shared', +@@ -602,6 +602,12 @@ parser.add_option('--shared', help='compile shared library for embedding node in another project. ' + '(This mode is not officially supported for regular applications)') @@ -37,16 +35,14 @@ index 20cce214db..e2d78a2a51 100755 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 +@@ -1168,6 +1174,7 @@ def configure_node(o): + o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) + 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 655802980a..fe4723bf15 100755 + if options.dest_os == 'android': --- a/tools/install.py +++ b/tools/install.py @@ -121,26 +121,23 @@ def subdir_files(path, dest, action): @@ -72,24 +68,20 @@ index 655802980a..fe4723bf15 100755 - # in its source - see the _InstallableTargetInstallPath function. - if sys.platform != 'darwin': - output_prefix += '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) + 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.20.1 - diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb deleted file mode 100644 index 9f9f320aa7..0000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb +++ /dev/null @@ -1,164 +0,0 @@ -DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" -HOMEPAGE = "http://nodejs.org" -LICENSE = "MIT & BSD & Artistic-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=be4d5107c64dc3d7c57e3797e1a0674b" - -DEPENDS = "openssl" -DEPENDS_append_class-target = " nodejs-native" - -inherit pkgconfig python3native - -COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*" -COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*" -COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" - -COMPATIBLE_HOST_riscv64 = "null" -COMPATIBLE_HOST_riscv32 = "null" - -SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ - file://0001-Disable-running-gyp-files-for-bundled-deps.patch \ - file://0003-Install-both-binaries-and-use-libdir.patch \ - file://0004-v8-don-t-override-ARM-CFLAGS.patch \ - file://big-endian.patch \ - file://0001-build-allow-passing-multiple-libs-to-pkg_config.patch \ - file://0002-build-allow-use-of-system-installed-brotli.patch \ - file://mips-warnings.patch \ - file://0001-deps-V8-backport-3f8dc4b2e5ba.patch \ - " -SRC_URI_append_class-target = " \ - file://0002-Using-native-binaries.patch \ - " - -SRC_URI[md5sum] = "1c78a75f5c95321f533ecccca695e814" -SRC_URI[sha256sum] = "877b4b842318b0e09bc754faf7343f2f097f0fc4f88ab9ae57cf9944e88e7adb" - -S = "${WORKDIR}/node-v${PV}" - -# v8 errors out if you have set CCACHE -CCACHE = "" - -def map_nodejs_arch(a, d): - import re - - if re.match('i.86$', a): return 'ia32' - elif re.match('x86_64$', a): return 'x64' - elif re.match('aarch64$', a): return 'arm64' - elif re.match('(powerpc64|ppc64le)$', a): return 'ppc64' - elif re.match('powerpc$', a): return 'ppc' - return a - -ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \ - ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \ - bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \ - bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \ - '--with-arm-fpu=vfp', d), d), d)}" -GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' " -ARCHFLAGS ?= "" - -PACKAGECONFIG ??= "ares brotli icu libuv zlib" -PACKAGECONFIG[ares] = "--shared-cares,,c-ares" -PACKAGECONFIG[brotli] = "--shared-brotli,,brotli" -PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu" -PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" -PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" -PACKAGECONFIG[shared] = "--shared" -PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" - -# We don't want to cross-compile during target compile, -# and we need to use the right flags during host compile, -# too. -EXTRA_OEMAKE = "\ - CC.host='${CC}' \ - CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \ - CXX.host='${CXX}' \ - CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \ - LDFLAGS.host='${LDFLAGS}' \ - AR.host='${AR}' \ - \ - builddir_name=./ \ -" - -python do_unpack() { - import shutil - - bb.build.exec_func('base_do_unpack', d) - - shutil.rmtree(d.getVar('S') + '/deps/openssl', True) - if 'ares' in d.getVar('PACKAGECONFIG'): - shutil.rmtree(d.getVar('S') + '/deps/cares', True) - if 'brotli' in d.getVar('PACKAGECONFIG'): - shutil.rmtree(d.getVar('S') + '/deps/brotli', True) - if 'libuv' in d.getVar('PACKAGECONFIG'): - shutil.rmtree(d.getVar('S') + '/deps/uv', True) - if 'nghttp2' in d.getVar('PACKAGECONFIG'): - shutil.rmtree(d.getVar('S') + '/deps/nghttp2', True) - if 'zlib' in d.getVar('PACKAGECONFIG'): - shutil.rmtree(d.getVar('S') + '/deps/zlib', True) -} - -# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi -do_configure () { - export LD="${CXX}" - GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES - # $TARGET_ARCH settings don't match --dest-cpu settings - python3 configure.py --prefix=${prefix} --cross-compiling --without-snapshot --shared-openssl \ - --without-dtrace \ - --without-etw \ - --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \ - --dest-os=linux \ - --libdir=${D}${libdir} \ - ${ARCHFLAGS} \ - ${PACKAGECONFIG_CONFARGS} -} - -do_compile () { - export LD="${CXX}" - oe_runmake BUILDTYPE=Release -} - -do_install () { - oe_runmake install DESTDIR=${D} - - # wasn't updated since 2009 and is the only thing requiring python2 in runtime - # ERROR: nodejs-12.14.1-r0 do_package_qa: QA Issue: /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples contained in package nodejs-npm requires /usr/bin/python, but no providers found in RDEPENDS_nodejs-npm? [file-rdeps] - rm -f ${D}${exec_prefix}/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples -} - -do_install_append_class-native() { - # use node from PATH instead of absolute path to sysroot - # node-v0.10.25/tools/install.py is using: - # shebang = os.path.join(node_prefix, 'bin/node') - # update_shebang(link_path, shebang) - # and node_prefix can be very long path to bindir in native sysroot and - # when it exceeds 128 character shebang limit it's stripped to incorrect path - # and npm fails to execute like in this case with 133 characters show in log.do_install: - # updating shebang of /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/work/x86_64-linux/nodejs-native/0.10.15-r0/image/home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/npm to /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/node - # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js - # use sed on npm-cli.js because otherwise symlink is replaced with normal file and - # npm-cli.js continues to use old shebang - sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js - - # Install the native binaries to provide it within sysroot for the target compilation - install -d ${D}${bindir} - install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque - install -m 0755 ${S}/out/Release/bytecode_builtins_list_generator ${D}${bindir}/bytecode_builtins_list_generator - if ${@bb.utils.contains('PACKAGECONFIG','icu','true','false',d)}; then - install -m 0755 ${S}/out/Release/gen-regexp-special-case ${D}${bindir}/gen-regexp-special-case - fi - install -m 0755 ${S}/out/Release/mkcodecache ${D}${bindir}/mkcodecache - install -m 0755 ${S}/out/Release/node_mksnapshot ${D}${bindir}/node_mksnapshot -} - -do_install_append_class-target() { - sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js -} - -PACKAGES =+ "${PN}-npm" -FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx" -RDEPENDS_${PN}-npm = "bash python3-core python3-shell python3-datetime \ - python3-misc python3-multiprocessing" - -PACKAGES =+ "${PN}-systemtap" -FILES_${PN}-systemtap = "${datadir}/systemtap" - -BBCLASSEXTEND = "native" diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_12.18.3.bb b/meta-oe/recipes-devtools/nodejs/nodejs_12.18.3.bb new file mode 100644 index 0000000000..8a9f32bce2 --- /dev/null +++ b/meta-oe/recipes-devtools/nodejs/nodejs_12.18.3.bb @@ -0,0 +1,160 @@ +DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" +HOMEPAGE = "http://nodejs.org" +LICENSE = "MIT & BSD & Artistic-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=30e27bd6830002d9415e4a5da7901f03" + +DEPENDS = "openssl" +DEPENDS_append_class-target = " nodejs-native" + +inherit pkgconfig python3native + +COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*" +COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*" +COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" + +COMPATIBLE_HOST_riscv64 = "null" +COMPATIBLE_HOST_riscv32 = "null" + +SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ + file://0001-Disable-running-gyp-files-for-bundled-deps.patch \ + file://0003-Install-both-binaries-and-use-libdir.patch \ + file://0004-v8-don-t-override-ARM-CFLAGS.patch \ + file://big-endian.patch \ + file://mips-warnings.patch \ + " +SRC_URI_append_class-target = " \ + file://0002-Using-native-binaries.patch \ + " +SRC_URI[sha256sum] = "71158026579487422fd13cc2553b34cddb76519098aa6030faab52f88c6e0d0e" + +S = "${WORKDIR}/node-v${PV}" + +# v8 errors out if you have set CCACHE +CCACHE = "" + +def map_nodejs_arch(a, d): + import re + + if re.match('i.86$', a): return 'ia32' + elif re.match('x86_64$', a): return 'x64' + elif re.match('aarch64$', a): return 'arm64' + elif re.match('(powerpc64|ppc64le)$', a): return 'ppc64' + elif re.match('powerpc$', a): return 'ppc' + return a + +ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \ + ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \ + bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \ + bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \ + '--with-arm-fpu=vfp', d), d), d)}" +GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' " +ARCHFLAGS ?= "" + +PACKAGECONFIG ??= "ares brotli icu zlib" + +PACKAGECONFIG[ares] = "--shared-cares,,c-ares" +PACKAGECONFIG[brotli] = "--shared-brotli,,brotli" +PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu" +PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" +PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" +PACKAGECONFIG[shared] = "--shared" +PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" + +# We don't want to cross-compile during target compile, +# and we need to use the right flags during host compile, +# too. +EXTRA_OEMAKE = "\ + CC.host='${CC}' \ + CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \ + CXX.host='${CXX}' \ + CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \ + LDFLAGS.host='${LDFLAGS}' \ + AR.host='${AR}' \ + \ + builddir_name=./ \ +" + +python do_unpack() { + import shutil + + bb.build.exec_func('base_do_unpack', d) + + shutil.rmtree(d.getVar('S') + '/deps/openssl', True) + if 'ares' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/cares', True) + if 'brotli' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/brotli', True) + if 'libuv' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/uv', True) + if 'nghttp2' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/nghttp2', True) + if 'zlib' in d.getVar('PACKAGECONFIG'): + shutil.rmtree(d.getVar('S') + '/deps/zlib', True) +} + +# Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi +do_configure () { + export LD="${CXX}" + GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES + # $TARGET_ARCH settings don't match --dest-cpu settings + python3 configure.py --prefix=${prefix} --cross-compiling --without-snapshot --shared-openssl \ + --without-dtrace \ + --without-etw \ + --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \ + --dest-os=linux \ + --libdir=${D}${libdir} \ + ${ARCHFLAGS} \ + ${PACKAGECONFIG_CONFARGS} +} + +do_compile () { + export LD="${CXX}" + oe_runmake BUILDTYPE=Release +} + +do_install () { + oe_runmake install DESTDIR=${D} + + # wasn't updated since 2009 and is the only thing requiring python2 in runtime + # ERROR: nodejs-12.14.1-r0 do_package_qa: QA Issue: /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples contained in package nodejs-npm requires /usr/bin/python, but no providers found in RDEPENDS_nodejs-npm? [file-rdeps] + rm -f ${D}${exec_prefix}/lib/node_modules/npm/node_modules/node-gyp/gyp/samples/samples +} + +do_install_append_class-native() { + # use node from PATH instead of absolute path to sysroot + # node-v0.10.25/tools/install.py is using: + # shebang = os.path.join(node_prefix, 'bin/node') + # update_shebang(link_path, shebang) + # and node_prefix can be very long path to bindir in native sysroot and + # when it exceeds 128 character shebang limit it's stripped to incorrect path + # and npm fails to execute like in this case with 133 characters show in log.do_install: + # updating shebang of /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/work/x86_64-linux/nodejs-native/0.10.15-r0/image/home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/npm to /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/node + # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js + # use sed on npm-cli.js because otherwise symlink is replaced with normal file and + # npm-cli.js continues to use old shebang + sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js + + # Install the native binaries to provide it within sysroot for the target compilation + install -d ${D}${bindir} + install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque + install -m 0755 ${S}/out/Release/bytecode_builtins_list_generator ${D}${bindir}/bytecode_builtins_list_generator + if ${@bb.utils.contains('PACKAGECONFIG','icu','true','false',d)}; then + install -m 0755 ${S}/out/Release/gen-regexp-special-case ${D}${bindir}/gen-regexp-special-case + fi + install -m 0755 ${S}/out/Release/mkcodecache ${D}${bindir}/mkcodecache + install -m 0755 ${S}/out/Release/node_mksnapshot ${D}${bindir}/node_mksnapshot +} + +do_install_append_class-target() { + sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js +} + +PACKAGES =+ "${PN}-npm" +FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx" +RDEPENDS_${PN}-npm = "bash python3-core python3-shell python3-datetime \ + python3-misc python3-multiprocessing" + +PACKAGES =+ "${PN}-systemtap" +FILES_${PN}-systemtap = "${datadir}/systemtap" + +BBCLASSEXTEND = "native" -- cgit 1.2.3-korg