]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
up to 0.10.41, add link in doc package
[packages/nodejs.git] / nodejs.spec
1 #
2 # Conditional build:
3 %bcond_without  system_v8       # system v8
4 %bcond_with     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.41
15 Release:        1
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:  23822b192b74640551a20b680c150273
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 # add macro, so adapter won't replace it back literal
57 %define         doc_ver %{version}
58
59 %description
60 Node.js is a platform built on Chrome's JavaScript runtime for easily
61 building fast, scalable network applications. Node.js uses an
62 event-driven, non-blocking I/O model that makes it lightweight and
63 efficient, perfect for data-intensive real-time applications that run
64 across distributed devices.
65
66 %package devel
67 Summary:        Development headers for nodejs
68 Group:          Development/Libraries
69 Requires:       %{name} = %{version}-%{release}
70 Requires:       c-ares-devel
71 Requires:       gcc
72 Requires:       http-parser-devel
73 Requires:       libstdc++-devel
74 %{?with_system_uv:Requires:     libuv-devel}
75 Requires:       openssl-devel
76 %{?with_system_v8:Requires:     v8-devel}
77 Requires:       zlib-devel
78
79 %description devel
80 Development headers for nodejs.
81
82 %package doc
83 Summary:        Evented I/O for V8 JavaScript - documentation
84 Group:          Documentation
85 URL:            https://nodejs.org/dist/v%{doc_ver}/docs/api
86 %if "%{_rpmversion}" >= "5"
87 BuildArch:      noarch
88 %endif
89
90 %description doc
91 Node.js is a server-side JavaScript environment that uses an
92 asynchronous event-driven model. Node's goal is to provide an easy way
93 to build scalable network programs.
94
95 This package contains the documentation for nodejs.
96
97 %prep
98 %setup -q -n node-v%{version}
99 %{?with_shared:%patch1 -p1}
100 %if %{_lib} == "lib64"
101 %patch3 -p1
102 %else
103 %patch2 -p1
104 %endif
105 %patch4 -p1
106 %patch5 -p1
107 %patch6 -p1
108 %patch7 -p1
109
110 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
111
112 rm -r deps/npm
113 rm -r deps/cares
114 rm -r deps/http_parser
115 rm -r deps/openssl
116 %{?with_system_uv:rm -r deps/uv}
117 %{?with_system_v8:rm -r deps/v8}
118 rm -r deps/zlib
119
120 %build
121 ver=$(awk '/#define NODE_MODULE_VERSION/{print $NF}' src/node.h)
122 if [ $ver != %{node_module_version} ]; then
123         echo "Set %%define node_module_version to $ver and re-run."
124         exit 1
125 fi
126
127 # CC used only to detect if CC is clang, not used for compiling
128 CC="%{__cc}" \
129 CXX="%{__cxx}" \
130 GYP_DEFINES="soname_version=%{sover}" \
131 ./configure \
132         %{?with_system_v8:--shared-v8} \
133         --shared-zlib \
134         --shared-openssl \
135         --shared-cares \
136         %{?with_system_uv:--shared-libuv} \
137         --shared-http-parser \
138         --without-npm \
139         --without-dtrace \
140         --prefix=%{_prefix}
141
142 # add LFS defines from libuv (RHBZ#892601)
143 # CXXFLAGS must be exported, as it is needed for make, not gyp
144 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
145 LDFLAGS="%{rpmldflags}" \
146 %{__make} -C out V=1 BUILDTYPE=Release
147
148 %install
149 rm -rf $RPM_BUILD_ROOT
150 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_lib}"
151
152 %if %{with shared}
153 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
154 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
155 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
156 %endif
157
158 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
159
160 install -d $RPM_BUILD_ROOT%{_includedir}/node
161 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
162
163 # install for node-gyp
164 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
165 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
166 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
167
168 # for compat of fedora derivered scripts (shebangs)
169 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
170
171 # globally installed node modules (noarch)
172 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
173
174 # default searchpaths
175 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
176
177 # create pkgconfig
178 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
179 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
180 version=%{version}
181 prefix=%{_prefix}
182 libdir=${prefix}/%{_lib}
183 includedir=${prefix}/include/node
184
185 Name: nodejs
186 Description: Evented I/O for V8 JavaScript.
187 Version: ${version}
188 Cflags: -I${includedir}
189 EOF
190
191 # install documentation
192 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
193 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
194 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
195 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
196
197 %clean
198 rm -rf $RPM_BUILD_ROOT
199
200 %if %{with shared}
201 %post   -p /sbin/ldconfig
202 %postun -p /sbin/ldconfig
203 %endif
204
205 %files
206 %defattr(644,root,root,755)
207 %doc README.md AUTHORS ChangeLog LICENSE
208 %attr(755,root,root) %{_bindir}/node
209 %attr(755,root,root) %{_bindir}/nodejs
210 %if %{with shared}
211 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
212 %ghost %{_libdir}/libnode.so.10
213 %endif
214 %if "%{_lib}" != "lib"
215 %dir %{_libdir}/node
216 %endif
217 %dir %{_prefix}/lib/node
218 %dir %{_prefix}/lib/node_modules
219 %{_mandir}/man1/node.1*
220 %{_mandir}/man1/nodejs.1
221
222 %files devel
223 %defattr(644,root,root,755)
224 %if %{with shared}
225 %{_libdir}/libnode.so
226 %endif
227 %{_includedir}/node
228 %{_pkgconfigdir}/nodejs.pc
229 %{_usrsrc}/%{name}
230
231 %files doc
232 %defattr(644,root,root,755)
233 %doc %{_docdir}/%{name}-doc-%{version}
This page took 0.102865 seconds and 4 git commands to generate.