]>
Commit | Line | Data |
---|---|---|
215dd3ea ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with tests # build with tests | |
4 | %bcond_with doc # build docs | |
6ce258cc | 5 | %bcond_without sasl # Use libsasl for Kerberos. |
46f36130 | 6 | %bcond_with ssl # Enable TLS connections and SCRAM-SHA-1 authentication. |
215dd3ea ER |
7 | |
8 | # NOTE about arch: | |
9 | # See https://jira.mongodb.org/browse/CDRIVER-1186 | |
10 | # 32-bit MongoDB support was officially deprecated | |
11 | # in MongoDB 3.2, and support is being removed in 3.4. | |
12 | ||
13 | Summary: Client library written in C for MongoDB | |
14 | Name: mongo-c-driver | |
95ba769c | 15 | Version: 1.9.3 |
b8ac878f | 16 | Release: 1 |
215dd3ea ER |
17 | License: Apache v2.0 |
18 | Group: Libraries | |
19 | Source0: https://github.com/mongodb/mongo-c-driver/releases/download/%{version}/%{name}-%{version}.tar.gz | |
95ba769c | 20 | # Source0-md5: 39adfe23511051c1509890e17a219d8e |
215dd3ea ER |
21 | Patch0: %{name}-rpm.patch |
22 | URL: https://github.com/mongodb/mongo-c-driver | |
23 | BuildRequires: autoconf | |
24 | BuildRequires: automake | |
6ce258cc | 25 | %{?with_sasl:BuildRequires: cyrus-sasl-devel} |
95ba769c | 26 | BuildRequires: libbson-devel >= 1.9 |
215dd3ea | 27 | BuildRequires: libtool |
a9b4913f | 28 | %{?with_ssl:BuildRequires: openssl-devel} |
215dd3ea | 29 | BuildRequires: perl-base |
624ce5af | 30 | BuildRequires: pkgconfig |
215dd3ea ER |
31 | BuildRequires: snappy-devel |
32 | BuildRequires: zlib-devel | |
33 | %if %{with tests} | |
34 | BuildRequires: mongodb-server | |
35 | BuildRequires: openssl | |
36 | %endif | |
37 | %if %{with doc} | |
38 | BuildRequires: python | |
39 | BuildRequires: sphinx-pdg | |
40 | %endif | |
41 | Requires: %{name}-libs = %{version}-%{release} | |
42 | Obsoletes: mongo-c-driver-tools < 1.3.0 | |
43 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
44 | ||
45 | %define libver 1.0 | |
46 | ||
47 | %description | |
a9b4913f | 48 | mongo-c-driver is a client library written in C for MongoDB. |
215dd3ea ER |
49 | |
50 | %package libs | |
51 | Summary: Shared libraries for %{name} | |
52 | Group: Development/Libraries | |
53 | ||
54 | %description libs | |
55 | This package contains the shared libraries for %{name}. | |
56 | ||
57 | %package devel | |
58 | Summary: Header files and development libraries for %{name} | |
59 | Group: Development/Libraries | |
60 | Requires: %{name}-libs = %{version}-%{release} | |
61 | ||
62 | %description devel | |
63 | This package contains the header files and development libraries for | |
64 | %{name}. | |
65 | ||
66 | Documentation: http://api.mongodb.org/c/%{version}/ | |
67 | ||
68 | %prep | |
69 | %setup -q -n %{name}-%{version}%{?prever:-dev} | |
70 | %patch0 -p1 | |
71 | ||
72 | %build | |
66b3715a ER |
73 | %{__aclocal} -I build/autotools -I build/autotools/m4 |
74 | %{__libtoolize} | |
75 | %{__autoconf} --include=build/autotools | |
76 | %{__automake} | |
215dd3ea ER |
77 | |
78 | export LIBS=-lpthread | |
79 | ||
80 | %configure \ | |
aba4c042 ER |
81 | --disable-silent-rules \ |
82 | --disable-optimizations \ | |
215dd3ea ER |
83 | --enable-shm-counters \ |
84 | --disable-automatic-init-and-cleanup \ | |
215dd3ea ER |
85 | %{__enable_disable doc man-pages} \ |
86 | %{__enable_disable tests} \ | |
6ce258cc | 87 | --enable-sasl=%{!?with_sasl:no}%{?with_sasl:yes} \ |
a9b4913f | 88 | --enable-ssl=%{!?with_ssl:no}%{?with_ssl:openssl --enable-crypto-system-profile} \ |
215dd3ea ER |
89 | --with-libbson=system \ |
90 | --with-snappy=system \ | |
91 | --with-zlib=system \ | |
92 | --disable-html-docs \ | |
93 | --enable-examples \ | |
94 | ||
95 | %if 0 | |
96 | # remove these after autofoo as files required by automake | |
97 | #configure.ac:68: installing 'build/autotools/missing' | |
98 | #configure.ac:81: error: required file 'src/snappy-1.1.3/snappy-stubs-public.h.in' not found | |
99 | #configure.ac:81: error: required file 'src/zlib-1.2.11/zconf.h.in' not found | |
100 | rm -rf src/snappy-* | |
101 | rm -rf src/zlib-* | |
102 | rm -rf src/libbson | |
103 | %endif | |
104 | ||
aba4c042 | 105 | %{__make} all |
215dd3ea ER |
106 | |
107 | # Explicit man target is needed for generating manual pages | |
108 | %if %{with doc} | |
aba4c042 | 109 | %{__make} doc/man |
215dd3ea ER |
110 | %endif |
111 | ||
112 | %if %{with tests} | |
113 | : Run a server | |
114 | install -d dbtest | |
115 | mongod \ | |
116 | --journal \ | |
117 | --ipv6 \ | |
118 | --unixSocketPrefix /tmp \ | |
119 | --logpath $PWD/server.log \ | |
120 | --pidfilepath $PWD/server.pid \ | |
121 | --dbpath $PWD/dbtest \ | |
122 | --fork | |
123 | ||
124 | : Run the test suite | |
125 | ret=0 | |
126 | export MONGOC_TEST_OFFLINE=on | |
127 | #export MONGOC_TEST_SKIP_SLOW=on | |
128 | ||
129 | %{__make} check || ret=1 | |
130 | ||
131 | : Cleanup | |
132 | [ -s server.pid ] && kill $(cat server.pid) | |
133 | ||
134 | exit $ret | |
135 | %endif | |
136 | ||
137 | %install | |
138 | rm -rf $RPM_BUILD_ROOT | |
139 | %{__make} install \ | |
140 | DESTDIR=$RPM_BUILD_ROOT | |
141 | ||
142 | rm $RPM_BUILD_ROOT%{_libdir}/*.la | |
143 | ||
144 | : install examples | |
145 | for i in examples/*.c examples/*/*.c; do | |
146 | install -Dpm 644 $i $RPM_BUILD_ROOT%{_docdir}/%{name}/$i | |
147 | done | |
148 | ||
149 | : Rename documentation to match subpackage name | |
150 | mv $RPM_BUILD_ROOT%{_docdir}/%{name} \ | |
151 | $RPM_BUILD_ROOT%{_docdir}/%{name}-devel | |
152 | ||
153 | %clean | |
154 | rm -rf $RPM_BUILD_ROOT | |
155 | ||
156 | %post libs -p /sbin/ldconfig | |
157 | %postun libs -p /sbin/ldconfig | |
158 | ||
159 | %files | |
160 | %defattr(644,root,root,755) | |
161 | %attr(755,root,root) %{_bindir}/mongoc-stat | |
162 | ||
163 | %files libs | |
164 | %defattr(644,root,root,755) | |
165 | %doc THIRD_PARTY_NOTICES COPYING | |
166 | %attr(755,root,root) %{_libdir}/libmongoc-%{libver}.so.*.*.* | |
167 | %ghost %{_libdir}/libmongoc-%{libver}.so.0 | |
168 | ||
169 | %files devel | |
170 | %defattr(644,root,root,755) | |
171 | %{_docdir}/%{name}-devel | |
172 | %{_includedir}/libmongoc-%{libver} | |
173 | %{_libdir}/libmongoc-%{libver}.so | |
174 | %{_pkgconfigdir}/libmongoc-*.pc | |
175 | %{_libdir}/cmake/libmongoc-%{libver} | |
176 | %if %{with doc} | |
177 | %{_mandir}/man3/mongoc* | |
178 | %endif |