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