1 |
%define major 1 |
2 |
%define libname %mklibname mysqlcppconn %{major} |
3 |
%define develname %mklibname mysqlcppconn -d |
4 |
|
5 |
%global bzr 895 |
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.6.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 895 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 |
Patch0: mysql-connector-cpp-1.1.0-fix-build.patch |
32 |
BuildRequires: cmake |
33 |
BuildRequires: mysql-devel |
34 |
BuildRequires: boost-devel |
35 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
36 |
|
37 |
%description |
38 |
Connector/C++ is a tool that enables easy deployment and management of MySQL |
39 |
server and database through your C++ application. |
40 |
|
41 |
%package -n %{libname} |
42 |
Summary: The shared mysql-connector-cpp library |
43 |
Group: System/Libraries |
44 |
|
45 |
%description -n %{libname} |
46 |
Connector/C++ is a tool that enables easy deployment and management of MySQL |
47 |
server and database through your C++ application. |
48 |
|
49 |
This package provides the shared mysql-connector-cpp library. |
50 |
|
51 |
|
52 |
%package -n %{develname} |
53 |
Summary: Development library and header files for development with mysql-connector-cpp |
54 |
Group: Development/C++ |
55 |
Requires: %{libname} = %{version} |
56 |
Provides: mysql-connector-c++-devel = %{version}-%{release} |
57 |
|
58 |
%description -n %{develname} |
59 |
Connector/C++ is a tool that enables easy deployment and management of MySQL |
60 |
server and database through your C++ application. |
61 |
|
62 |
This package is only needed if you plan to develop or compile applications |
63 |
which requires the mysql-connector-cpp library. |
64 |
|
65 |
%prep |
66 |
%setup -q |
67 |
%patch0 -p0 |
68 |
|
69 |
%{__sed} -i -e 's/lib$/%{_lib}/' driver/CMakeLists.txt |
70 |
%{__chmod} -x examples/*.cpp examples/*.txt |
71 |
|
72 |
# Save examples to keep directory clean (for doc) |
73 |
%{__mkdir} _doc_examples |
74 |
%{__cp} -pr examples _doc_examples |
75 |
|
76 |
|
77 |
%build |
78 |
%{cmake} -DMYSQLCPPCONN_BUILD_EXAMPLES:BOOL=0 |
79 |
|
80 |
%{__make} |
81 |
|
82 |
|
83 |
%install |
84 |
%{__rm} -rf %{buildroot} |
85 |
|
86 |
%{__make} install DESTDIR=%{buildroot} |
87 |
|
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 |
%doc README ANNOUNCEMENT COPYING CHANGES |
104 |
%attr(0755,root,root) %{_libdir}/*.so.%{major}* |
105 |
|
106 |
%files -n %{develname} |
107 |
%defattr(-,root,root) |
108 |
%dir %{_includedir}/mysql-connector |
109 |
%dir %{_includedir}/mysql-connector/cppconn |
110 |
%attr(0644,root,root) %{_includedir}/mysql-connector/*.h |
111 |
%attr(0644,root,root) %{_includedir}/mysql-connector/cppconn/*.h |
112 |
%attr(0644,root,root) %{_libdir}/*.so |
113 |
|
114 |
|
115 |
|