]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
no system c-ares 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 URL:            https://nodejs.org/
29 BuildRequires:  gcc >= 5:4.0
30 BuildRequires:  http-parser-devel >= 2.5.0
31 BuildRequires:  libstdc++-devel
32 %{?with_system_uv:BuildRequires:        libuv-devel >= 1.6.0}
33 BuildRequires:  openssl-devel >= 1.0.1
34 BuildRequires:  pkgconfig
35 BuildRequires:  python >= 1:2.5.2
36 BuildRequires:  python-jsmin
37 BuildRequires:  rpm >= 4.4.9-56
38 BuildRequires:  rpmbuild(macros) >= 1.219
39 BuildRequires:  sed >= 4.0
40 BuildRequires:  zlib-devel
41 Requires:       ca-certificates
42 Obsoletes:      nodejs-waf
43 ExclusiveArch:  %{ix86} %{x8664} arm
44 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
46 %define         sover   %(echo %{version} | cut -d. -f2)
47
48 %description
49 Node.js is a platform built on Chrome's JavaScript runtime for easily
50 building fast, scalable network applications. Node.js uses an
51 event-driven, non-blocking I/O model that makes it lightweight and
52 efficient, perfect for data-intensive real-time applications that run
53 across distributed devices.
54
55 %package devel
56 Summary:        Development headers for nodejs
57 Group:          Development/Libraries
58 Requires:       %{name} = %{version}-%{release}
59 Requires:       gcc
60 Requires:       http-parser-devel >= 2.5.0
61 Requires:       libstdc++-devel
62 %{?with_system_uv:Requires:     libuv-devel >= 1.6.0}
63 Requires:       openssl-devel
64 Requires:       zlib-devel
65
66 %description devel
67 Development headers for nodejs.
68
69 %package doc
70 Summary:        Evented I/O for V8 JavaScript - documentation
71 Group:          Documentation
72 %if "%{_rpmversion}" >= "5"
73 BuildArch:      noarch
74 %endif
75
76 %description doc
77 Node.js is a server-side JavaScript environment that uses an
78 asynchronous event-driven model. Node's goal is to provide an easy way
79 to build scalable network programs.
80
81 This package contains the documentation for nodejs.
82
83 %prep
84 %setup -q -n node-v%{version}
85 %{?with_shared:%patch1 -p1}
86 #%patch1 -p1
87 %if %{_lib} == "lib64"
88 %patch3 -p1
89 %else
90 %patch2 -p1
91 %endif
92 %patch4 -p1
93 #%{?with_system_uv:%patch5 -p1}
94
95 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
96
97 rm -r deps/npm
98 rm -r deps/http_parser
99 rm -r deps/openssl
100 %{?with_system_uv:rm -r deps/uv}
101 rm -r deps/zlib
102
103 %build
104 # CC used only to detect if CC is clang, not used for compiling
105 CC="%{__cc}" \
106 CXX="%{__cxx}" \
107 GYP_DEFINES="soname_version=%{sover}" \
108 ./configure \
109         --shared-zlib \
110         --shared-openssl \
111         %{?0:--shared-cares} \
112         %{?with_system_uv:--shared-libuv} \
113         --shared-http-parser \
114         --without-npm \
115         --without-dtrace \
116         --prefix=%{_prefix}
117
118 # add LFS defines from libuv (RHBZ#892601)
119 # CXXFLAGS must be exported, as it is needed for make, not gyp
120 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
121 LDFLAGS="%{rpmldflags}" \
122 %{__make} -C out V=1 BUILDTYPE=Release
123
124 %install
125 rm -rf $RPM_BUILD_ROOT
126 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
127
128 %if %{with shared}
129 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
130 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
131 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
132 %endif
133
134 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
135
136 install -d $RPM_BUILD_ROOT%{_includedir}/node
137 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
138
139 # install for node-gyp
140 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
141 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
142 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
143
144 # for compat of fedora derivered scripts (shebangs)
145 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
146
147 # globally installed node modules (noarch)
148 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
149
150 # default searchpaths
151 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
152
153 # create pkgconfig
154 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
155 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
156 version=%{version}
157 prefix=%{_prefix}
158 libdir=${prefix}/%{_lib}
159 includedir=${prefix}/include/node
160
161 Name: nodejs
162 Description: Evented I/O for V8 JavaScript.
163 Version: ${version}
164 Cflags: -I${includedir}
165 EOF
166
167 # install documentation
168 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
169 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
170 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
171 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
172
173 %clean
174 rm -rf $RPM_BUILD_ROOT
175
176 %if %{with shared}
177 %post   -p /sbin/ldconfig
178 %postun -p /sbin/ldconfig
179 %endif
180
181 %files
182 %defattr(644,root,root,755)
183 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
184 %attr(755,root,root) %{_bindir}/node
185 %attr(755,root,root) %{_bindir}/nodejs
186 %if %{with shared}
187 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
188 %ghost %{_libdir}/libnode.so.10
189 %endif
190 %if "%{_lib}" != "lib"
191 %dir %{_libdir}/node
192 %endif
193 %dir %{_prefix}/lib/node
194 %dir %{_prefix}/lib/node_modules
195 %{_mandir}/man1/node.1*
196 %{_mandir}/man1/nodejs.1
197
198 %files devel
199 %defattr(644,root,root,755)
200 %if %{with shared}
201 %{_libdir}/libnode.so
202 %endif
203 %{_includedir}/node
204 %{_pkgconfigdir}/nodejs.pc
205 %{_usrsrc}/%{name}
206
207 %files doc
208 %defattr(644,root,root,755)
209 %doc %{_docdir}/%{name}-doc-%{version}
This page took 0.102824 seconds and 4 git commands to generate.