1 |
%define major 6 |
2 |
%define libname %mklibname mysqlcppconn %{major} |
3 |
%define develname %mklibname mysqlcppconn -d |
4 |
|
5 |
%global bzr 916 |
6 |
|
7 |
Summary: A MySQL database connector for C++ |
8 |
Name: mysql-connector-c++ |
9 |
Version: 1.1.0 |
10 |
%if 0%{?bzr} |
11 |
Release: %mkrel 0.7.bzr%{?bzr} |
12 |
%else |
13 |
Release: %mkrel 1 |
14 |
%endif |
15 |
Group: System/Libraries |
16 |
License: GPL |
17 |
URL: http://dev.mysql.com/downloads/connector/cpp/ |
18 |
%if 0%{?bzr} |
19 |
# bzr branch -r 916 lp:~mysql/mysql-connector-cpp/trunk mysql-connector-c++-1.1.0 |
20 |
# less mysql-connector-c++-1.1.0/driver/mysql_metadata.cpp |
21 |
# check getDriverMajorVersion / getDriverMinorVersion / getDriverPatchVersion |
22 |
# tar czf mysql-connector-c++-bzr895.tgz --exclude .bzr mysql-connector-c++-1.1.0 |
23 |
# rm -rf mysql-connector-c++-1.1.0 |
24 |
Source0: %{name}-bzr%{bzr}.tgz |
25 |
%else |
26 |
# Upstream has a mirror redirector for downloads, so the URL is hard to |
27 |
# represent statically. You can get the tarball by following a link from |
28 |
# http://dev.mysql.com/downloads/connector/cpp |
29 |
Source0: http://mirrors.dotsrc.org/mysql/Downloads/Connector-C++/%{name}-%{version}.tar.gz |
30 |
%endif |
31 |
BuildRequires: cmake |
32 |
BuildRequires: mysql-devel |
33 |
BuildRequires: boost-devel |
34 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
35 |
|
36 |
%description |
37 |
Connector/C++ is a tool that enables easy deployment and management of MySQL |
38 |
server and database through your C++ application. |
39 |
|
40 |
%package -n %{libname} |
41 |
Summary: The shared mysql-connector-cpp library |
42 |
Group: System/Libraries |
43 |
|
44 |
%description -n %{libname} |
45 |
Connector/C++ is a tool that enables easy deployment and management of MySQL |
46 |
server and database through your C++ application. |
47 |
|
48 |
This package provides the shared mysql-connector-cpp library. |
49 |
|
50 |
|
51 |
%package -n %{develname} |
52 |
Summary: Development library and header files for development with mysql-connector-cpp |
53 |
Group: Development/C++ |
54 |
Requires: %{libname} = %{version} |
55 |
Provides: mysql-connector-c++-devel = %{version}-%{release} |
56 |
|
57 |
%description -n %{develname} |
58 |
Connector/C++ is a tool that enables easy deployment and management of MySQL |
59 |
server and database through your C++ application. |
60 |
|
61 |
This package is only needed if you plan to develop or compile applications |
62 |
which requires the mysql-connector-cpp library. |
63 |
|
64 |
%prep |
65 |
%setup -q |
66 |
|
67 |
%{__sed} -i -e 's/lib$/%{_lib}/' driver/CMakeLists.txt |
68 |
%{__chmod} -x examples/*.cpp examples/*.txt |
69 |
|
70 |
# Save examples to keep directory clean (for doc) |
71 |
%{__mkdir} _doc_examples |
72 |
%{__cp} -pr examples _doc_examples |
73 |
|
74 |
|
75 |
%build |
76 |
%{cmake} -DMYSQLCPPCONN_BUILD_EXAMPLES:BOOL=0 |
77 |
|
78 |
%{__make} |
79 |
|
80 |
|
81 |
%install |
82 |
%{__rm} -rf %{buildroot} |
83 |
cp build/cppconn/config.h cppconn/config.h |
84 |
%{__make} install DESTDIR=%{buildroot} -C build |
85 |
rm -fr %{buildroot}%_prefix/COPYING |
86 |
rm -fr %{buildroot}%_prefix/INSTALL |
87 |
rm -fr %{buildroot}%_prefix/README |
88 |
|
89 |
%check |
90 |
# for documentation purpose only (A MySQL server is required) |
91 |
# cd test |
92 |
# ./static_test tcp://127.0.0.1 user password test_database |
93 |
# Should output : Loops= 2 Tests= 592 Failures= 0 |
94 |
# ./driver_test tcp://127.0.0.1 user password test_database |
95 |
# Should output : Loops= 2 Tests= 592 Failures= 0 |
96 |
|
97 |
|
98 |
%clean |
99 |
rm -rf %{buildroot} |
100 |
|
101 |
%files -n %{libname} |
102 |
%defattr(-,root,root) |
103 |
%attr(0755,root,root) %{_libdir}/*.so.%{major}* |
104 |
|
105 |
%files -n %{develname} |
106 |
%defattr(-,root,root) |
107 |
%dir %{_includedir}/cppconn |
108 |
%attr(0644,root,root) %{_includedir}/*.h |
109 |
%attr(0644,root,root) %{_includedir}/cppconn/*.h |
110 |
%attr(0644,root,root) %{_libdir}/*.so |
111 |
%exclude %{_libdir}/libmysqlcppconn-static.a |
112 |
|
113 |
|