]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
note unpackaged files
[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_with     system_v8       # system v8
8 %bcond_without  system_uv       # system uv
9 %bcond_with     shared  # build libnode.so shared library
10
11 # NOTES:
12 # - https://nodejs.org/en/download/releases/
13
14 Summary:        Asynchronous JavaScript Engine
15 Name:           nodejs
16 Version:        4.2.3
17 Release:        0.1
18 License:        BSD and MIT and Apache v2.0 and GPL v3
19 Group:          Development/Languages
20 Source0:        https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
21 # Source0-md5:  529a8abd4ca5a2225636767d3f14c382
22 Patch1:         %{name}-shared.patch
23 # force node to use /usr/lib/node as the systemwide module directory
24 Patch2:         %{name}-libpath.patch
25 # use /usr/lib64/node as an arch-specific module dir when appropriate
26 Patch3:         %{name}-lib64path.patch
27 Patch4:         %{name}-use-system-certs.patch
28 Patch5:         uv-fpic.patch
29 # The invalid UTF8 fix has been reverted since this breaks v8 API, which cannot
30 # be done in a stable distribution release.  This build of nodejs will behave as
31 # if NODE_INVALID_UTF8 was set.  For more information on the implications, see:
32 # http://blog.nodejs.org/2014/06/16/openssl-and-breaking-utf-8-change/
33 Patch6:         %{name}-revert-utf8-v8.patch
34 Patch7:         %{name}-revert-utf8-node.patch
35 URL:            https://nodejs.org/
36 BuildRequires:  c-ares-devel
37 BuildRequires:  gcc >= 5:4.0
38 BuildRequires:  http-parser-devel >= 2.5.0
39 BuildRequires:  libstdc++-devel
40 %{?with_system_uv:BuildRequires:        libuv-devel >= 1.6.0}
41 BuildRequires:  openssl-devel
42 BuildRequires:  pkgconfig
43 BuildRequires:  python >= 1:2.5.2
44 BuildRequires:  python-jsmin
45 BuildRequires:  rpm >= 4.4.9-56
46 BuildRequires:  rpmbuild(macros) >= 1.219
47 BuildRequires:  sed >= 4.0
48 %{?with_system_v8:BuildRequires:        v8-devel >= 3.15.11.18-2}
49 BuildRequires:  zlib-devel
50 Requires:       ca-certificates
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 #%patch1 -p1
98 %if %{_lib} == "lib64"
99 %patch3 -p1
100 %else
101 %patch2 -p1
102 %endif
103 %patch4 -p1
104 #%{?with_system_uv:%patch5 -p1}
105 #%patch6 -p1
106 #%patch7 -p1
107
108 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
109
110 rm -r deps/npm
111 #rm -r deps/cares
112 rm -r deps/http_parser
113 rm -r deps/openssl
114 %{?with_system_uv:rm -r deps/uv}
115 %{?with_system_v8:rm -r deps/v8}
116 rm -r deps/zlib
117
118 %build
119 # CC used only to detect if CC is clang, not used for compiling
120 CC="%{__cc}" \
121 CXX="%{__cxx}" \
122 GYP_DEFINES="soname_version=%{sover}" \
123 ./configure \
124         %{?with_system_v8:--shared-v8} \
125         --shared-zlib \
126         --shared-openssl \
127         %{?0:--shared-cares} \
128         %{?with_system_uv:--shared-libuv} \
129         --shared-http-parser \
130         --without-npm \
131         --without-dtrace \
132         --prefix=%{_prefix}
133
134 # add LFS defines from libuv (RHBZ#892601)
135 # CXXFLAGS must be exported, as it is needed for make, not gyp
136 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
137 LDFLAGS="%{rpmldflags}" \
138 %{__make} -C out V=1 BUILDTYPE=Release
139
140 %install
141 rm -rf $RPM_BUILD_ROOT
142 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
143
144 %if %{with shared}
145 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
146 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
147 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
148 %endif
149
150 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
151
152 install -d $RPM_BUILD_ROOT%{_includedir}/node
153 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
154
155 # install for node-gyp
156 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
157 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
158 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
159
160 # for compat of fedora derivered scripts (shebangs)
161 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
162
163 # globally installed node modules (noarch)
164 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
165
166 # default searchpaths
167 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
168
169 # create pkgconfig
170 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
171 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
172 version=%{version}
173 prefix=%{_prefix}
174 libdir=${prefix}/%{_lib}
175 includedir=${prefix}/include/node
176
177 Name: nodejs
178 Description: Evented I/O for V8 JavaScript.
179 Version: ${version}
180 Cflags: -I${includedir}
181 EOF
182
183 # install documentation
184 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
185 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
186 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
187 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
188
189 %clean
190 rm -rf $RPM_BUILD_ROOT
191
192 %if %{with shared}
193 %post   -p /sbin/ldconfig
194 %postun -p /sbin/ldconfig
195 %endif
196
197 %files
198 %defattr(644,root,root,755)
199 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
200 %attr(755,root,root) %{_bindir}/node
201 %attr(755,root,root) %{_bindir}/nodejs
202 %if %{with shared}
203 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
204 %ghost %{_libdir}/libnode.so.10
205 %endif
206 %if "%{_lib}" != "lib"
207 %dir %{_libdir}/node
208 %endif
209 %dir %{_prefix}/lib/node
210 %dir %{_prefix}/lib/node_modules
211 %{_mandir}/man1/node.1*
212 %{_mandir}/man1/nodejs.1
213
214 %files devel
215 %defattr(644,root,root,755)
216 %if %{with shared}
217 %{_libdir}/libnode.so
218 %endif
219 %{_includedir}/node
220 %{_pkgconfigdir}/nodejs.pc
221 %{_usrsrc}/%{name}
222
223 %files doc
224 %defattr(644,root,root,755)
225 %doc %{_docdir}/%{name}-doc-%{version}
This page took 0.171658 seconds and 4 git commands to generate.