diff --git a/Disable-running-gyp-on-shared-deps.patch b/Disable-running-gyp-on-shared-deps.patch new file mode 100644 index 0000000..7db5731 --- /dev/null +++ b/Disable-running-gyp-on-shared-deps.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile b/Makefile +index 5fc2bb0c58f5532044a14e9f9595b2316f562726..f1c1545caa220d7442d6d92c49412ec7554de123 100644 +--- a/Makefile ++++ b/Makefile +@@ -121,14 +121,13 @@ with-code-cache: + + .PHONY: test-code-cache + test-code-cache: with-code-cache + $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) code-cache + +-out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ +- deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \ +- deps/v8/gypfiles/features.gypi deps/v8/gypfiles/v8.gyp node.gyp \ +- config.gypi ++out/Makefile: common.gypi deps/http_parser/http_parser.gyp \ ++ deps/v8/gypfiles/toolchain.gypi deps/v8/gypfiles/features.gypi \ ++ deps/v8/gypfiles/v8.gyp node.gyp config.gypi + $(PYTHON) tools/gyp_node.py -f make + + config.gypi: configure configure.py + @if [ -x config.status ]; then \ + ./config.status; \ +-- +2.19.0 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 4b184e0..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# nodejs - -#### Description -JavaScript runtime - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index a30b591..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# nodejs - -#### 介绍 -JavaScript runtime - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/Suppress-NPM-message-to-run-global-update.patch b/Suppress-NPM-message-to-run-global-update.patch new file mode 100644 index 0000000..e95129e --- /dev/null +++ b/Suppress-NPM-message-to-run-global-update.patch @@ -0,0 +1,77 @@ +diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js +index 6f76b23828531e7af98a7e3cd7d5abfaac09b40c..98edb6f45fe073e03794a2ae6e7aa7f5500723ee 100755 +--- a/deps/npm/bin/npm-cli.js ++++ b/deps/npm/bin/npm-cli.js +@@ -67,69 +67,15 @@ + if (conf.usage && npm.command !== 'help') { + npm.argv.unshift(npm.command) + npm.command = 'help' + } + +- var isGlobalNpmUpdate = conf.global && ['install', 'update'].includes(npm.command) && npm.argv.includes('npm') +- + // now actually fire up npm and run the command. + // this is how to use npm programmatically: + conf._exit = true + npm.load(conf, function (er) { + if (er) return errorHandler(er) +- if ( +- !isGlobalNpmUpdate && +- npm.config.get('update-notifier') && +- !unsupported.checkVersion(process.version).unsupported +- ) { +- const pkg = require('../package.json') +- let notifier = require('update-notifier')({pkg}) +- const isCI = require('ci-info').isCI +- if ( +- notifier.update && +- notifier.update.latest !== pkg.version && +- !isCI +- ) { +- const color = require('ansicolors') +- const useColor = npm.config.get('color') +- const useUnicode = npm.config.get('unicode') +- const old = notifier.update.current +- const latest = notifier.update.latest +- let type = notifier.update.type +- if (useColor) { +- switch (type) { +- case 'major': +- type = color.red(type) +- break +- case 'minor': +- type = color.yellow(type) +- break +- case 'patch': +- type = color.green(type) +- break +- } +- } +- const changelog = `https://github.com/npm/cli/releases/tag/v${latest}` +- notifier.notify({ +- message: `New ${type} version of ${pkg.name} available! ${ +- useColor ? color.red(old) : old +- } ${useUnicode ? '→' : '->'} ${ +- useColor ? color.green(latest) : latest +- }\n` + +- `${ +- useColor ? color.yellow('Changelog:') : 'Changelog:' +- } ${ +- useColor ? color.cyan(changelog) : changelog +- }\n` + +- `Run ${ +- useColor +- ? color.green(`npm install -g ${pkg.name}`) +- : `npm i -g ${pkg.name}` +- } to update!` +- }) +- } +- } + npm.commands[npm.command](npm.argv, function (err) { + // https://genius.com/Lin-manuel-miranda-your-obedient-servant-lyrics + if ( + !err && + npm.config.get('ham-it-up') && +-- +2.19.0 + diff --git a/node-v10.11.0-stripped.tar.gz b/node-v10.11.0-stripped.tar.gz new file mode 100644 index 0000000..e5b18dd Binary files /dev/null and b/node-v10.11.0-stripped.tar.gz differ diff --git a/nodejs-tarball.sh b/nodejs-tarball.sh new file mode 100644 index 0000000..237ae13 --- /dev/null +++ b/nodejs-tarball.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +version=$(rpm -q --specfile --qf='%{version}\n' nodejs.spec | head -n1) +rm -f node-v${version}.tar.gz +wget http://nodejs.org/dist/v${version}/node-v${version}.tar.gz +tar -zxf node-v${version}.tar.gz +rm -rf node-v${version}/deps/openssl +tar -zcf node-v${version}-stripped.tar.gz node-v${version} + +fedpkg new-sources node-v${version}-stripped.tar.gz diff --git a/nodejs.spec b/nodejs.spec new file mode 100644 index 0000000..7bc263a --- /dev/null +++ b/nodejs.spec @@ -0,0 +1,221 @@ +%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} + +%global nodejs_epoch 1 +%global nodejs_major 10 +%global nodejs_minor 11 +%global nodejs_patch 0 +%global nodejs_abi %{nodejs_major}.%{nodejs_minor} +%global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} +%global nodejs_release 1 + +%global v8_major 6 +%global v8_minor 8 +%global v8_build 275 +%global v8_patch 32 +%global v8_abi %{v8_major}.%{v8_minor} +%global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch} + +%global c_ares_version 1.14.0 +%global libuv_version 1.23.0 +%global nghttp2_version 1.33.0 +%global icu_version 62.1 +%global punycode_version 2.1.0 + +%global npm_epoch 1 +%global npm_version 6.4.1 +%global npm_release 1.10.11.0.1 + +Name: nodejs +Epoch: %{nodejs_epoch} +Version: %{nodejs_version} +Release: %{nodejs_release} +Summary: JavaScript runtime +License: MIT and ASL 2.0 and ISC and BSD +URL: http://nodejs.org/ + +Source0: node-v%{nodejs_version}-stripped.tar.gz +Source1: nodejs_native.attr +Source2: nodejs_native.req + +Patch1: Disable-running-gyp-on-shared-deps.patch +Patch2: Suppress-NPM-message-to-run-global-update.patch + +BuildRequires: gcc gcc-c++ openssl-devel +BuildRequires: http-parser-devel +BuildRequires: libuv-devel >= 1:%{libuv_version} +BuildRequires: libnghttp2-devel >= %{nghttp2_version} +BuildRequires: python2-devel python3-devel zlib-devel + +Requires: ca-certificates http-parser >= 2.7.0 +Requires: libuv >= 1:1.20.2 libnghttp2 >= %{nghttp2_version} +Requires: npm = %{npm_epoch}:%{npm_version}-%{npm_release} + +Provides: nodejs(engine) = %{nodejs_version} +Provides: bundled(v8) = %{v8_version} +Provides: bundled(icu) = %{icu_version} +Provides: nodejs(abi) = %{nodejs_abi} +Provides: nodejs-punycode = %{punycode_version} +Provides: nodejs(v8-abi%{v8_major}) = %{v8_abi} +Provides: npm(punycode) = %{punycode_version} +Provides: bundled(c-ares) = %{c_ares_version} +Provides: nodejs(abi%{nodejs_major}) = %{nodejs_abi} +Provides: nodejs(v8-abi) = %{v8_abi} +Conflicts: node <= 0.3.2-12 + +%description +Node.js is an open-source, cross-platform, JavaScript runtime environment, +it executes JavaScript code outside of a browser. + +%package devel +Summary: JavaScript runtime - development headers +Requires: %{name} = %{epoch}:%{nodejs_version}-%{nodejs_release} +Requires: openssl-devel zlib-devel +Requires: libuv-devel http-parser-devel +Requires: nodejs-packaging + +%description devel +Development headers for the Nodejs. + +%package -n npm +Summary: Node.js Package Manager +Epoch: %{npm_epoch} +Version: %{npm_version} +Release: %{npm_release} + +Provides: npm = %{npm_epoch}:%{npm_version} +Provides: npm(npm) = %{npm_version} +Obsoletes: npm < 0:3.5.4-6 + +%description -n npm +npm is a package manager for node.js. + +%package help +Summary: Nodejs documentation +BuildArch: noarch + +%description help +The manual documentation for Nodejs. + +%prep +%setup -q -n node-v%{nodejs_version} +%patch1 -p1 +%patch2 -p1 + +pathfix.py -i %{__python2} -pn $(find -type f) +find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python2~" {} \; +find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python2~" {} \; +sed -i "s~python~python2~" $(find . -type f | grep "gyp$") +sed -i "s~usr\/bin\/python2~usr\/bin\/python3~" ./deps/v8/tools/gen-inlining-tests.py +sed -i "s~usr\/bin\/python.*$~usr\/bin\/python2~" ./deps/v8/tools/mb/mb_unittest.py +find . -type f -exec sed -i "s~python -c~python2 -c~" {} \; +sed -i "s~which('python')~which('python2')~" configure + +%build + +export CFLAGS='%{optflags} -g \ + -D_LARGEFILE_SOURCE \ + -D_FILE_OFFSET_BITS=64 \ + -DZLIB_CONST \ + -fno-delete-null-pointer-checks' +export CXXFLAGS='%{optflags} -g \ + -D_LARGEFILE_SOURCE \ + -D_FILE_OFFSET_BITS=64 \ + -DZLIB_CONST \ + -fno-delete-null-pointer-checks' + +export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')" +export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')" +export LDFLAGS="%{build_ldflags}" + +./configure --prefix=%{_prefix} \ + --shared-openssl \ + --shared-zlib \ + --shared-libuv \ + --shared-http-parser \ + --shared-nghttp2 \ + --with-dtrace \ + --with-intl=small-icu \ + --debug-nghttp2 \ + --openssl-use-def-ca-store + +make BUILDTYPE=Release %{?_smp_mflags} + +%install +rm -rf %{buildroot} +./tools/install.py install %{buildroot} %{_prefix} +chmod 0755 %{buildroot}/%{_bindir}/node +mkdir -p %{buildroot}%{_prefix}/lib/node_modules +install -Dpm0644 %{SOURCE1} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr +install -Dpm0644 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/nodejs_native.req +chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req +mkdir -p %{buildroot}%{_pkgdocdir}/html +cp -pr doc/* %{buildroot}%{_pkgdocdir}/html +rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1 +mkdir -p %{buildroot}%{_datadir}/node +cp -p common.gypi %{buildroot}%{_datadir}/node +mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit +mkdir -p %{buildroot}%{_mandir} %{buildroot}%{_pkgdocdir}/npm +cp -pr deps/npm/man/* %{buildroot}%{_mandir}/ +rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man +ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man +cp -pr deps/npm/html deps/npm/doc %{buildroot}%{_pkgdocdir}/npm/ +rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/html +rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/doc +ln -sf %{_pkgdocdir} %{buildroot}%{_prefix}/lib/node_modules/npm/html +ln -sf %{_pkgdocdir}/npm/html %{buildroot}%{_prefix}/lib/node_modules/npm/doc +rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py +rm -f %{buildroot}/%{_defaultdocdir}/node/lldbinit + +find %{buildroot}%{_prefix}/lib/node_modules/npm \ + -not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \ + -executable -type f \ + -exec chmod -x {} \; + +%check +%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" +%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" +%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" +%{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" +NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')" + +%files +%{_bindir}/node +%dir %{_prefix}/lib/node_modules +%dir %{_datadir}/node +%dir %{_usr}/lib/dtrace +%{_usr}/lib/dtrace/node.d +%dir %{_datadir}/systemtap/tapset +%{_datadir}/systemtap/tapset/node.stp +%{_rpmconfigdir}/fileattrs/nodejs_native.attr +%{_rpmconfigdir}/nodejs_native.req +%license LICENSE +%doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md + +%files devel +%{_includedir}/node +%{_datadir}/node/common.gypi +%{_pkgdocdir}/gdbinit + +%files -n npm +%{_bindir}/npm +%{_bindir}/npx +%{_prefix}/lib/node_modules/npm +%ghost %{_sysconfdir}/npmrc +%ghost %{_sysconfdir}/npmignore +%doc %{_mandir}/man*/npm* +%doc %{_mandir}/man*/npx* +%doc %{_mandir}/man5/package.json.5* +%doc %{_mandir}/man5/package-lock.json.5* +%doc %{_mandir}/man7/removing-npm.7* +%doc %{_mandir}/man7/semver.7* + +%files help +%dir %{_pkgdocdir} +%{_pkgdocdir}/html +%{_pkgdocdir}/npm/html +%{_pkgdocdir}/npm/doc +%doc %{_mandir}/man1/node.1* + +%changelog +* Fri Mar 6 2020 openEuler Buildteam - 1:10.11.0-1 +- Package init diff --git a/nodejs_native.attr b/nodejs_native.attr new file mode 100644 index 0000000..0527af6 --- /dev/null +++ b/nodejs_native.attr @@ -0,0 +1,2 @@ +%__nodejs_native_requires %{_rpmconfigdir}/nodejs_native.req +%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$ diff --git a/nodejs_native.req b/nodejs_native.req new file mode 100644 index 0000000..54aa516 --- /dev/null +++ b/nodejs_native.req @@ -0,0 +1,3 @@ +#!/usr/bin/sh +echo 'nodejs(abi10) >= 10.11' +echo 'nodejs(v8-abi6) >= 6.8'