]> git.pld-linux.org Git - packages/mongodb.git/blob - mongodb.spec
- fix building with gcc 6.x
[packages/mongodb.git] / mongodb.spec
1 # TODO:
2 #       - add support for sharding server (init scripts, systemd units, sample config)
3 #   - \> escape not liked?
4 #  Sep 11 00:20:18 blodnatt systemd[1]: [/lib/systemd/system/mongod@.service:8] Invalid escape sequences in command line: "/bin/sh -c "if grep -q '^[ \t]*fork\>' /etc/mongod/%i.conf ; then echo there must be no 'fork' in /etc/mongod/%i.conf >&2 ; exit 1 ; fi""
5 # TODO
6 #
7 Summary:        MongoDB client shell and tools
8 Summary(pl.UTF-8):      Powłoka kliencka i narzędzia dla bazy danych MongoDB
9 Name:           mongodb
10 Version:        2.2.4
11 Release:        9
12 License:        AGPL v3
13 Group:          Applications/Databases
14 Source0:        http://downloads.mongodb.org/src/%{name}-src-r%{version}.tar.gz
15 # Source0-md5:  033354c543c053f5d539b573ac8c28b0
16 Source1:        %{name}.logrotate
17 Source2:        %{name}.init
18 Source3:        mongod-default.conf
19 Source4:        mongod@.service
20 Patch0:         %{name}-cflags.patch
21 Patch1:         %{name}-system-libs.patch
22 Patch2:         boost-1.50.patch
23 Patch3:         %{name}-install.patch
24 Patch4:         %{name}-shared.patch
25 Patch5:         gcc4.patch
26 Patch6:         no-Werror.patch
27 Patch7:         gcc6.patch
28 URL:            http://www.mongodb.org/
29 BuildRequires:  boost-devel >= 1.50
30 BuildRequires:  libpcap-devel
31 BuildRequires:  libstdc++-devel >= 6:4.0
32 %ifarch %{x8664}
33 BuildRequires:  libtcmalloc-devel
34 %endif
35 BuildRequires:  pcre-cxx-devel
36 BuildRequires:  pcre-devel >= 8.30
37 BuildRequires:  readline-devel
38 BuildRequires:  rpmbuild(macros) >= 1.644
39 BuildRequires:  scons >= 1.2
40 BuildRequires:  sed >= 4.0
41 BuildRequires:  snappy-devel
42 BuildRequires:  v8-devel
43 Requires:       %{name}-libs = %{version}-%{release}
44 # matching v8-devel
45 ExclusiveArch:  %{ix86} %{x8664} arm mips
46 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
47
48 %description
49 Mongo (from "huMONGOus") is a schema-free document-oriented database.
50 It features dynamic profileable queries, full indexing, replication
51 and fail-over support, efficient storage of large binary data objects,
52 and auto-sharding.
53
54 This package provides the mongo shell, import/export tools, and other
55 client utilities.
56
57 %description -l pl.UTF-8
58 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
59 pozbawione schematu. Obsługuje dynamicznie profilowane zapytania,
60 pełne indeksowanie, replikację i fail-over, wydajne składowanie dużych
61 obiektów danych binarnych oraz automatyczne dzielenie.
62
63 Ten pakiet zawiera powłokę mongo, narzędzia do eksportu/importu danych
64 oraz inne narzędzia klienckie.
65
66 %package libs
67 Summary:        MongoDB client library
68 Summary(pl.UTF-8):      Biblioteka kliencka MongoDB
69 Group:          Libraries
70
71 %description libs
72 Mongo (from "huMONGOus") is a schema-free document-oriented database.
73
74 This package provides the mongo client library.
75
76 %description libs -l pl.UTF-8
77 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
78 pozbawione schematu.
79
80 Ten pakiet zawiera bibliotekę kliencką mongo.
81
82 %package devel
83 Summary:        Header files for MongoDB client library
84 Summary(pl.UTF-8):      Pliki nagłówkowe biblioteki klienckiej MongoDB
85 Group:          Development/Libraries
86 Requires:       %{name}-libs = %{version}-%{release}
87
88 %description devel
89 Mongo (from "huMONGOus") is a schema-free document-oriented database.
90
91 This package provides the header files needed to develop MongoDB
92 client software.
93
94 %description devel -l pl.UTF-8
95 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
96 pozbawione schematu.
97
98 Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia
99 oprogramowania klienckiego dla MongoDB.
100
101 %package static
102 Summary:        Static MongoDB client library
103 Summary(pl.UTF-8):      Statyczna biblioteka kliencka MongoDB
104 Group:          Development/Libraries
105 Requires:       %{name}-devel = %{version}-%{release}
106
107 %description static
108 Mongo (from "huMONGOus") is a schema-free document-oriented database.
109
110 This package provides the MongoDB static client library.
111
112 %description static -l pl.UTF-8
113 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
114 pozbawione schematu.
115
116 Ten pakiet zawiera statyczną bibliotekę kliencką MongoDB.
117
118 %package server
119 Summary:        MongoDB server, sharding server, and support scripts
120 Summary(pl.UTF-8):      Serwer MongoDB, serwer dzielący oraz skrypty pomocnicze
121 Group:          Applications/Databases
122 Requires:       %{name} = %{version}-%{release}
123 Requires:       systemd-units >= 38
124 Requires(post,preun):   /sbin/chkconfig
125 Requires(postun):       /usr/sbin/groupdel
126 Requires(postun):       /usr/sbin/userdel
127 Requires(pre):  /bin/id
128 Requires(pre):  /usr/bin/getgid
129 Requires(pre):  /usr/sbin/groupadd
130 Requires(pre):  /usr/sbin/useradd
131 Requires:       rc-scripts
132 Provides:       group(mongod)
133 Provides:       user(mongod)
134 Conflicts:      logrotate < 3.8.0
135
136 %description server
137 Mongo (from "huMONGOus") is a schema-free document-oriented database.
138
139 This package provides the mongo server software, mongo sharding server
140 software, default configuration files, and init.d scripts.
141
142 %description server -l pl.UTF-8
143 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
144 pozbawione schematu.
145
146 Ten pakiet zawiera serwer mongo, serwer dzielący, pliki domyślnej
147 konfiguracji oraz skrypty init.d.
148
149 %prep
150 %setup -q -n %{name}-src-r%{version}
151 %patch0 -p1
152 %patch1 -p1
153 %patch2 -p1
154 %patch3 -p1
155 %patch4 -p1
156 %patch5 -p1
157 %patch6 -p1
158 %patch7 -p1
159
160 # Fix permissions
161 find -type f -executable | xargs chmod a-x
162
163 # force system pcre/js/snappy
164 %{__rm} -r src/third_party/{js-1.7,pcre-8.30,snappy,boost}
165
166 %build
167 %scons \
168         CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
169         --use-system-all=yes \
170         --extralib=pcrecpp,pcre,snappy \
171         --prefix=$RPM_BUILD_ROOT%{_prefix} \
172         --full=all \
173         --sharedclient \
174         --usev8 \
175         --cxx=%{__cxx}
176
177 %install
178 rm -rf $RPM_BUILD_ROOT
179 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1} \
180         $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mongod} \
181         $RPM_BUILD_ROOT%{_var}/{lib,log{,/archive}}/mongodb \
182         $RPM_BUILD_ROOT%{systemdunitdir}
183
184 # XXX: scons is so great, recompiles everything here!
185 %scons install \
186         CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
187         --use-system-all=yes \
188         --extralib=pcrecpp,pcre,snappy \
189         --prefix=$RPM_BUILD_ROOT%{_prefix} \
190         --full=all \
191         --sharedclient \
192         --usev8 \
193         --cxx=%{__cxx}
194
195 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/mongod
196 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
197 cp -p rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod
198 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/mongod/default.conf
199 cp -p debian/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
200
201 # mask out the LSB service
202 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/mongod.service
203 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/mongod@.service
204
205 touch $RPM_BUILD_ROOT%{_var}/log/mongodb/mongod.log
206
207 # for some reason these are installed twice, remove unwanted copies
208 for f in $RPM_BUILD_ROOT%{_includedir}/mongo/*; do
209         rm -r "$RPM_BUILD_ROOT%{_includedir}/$(basename $f)" || :
210 done
211
212 %ifarch %{x8664}
213 chmod -R a+rX $RPM_BUILD_ROOT/usr/lib
214 %{__rm} -r $RPM_BUILD_ROOT/usr/lib
215 %endif
216
217 %clean
218 rm -rf $RPM_BUILD_ROOT
219
220 %post   libs -p /sbin/ldconfig
221 %postun libs -p /sbin/ldconfig
222
223 %pre server
224 %groupadd -g 258 -r mongod
225 %useradd -u 258 -r -g mongod -d %{_var}/lib/mongodb -s /bin/false -c "MongoDB Database Server" mongod
226
227 %post server
228 /sbin/chkconfig --add mongod
229 %service mongod restart
230 # our systemd macros cannot handle template (multi-instance) units yet
231 export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
232 /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || :
233 if [ $1 -eq 1 ]; then
234         /bin/systemctl --quiet enable mongod@.service || : 
235         /bin/systemd_booted && echo 'Run "/bin/systemctl start mongod@default.service" to start mongod.' || :
236 else
237         /bin/systemd_booted && /bin/systemctl --quiet try-restart mongod@default.service || :
238 fi
239
240 %preun server
241 if [ "$1" = "0" ]; then
242         %service -q mongod stop
243         /sbin/chkconfig --del mongod
244         export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
245         /bin/systemd_booted && /bin/systemctl --quiet stop mongod@default.service || :
246         /bin/systemctl --quiet disable mongod@.service || :
247 fi
248
249 %postun server
250 if [ "$1" = "0" ]; then
251         %userremove mongod
252         %groupremove mongod
253 fi
254 %systemd_reload
255
256 %triggerpostun server -- %{name}-server < 2.0.6-3
257 if [ -f %{_sysconfdir}/mongod.conf.rpmsave ] ; then
258         cp -f %{_sysconfdir}/mongod/default.conf{,.rpmnew} || :
259         echo "Moving %{_sysconfdir}/mongod.conf to %{_sysconfdir}/mongod/default.conf"
260         mv -f %{_sysconfdir}/mongod.conf.rpmsave %{_sysconfdir}/mongod/default.conf
261         %service mongod restart
262 fi
263
264 %files
265 %defattr(644,root,root,755)
266 %doc README GNU-AGPL-3.0.txt
267 %attr(755,root,root) %{_bindir}/bsondump
268 %attr(755,root,root) %{_bindir}/mongo
269 %attr(755,root,root) %{_bindir}/mongodump
270 %attr(755,root,root) %{_bindir}/mongoexport
271 %attr(755,root,root) %{_bindir}/mongofiles
272 %attr(755,root,root) %{_bindir}/mongoimport
273 %attr(755,root,root) %{_bindir}/mongooplog
274 %attr(755,root,root) %{_bindir}/mongoperf
275 %attr(755,root,root) %{_bindir}/mongorestore
276 %attr(755,root,root) %{_bindir}/mongosniff
277 %attr(755,root,root) %{_bindir}/mongostat
278 %attr(755,root,root) %{_bindir}/mongotop
279 %{_mandir}/man1/bsondump.1*
280 %{_mandir}/man1/mongo.1*
281 %{_mandir}/man1/mongodump.1*
282 %{_mandir}/man1/mongoexport.1*
283 %{_mandir}/man1/mongofiles.1*
284 %{_mandir}/man1/mongoimport.1*
285 %{_mandir}/man1/mongosniff.1*
286 %{_mandir}/man1/mongostat.1*
287 %{_mandir}/man1/mongorestore.1*
288
289 %files libs
290 %defattr(644,root,root,755)
291 %attr(755,root,root) %{_libdir}/libmongoclient.so
292
293 %files devel
294 %defattr(644,root,root,755)
295 %{_includedir}/mongo
296
297 %files static
298 %defattr(644,root,root,755)
299 %{_libdir}/libmongoclient.a
300
301 %files server
302 %defattr(644,root,root,755)
303 %dir %{_sysconfdir}/mongod
304 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mongod/default.conf
305 %attr(754,root,root) /etc/rc.d/init.d/mongod
306 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mongod
307 %config(noreplace) /etc/logrotate.d/mongod
308 %{systemdunitdir}/mongod.service
309 %{systemdunitdir}/mongod@.service
310 %attr(755,root,root) %{_bindir}/mongod
311 %attr(755,root,root) %{_bindir}/mongos
312 %{_mandir}/man1/mongod.1*
313 %{_mandir}/man1/mongos.1*
314 %attr(755,mongod,mongod) %dir %{_var}/lib/mongodb
315 %attr(775,root,mongod) %dir %{_var}/log/mongodb
316 %attr(775,root,mongod) %dir %{_var}/log/archive/mongodb
317 %attr(640,mongod,mongod) %config(noreplace) %verify(not md5 mtime size) %{_var}/log/mongodb/mongod.log
This page took 0.083861 seconds and 3 git commands to generate.