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