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