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