]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
noarch doc subpackage
[packages/nodejs.git] / nodejs.spec
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 %{__make} justinstall \
136         DESTDIR=$RPM_BUILD_ROOT \
137         LIBDIR=%{_lib}
138
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
143 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
144
145 install -d $RPM_BUILD_ROOT%{_includedir}/node
146 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
147
148 # install for node-gyp
149 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
150 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
151 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
152
153 # for compat of fedora derivered scripts (shebangs)
154 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
155
156 # globally installed node modules (noarch)
157 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
158
159 # default searchpaths
160 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
161
162 # create pkgconfig
163 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
164 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
165 version=%{version}
166 prefix=%{_prefix}
167 libdir=${prefix}/%{_lib}
168 includedir=${prefix}/include/node
169
170 Name: nodejs
171 Description: Evented I/O for V8 JavaScript.
172 Version: ${version}
173 Cflags: -I${includedir}
174 EOF
175
176 # install documentation
177 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
178 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
179 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
180 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
181
182 %clean
183 rm -rf $RPM_BUILD_ROOT
184
185 %post   -p /sbin/ldconfig
186 %postun -p /sbin/ldconfig
187
188 %files
189 %defattr(644,root,root,755)
190 %doc README.md AUTHORS ChangeLog LICENSE
191 %attr(755,root,root) %{_bindir}/node
192 %attr(755,root,root) %{_bindir}/nodejs
193 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
194 %ghost %{_libdir}/libnode.so.10
195 %if "%{_lib}" != "lib"
196 %dir %{_libdir}/node
197 %endif
198 %dir %{_prefix}/lib/node
199 %dir %{_prefix}/lib/node_modules
200 %{_mandir}/man1/node.1*
201 %{_mandir}/man1/nodejs.1
202
203 %files devel
204 %defattr(644,root,root,755)
205 %{_libdir}/libnode.so
206 %{_includedir}/node
207 %{_pkgconfigdir}/nodejs.pc
208 %{_usrsrc}/%{name}
209
210 %files doc
211 %defattr(644,root,root,755)
212 %doc %{_docdir}/%{name}-doc-%{version}
This page took 0.129654 seconds and 3 git commands to generate.