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