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