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