]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
ensure bundled ssl certs are not present
[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 rm src/node_root_certs.h
94 #%{?with_system_uv:%patch5 -p1}
95
96 grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python,#!%{__python},'
97
98 rm -r deps/npm
99 rm -r deps/http_parser
100 rm -r deps/openssl
101 %{?with_system_uv:rm -r deps/uv}
102 rm -r deps/zlib
103
104 %build
105 # CC used only to detect if CC is clang, not used for compiling
106 CC="%{__cc}" \
107 CXX="%{__cxx}" \
108 GYP_DEFINES="soname_version=%{sover}" \
109 ./configure \
110         --shared-zlib \
111         --shared-openssl \
112         %{?0:--shared-cares} \
113         %{?with_system_uv:--shared-libuv} \
114         --shared-http-parser \
115         --without-npm \
116         --without-dtrace \
117         --prefix=%{_prefix}
118
119 # add LFS defines from libuv (RHBZ#892601)
120 # CXXFLAGS must be exported, as it is needed for make, not gyp
121 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
122 LDFLAGS="%{rpmldflags}" \
123 %{__make} -C out V=1 BUILDTYPE=Release
124
125 %install
126 rm -rf $RPM_BUILD_ROOT
127 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
128
129 %if %{with shared}
130 lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libnode.so.*.*.*)
131 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so.10
132 ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libnode.so
133 %endif
134
135 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
136
137 install -d $RPM_BUILD_ROOT%{_includedir}/node
138 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
139
140 # install for node-gyp
141 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
142 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
143 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
144
145 # for compat of fedora derivered scripts (shebangs)
146 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
147
148 # globally installed node modules (noarch)
149 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
150
151 # default searchpaths
152 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
153
154 # create pkgconfig
155 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
156 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
157 version=%{version}
158 prefix=%{_prefix}
159 libdir=${prefix}/%{_lib}
160 includedir=${prefix}/include/node
161
162 Name: nodejs
163 Description: Evented I/O for V8 JavaScript.
164 Version: ${version}
165 Cflags: -I${includedir}
166 EOF
167
168 # install documentation
169 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
170 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
171 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
172 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
173
174 %clean
175 rm -rf $RPM_BUILD_ROOT
176
177 %if %{with shared}
178 %post   -p /sbin/ldconfig
179 %postun -p /sbin/ldconfig
180 %endif
181
182 %files
183 %defattr(644,root,root,755)
184 %doc README.md AUTHORS CHANGELOG.md ROADMAP.md LICENSE
185 %attr(755,root,root) %{_bindir}/node
186 %attr(755,root,root) %{_bindir}/nodejs
187 %if %{with shared}
188 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
189 %ghost %{_libdir}/libnode.so.10
190 %endif
191 %if "%{_lib}" != "lib"
192 %dir %{_libdir}/node
193 %endif
194 %dir %{_prefix}/lib/node
195 %dir %{_prefix}/lib/node_modules
196 %{_mandir}/man1/node.1*
197 %{_mandir}/man1/nodejs.1
198
199 %files devel
200 %defattr(644,root,root,755)
201 %if %{with shared}
202 %{_libdir}/libnode.so
203 %endif
204 %{_includedir}/node
205 %{_pkgconfigdir}/nodejs.pc
206 %{_usrsrc}/%{name}
207
208 %files doc
209 %defattr(644,root,root,755)
210 %doc %{_docdir}/%{name}-doc-%{version}
This page took 0.063075 seconds and 4 git commands to generate.