]> git.pld-linux.org Git - packages/nodejs.git/blame_incremental - nodejs.spec
up to 6.9.4
[packages/nodejs.git] / nodejs.spec
... / ...
CommitLineData
1# TODO
2# - unpackaged files
3# /usr/share/doc/node/gdbinit
4# /usr/share/systemtap/tapset/node.stp
5
6# Conditional build:
7%bcond_without system_uv # system uv
8%bcond_with shared # build libnode.so shared library
9
10# NOTES:
11# - https://nodejs.org/en/download/releases/
12
13# NODE_MODULE_VERSION refers to the ABI (application binary interface) version
14# number of Node.js, used to determine which versions of Node.js compiled C++
15# add-on binaries can be loaded in to without needing to be re-compiled. It
16# used to be stored as hex value in earlier versions, but is now represented as
17# an integer.
18%define node_module_version 48
19Summary: Asynchronous JavaScript Engine
20Name: nodejs
21# 6.9 is LTS, Active LTS: 2018-04-18, EOL: 2019-04-18
22# https://github.com/nodejs/LTS
23Version: 6.9.4
24Release: 1
25License: BSD and MIT and Apache v2.0 and GPL v3
26Group: Development/Languages
27Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
28# Source0-md5: 3795199b5950b25179248847b1a5fc86
29Patch1: %{name}-shared.patch
30# force node to use /usr/lib/node as the systemwide module directory
31Patch2: %{name}-libpath.patch
32# use /usr/lib64/node as an arch-specific module dir when appropriate
33Patch3: %{name}-lib64path.patch
34Patch4: %{name}-use-system-certs.patch
35Patch5: uv-fpic.patch
36URL: https://nodejs.org/
37BuildRequires: gcc >= 5:4.0
38BuildRequires: http-parser-devel >= 2.7.0
39BuildRequires: libstdc++-devel
40%{?with_system_uv:BuildRequires: libuv-devel >= 1.6.0}
41BuildRequires: openssl-devel >= 1.0.1
42BuildRequires: pkgconfig
43BuildRequires: python >= 1:2.7
44BuildRequires: python-jsmin
45BuildRequires: python-modules
46BuildRequires: rpm >= 4.4.9-56
47BuildRequires: rpmbuild(macros) >= 1.219
48BuildRequires: sed >= 4.0
49BuildRequires: zlib-devel
50Requires: ca-certificates
51Provides: nodejs(engine) = %{version}
52Provides: nodejs(module-version) = %{node_module_version}
53Obsoletes: nodejs-waf
54ExclusiveArch: %{ix86} %{x8664} arm
55BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56
57%define sover %(echo %{version} | cut -d. -f2)
58# add macro, so adapter won't replace it back literal
59%define doc_ver %{version}
60
61%description
62Node.js is a platform built on Chrome's JavaScript runtime for easily
63building fast, scalable network applications. Node.js uses an
64event-driven, non-blocking I/O model that makes it lightweight and
65efficient, perfect for data-intensive real-time applications that run
66across distributed devices.
67
68%package devel
69Summary: Development headers for nodejs
70Group: Development/Libraries
71Requires: %{name} = %{version}-%{release}
72Requires: gcc
73Requires: http-parser-devel >= 2.5.0
74Requires: libstdc++-devel
75%{?with_system_uv:Requires: libuv-devel >= 1.6.0}
76Requires: openssl-devel
77Requires: zlib-devel
78
79%description devel
80Development headers for nodejs.
81
82%package doc
83Summary: Evented I/O for V8 JavaScript - documentation
84Group: Documentation
85URL: https://nodejs.org/dist/v%{doc_ver}/docs/api
86%if "%{_rpmversion}" >= "5"
87BuildArch: noarch
88%endif
89
90%description doc
91Node.js is a server-side JavaScript environment that uses an
92asynchronous event-driven model. Node's goal is to provide an easy way
93to build scalable network programs.
94
95This package contains the documentation for nodejs.
96
97%prep
98%setup -q -n node-v%{version}
99%{?with_shared:%patch1 -p1}
100#%patch1 -p1
101%if %{_lib} == "lib64"
102%patch3 -p1
103%else
104%patch2 -p1
105%endif
106%patch4 -p1
107rm src/node_root_certs.h
108#%{?with_system_uv:%patch5 -p1}
109
110grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
111
112rm -r deps/npm
113rm -r deps/http_parser
114rm -r deps/openssl
115%{?with_system_uv:rm -r deps/uv}
116rm -r deps/zlib
117
118%build
119ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
120test "$ver" = "%{node_module_version}"
121
122# CC used only to detect if CC is clang, not used for compiling
123CC="%{__cc}" \
124CXX="%{__cxx}" \
125GYP_DEFINES="soname_version=%{sover}" \
126./configure \
127 --shared-zlib \
128 --shared-openssl \
129 %{?0:--shared-cares} \
130 %{?with_system_uv:--shared-libuv} \
131 --shared-http-parser \
132 --without-npm \
133 --without-dtrace \
134 --prefix=%{_prefix}
135
136# add LFS defines from libuv (RHBZ#892601)
137# CXXFLAGS must be exported, as it is needed for make, not gyp
138CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
139LDFLAGS="%{rpmldflags}" \
140%{__make} -C out V=1 BUILDTYPE=Release
141
142%install
143rm -rf $RPM_BUILD_ROOT
144%{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
145
146%if %{with shared}
147lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
148ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
149ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
150%endif
151
152echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
153
154install -d $RPM_BUILD_ROOT%{_includedir}/node
155cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
156
157# install for node-gyp
158install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
159cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
160ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
161
162# for compat of fedora derivered scripts (shebangs)
163ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
164
165# globally installed node modules (noarch)
166install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
167
168# default searchpaths
169install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
170
171# create pkgconfig
172install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
173cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
174version=%{version}
175prefix=%{_prefix}
176libdir=${prefix}/%{_lib}
177includedir=${prefix}/include/node
178
179Name: nodejs
180Description: Evented I/O for V8 JavaScript.
181Version: ${version}
182Cflags: -I${includedir}
183EOF
184
185# install documentation
186install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
187cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
188rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
189rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
190
191%clean
192rm -rf $RPM_BUILD_ROOT
193
194%if %{with shared}
195%post -p /sbin/ldconfig
196%postun -p /sbin/ldconfig
197%endif
198
199%files
200%defattr(644,root,root,755)
201%doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
202%attr(755,root,root) %{_bindir}/node
203%attr(755,root,root) %{_bindir}/nodejs
204%if %{with shared}
205%attr(755,root,root) %{_libdir}/libnode.so.*.*.*
206%ghost %{_libdir}/libnode.so.10
207%endif
208%if "%{_lib}" != "lib"
209%dir %{_libdir}/node
210%endif
211%dir %{_prefix}/lib/node
212%dir %{_prefix}/lib/node_modules
213%{_mandir}/man1/node.1*
214%{_mandir}/man1/nodejs.1
215
216%files devel
217%defattr(644,root,root,755)
218%if %{with shared}
219%{_libdir}/libnode.so
220%endif
221%{_includedir}/node
222%{_pkgconfigdir}/nodejs.pc
223%{_usrsrc}/%{name}
224
225%files doc
226%defattr(644,root,root,755)
227%doc %{_docdir}/%{name}-doc-%{version}
This page took 0.322336 seconds and 4 git commands to generate.