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