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