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