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