]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
use patched v8 for SetAbortOnUncaughtException support
[packages/nodejs.git] / nodejs.spec
1 #
2 # Conditional build:
3 %bcond_without  system_v8       # system v8
4 %bcond_without  shared  # build libnode.so shared library
5
6 # NOTES:
7 # - https://nodejs.org/en/download/releases/
8
9 Summary:        Asynchronous JavaScript Engine
10 Name:           nodejs
11 Version:        0.10.40
12 Release:        1
13 License:        BSD and MIT and Apache v2.0 and GPL v3
14 Group:          Development/Languages
15 Source0:        https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
16 # Source0-md5:  f6ef20f327ecd6cb1586c41c7184290c
17 Patch1:         %{name}-shared.patch
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
22 Patch4:         %{name}-use-system-certs.patch
23 Patch5:         uv-fpic.patch
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
30 URL:            https://nodejs.org/
31 BuildRequires:  c-ares-devel
32 BuildRequires:  gcc >= 5:4.0
33 BuildRequires:  http-parser-devel >= 2.0
34 BuildRequires:  libstdc++-devel
35 BuildRequires:  libuv-devel >= 0.10
36 BuildRequires:  openssl-devel
37 BuildRequires:  pkgconfig
38 BuildRequires:  python >= 1:2.5.2
39 BuildRequires:  python-jsmin
40 BuildRequires:  rpm >= 4.4.9-56
41 BuildRequires:  rpmbuild(macros) >= 1.219
42 BuildRequires:  sed >= 4.0
43 %{?with_system_v8:BuildRequires:        v8-devel >= 3.15.11.18-2}
44 BuildRequires:  zlib-devel
45 Requires:       ca-certificates
46 Obsoletes:      nodejs-waf
47 ExclusiveArch:  %{ix86} %{x8664} arm
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %define         sover   %(echo %{version} | cut -d. -f2)
51
52 %description
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.
58
59 %package devel
60 Summary:        Development headers for nodejs
61 Group:          Development/Libraries
62 Requires:       %{name} = %{version}-%{release}
63 Requires:       c-ares-devel
64 Requires:       gcc
65 Requires:       http-parser-devel
66 Requires:       libstdc++-devel
67 Requires:       libuv-devel
68 Requires:       openssl-devel
69 %{?with_system_v8:Requires:     v8-devel}
70 Requires:       zlib-devel
71
72 %description devel
73 Development headers for nodejs.
74
75 %package doc
76 Summary:        Evented I/O for V8 JavaScript - documentation
77 Group:          Documentation
78 %if "%{_rpmversion}" >= "5"
79 BuildArch:      noarch
80 %endif
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
89 %prep
90 %setup -q -n node-v%{version}
91 %{?with_shared:%patch1 -p1}
92 %if %{_lib} == "lib64"
93 %patch3 -p1
94 %else
95 %patch2 -p1
96 %endif
97 %patch4 -p1
98 %patch5 -p1
99 %patch6 -p1
100 %patch7 -p1
101
102 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
103
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
111
112 %build
113 # CC used only to detect if CC is clang, not used for compiling
114 CC="%{__cc}" \
115 CXX="%{__cxx}" \
116 GYP_DEFINES="soname_version=%{sover}" \
117 ./configure \
118         %{?with_system_v8:--shared-v8} \
119         --shared-zlib \
120         --shared-openssl \
121         --shared-cares \
122         --shared-libuv \
123         --shared-http-parser \
124         --without-npm \
125         --without-dtrace \
126         --prefix=%{_prefix}
127
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
133
134 %install
135 rm -rf $RPM_BUILD_ROOT
136 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_lib}"
137
138 %if %{with shared}
139 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
140 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
141 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
142 %endif
143
144 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
145
146 install -d $RPM_BUILD_ROOT%{_includedir}/node
147 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
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
153
154 # for compat of fedora derivered scripts (shebangs)
155 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
156
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
163 # create pkgconfig
164 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
165 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
166 version=%{version}
167 prefix=%{_prefix}
168 libdir=${prefix}/%{_lib}
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
176
177 # install documentation
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
182
183 %clean
184 rm -rf $RPM_BUILD_ROOT
185
186 %if %{with shared}
187 %post   -p /sbin/ldconfig
188 %postun -p /sbin/ldconfig
189 %endif
190
191 %files
192 %defattr(644,root,root,755)
193 %doc README.md AUTHORS ChangeLog LICENSE
194 %attr(755,root,root) %{_bindir}/node
195 %attr(755,root,root) %{_bindir}/nodejs
196 %if %{with shared}
197 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
198 %ghost %{_libdir}/libnode.so.10
199 %endif
200 %if "%{_lib}" != "lib"
201 %dir %{_libdir}/node
202 %endif
203 %dir %{_prefix}/lib/node
204 %dir %{_prefix}/lib/node_modules
205 %{_mandir}/man1/node.1*
206 %{_mandir}/man1/nodejs.1
207
208 %files devel
209 %defattr(644,root,root,755)
210 %if %{with shared}
211 %{_libdir}/libnode.so
212 %endif
213 %{_includedir}/node
214 %{_pkgconfigdir}/nodejs.pc
215 %{_usrsrc}/%{name}
216
217 %files doc
218 %defattr(644,root,root,755)
219 %doc %{_docdir}/%{name}-doc-%{version}
This page took 0.049789 seconds and 4 git commands to generate.