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