Репозиторий Sisyphus
Последнее обновление: 23 ноября 2020 | Пакетов: 17744 | Посещений: 19674204
en ru br
Репозитории ALT

Группа :: Development/Tools
Пакет: node

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

# check deps/npm/package.json for it
%define npmver 6.14.8
# separate build npm
%def_without npm
# in other case, note: we will npm- at npmver- at release package! fix release if npmver is unchanged

%define major 14.14

#we need ABI virtual provides where SONAMEs aren't enough/not present so deps

#break when binary compatibility is broken
%global nodejs_abi 14

# there are both 6 and 7 provided (https://github.com/nodejs/node/pull/35199), see napi using

%global napi 7

# TODO: really we have no configure option to build with shared libv8

# V8 presently breaks ABI at least every x.y release while never bumping SONAME,
# so we need to be more explicit until spot fixes that
%global v8_abi 7.9
%def_without systemv8

# supports only openssl >= 1.0.2

# see https://github.com/nodejs/node/issues/2783
%define openssl_version 1.0.2n
%def_with systemssl

%global libuv_abi 1.40.0
%def_with systemuv

%global libicu_abi 6.7
# rpm-build-info gives _distro_version
%if %_vendor == "alt" && (%_distro_version == "Sisyphus")
%def_with systemicu
# TODO: node has to use icu:: for ICU names
#add_optflags -DU_USING_ICU_NAMESPACE=1

%global libnghttp2_abi 1.41.0
%def_with systemnghttp2

# to use internal llhttp

%def_without systemhttp-parser

%def_disable check

# https://nodejs.org/api/n-api.html

# https://github.com/nodejs/abi-stable-node
%def_with nodejs_abi

%define oversion %version

Name: node
Version: %major.0
Release: alt1

Summary: Evented I/O for V8 Javascript

Group: Development/Tools
License: MIT License
Url: http://nodejs.org/

Packager: Vitaly Lipatov <lav at altlinux.ru>

##Source-git: https://github.com/nodejs/node.git

# Source-url: https://nodejs.org/dist/v%version/node-v%version.tar.gz
Source: %name-%version.tar
Source7: nodejs_native.req.files

BuildRequires(pre): rpm-macros-nodejs
BuildRequires(pre): rpm-build-intro >= 2.1.14

BuildRequires: python3-devel gcc-c++ zlib-devel

BuildRequires: gyp
BuildRequires: python3-module-simplejson

%if_with systemv8
%define libv8_package libv8-nodejs
BuildRequires: %libv8_package-devel >= %v8_abi-devel

%if_with systemssl
BuildRequires: openssl-devel >= %openssl_version openssl
# for require strict library version
Requires: openssl >= %openssl_version

%if_with systemuv
BuildRequires: libuv-devel >= %libuv_abi

%if_with systemicu
BuildRequires: libicu-devel >= %libicu_abi

%if_with systemnghttp2
BuildRequires: libnghttp2-devel >= %libnghttp2_abi

%if_with systemhttp-parser
BuildRequires: libhttp-parser-devel >= 2.9.2-alt2

# c-ares

BuildRequires: libcares-devel >= 1.16.1

BuildRequires: curl

%if_without npm
Requires: npm >= %npmver

Provides: nodejs(engine) = %version
Provides: nodejs = %version-%release
Provides: node.js = %version-%release
Obsoletes: nodejs < %version-%release
Obsoletes: node.js < %version-%release

Provides: nodejs(abi) = %{nodejs_abi}
Provides: nodejs(v8-abi) = %{v8_abi}
Provides: nodejs(napi) = 6
Provides: nodejs(napi) = %{napi}

Provides: bundled(llhttp) = 2.1.3
Provides: bundled(uvwasi) = 0.0.11

# /usr/bin/ld.default: failed to set dynamic section sizes: memory exhausted

%ifarch %ix86
%define optflags_debug -g0

# use no more than system_memory/1400 build procs (see https://bugzilla.altlinux.org/show_bug.cgi?id=35112)

%_tune_parallel_build_by_procsize 1400

%add_findreq_skiplist %{_datadir}/node/sources/*

Node.js is a server-side JavaScript environment that uses an asynchronous
event-driven model.  Node's goal is to provide an easy way to build scalable
network programs.

%package devel
Summary:        Devel package for Node.js
Group:          Development/Other
License:        MIT license
# arch depended info in .gypi
#BuildArch:      noarch
Provides: nodejs-devel = %version-%release
Requires: %name = %version
Requires:       gcc-c++ zlib-devel libcares-devel
%if_with systemv8
Requires: %libv8_package-devel >= %{v8_abi}
%if_with systemssl
Requires: openssl-devel >= %openssl_version
%if_with systemuv
Requires: libuv-devel >= %libuv_abi
Conflicts:      libuv-devel

%description devel
Node.js header and build tools

%package doc
Summary: Documentation files
Group: Development/Other
Requires: %name-devel = %version-%release

BuildArch: noarch

%description doc
Documentation files for %name.

# https://bugzilla.altlinux.org/show_bug.cgi?id=38130

%if_with npm
%package -n npm
Version: %npmver
Group: Development/Tools
Summary: A package manager for node
License: MIT License
Requires: node
BuildArch: noarch
AutoReq: yes,nopython
# https://bugzilla.altlinux.org/show_bug.cgi?id=38130
#%if_with nodejs_abi
Requires: nodejs(abi) = %{nodejs_abi}

%description -n npm
npm is a package manager for node. You can use it to install and publish your
node programs. It manages dependencies and does other cool stuff.


%if_with systemv8
# hack against https://bugzilla.altlinux.org/show_bug.cgi?id=32573#c3
cp -a deps/v8/include/libplatform src
rm -rf deps/v8/

%if_with systemicu
rm -rf deps/icu-small/

%if_with systemuv
rm -rf deps/uv/
%__subst "s|deps/uv/uv.gyp ||" Makefile
%__subst "s|.*../uv/uv.gyp:libuv.*||" deps/uvwasi/uvwasi.gyp

%if_with systemnghttp2
rm -rf deps/nghttp2/

# disable external libs

# deps/gtest
rm -rf tools/gyp
rm -rf deps/zlib deps/openssl deps/cares
# make no sense for a first build
%__subst "s|deps/zlib/zlib.gyp||" Makefile

%if_without npm
# don't use: keep internal npm (used for doc build)
rm -rf deps/npm/
ln -s %_libexecdir/node_modules/npm deps/npm

# use rpm's cflags

%__subst "s|'cflags': \[\],|'cflags': ['%optflags'],|" ./configure.py
# fix cflags wrap in outputted config.json
%__subst "s|indent=2|indent=2,width=160|" ./configure.py
# TODO: move to upstream?
%ifarch mipsel
%__subst "s|'libraries': \[\],|'libraries': ['-latomic'],|" ./configure.py

# override detected dir (detection via process.execPath does not work without /proc) with corect path

%__subst "s|path.resolve(prefixDir, 'lib', 'node')|'%nodejs_sitelib'|" lib/internal/modules/cjs/loader.js

# hack against
# gyp: Error importing pymod_do_mainmodule (GN-scraper): No module named GN-scraper while loading dependencies of /tmp/.private/lav/RPM/BUILD/node-12.14.1/node.gyp
export PYTHONPATH=$(pwd)/tools/v8_gypfiles

./configure \
   --prefix=%_prefix \
   --shared-zlib \
%if_with systemicu
   --with-intl=system-icu \
%if_with systemhttp-parser
   --shared-http-parser \
   --shared-cares \
%if_with systemssl
   --shared-openssl \
   --shared-openssl-includes=%_includedir \
%if_without npm
   --without-npm \
%if_with systemuv
   --shared-libuv \
%if_with systemnghttp2
%if_with systemv8

%make_build BUILDTYPE=Release
# skip internal doc build (uses external modules)
#make doc
#%make jslint

%make_build test

mkdir -p %buildroot%nodejs_sitelib/


%if_without systemuv
#install development headers
mkdir -p %{buildroot}%{_includedir}/node/
cp -p src/*.h %{buildroot}%{_includedir}/node
cp -p deps/uv/include/*.h %{buildroot}%{_includedir}/node
#cp -p deps/uv/include/uv-private/*.h %{buildroot}%{_includedir}/node/uv-private

%if_with npm
#node-gyp needs common.gypi too
mkdir -p %{buildroot}%{_datadir}/node
cp -p common.gypi %{buildroot}%{_datadir}/node
#tar -xf %{SOURCE0} --directory=%{buildroot}%{_datadir}/node/sources

%if_with nodejs_abi
# ensure Requires are added to every native module that match the Provides from
# the nodejs build in the buildroot
install -Dpm0755 %{SOURCE7} %buildroot%_rpmlibdir/nodejs_native.req.files
cat << EOF > %buildroot%_rpmlibdir/nodejs_native.req
echo 'nodejs(abi) = %nodejs_abi'
echo 'nodejs(v8-abi) = %v8_abi'
chmod 0755 %buildroot%_rpmlibdir/nodejs_native.req

rm -rf %buildroot/usr/lib/dtrace/
rm -rf %buildroot/usr/share/doc/node/gdbinit
rm -rf %buildroot/usr/share/doc/node/lldb_commands.py
rm -rf %buildroot/usr/share/doc/node/lldbinit

# drop tapset file

rm -rf %buildroot%_datadir/systemtap/tapset

# pack node include tarball required to gyp building

#mkdir -p %name-v%version/include/
#cp -rp %buildroot%_includedir/%name %name-v%version/include/
#mkdir -p %buildroot%_datadir/node/
#tar -zcf %buildroot%_datadir/%name/%name-v%version-headers.tar.gz %name-v%version

#ln -s node_modules %buildroot%_prefix/lib/node

%dir %nodejs_sitelib

%files doc
%doc README.md

%files devel
%dir %_includedir/node/
%if_without systemuv
%if_without systemv8
# deps/cares
# deps/http_parser
%if_with nodejs_abi

%if_with npm
%files -n npm
%exclude %_libexecdir/node_modules/npm/node_modules/node-gyp/gyp/tools/emacs


Полный changelog можно просмотреть здесь

дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin