71edfd
# For deep debugging we need to build binaries with extra debug info
71edfd
%bcond_with     debug
71edfd
71edfd
Name:           mariadb-connector-c
71edfd
Version:        3.1.11
71edfd
Release:        2%{?with_debug:.debug}%{?dist}
71edfd
Summary:        The MariaDB Native Client library (C driver)
71edfd
License:        LGPLv2+
71edfd
Source:         https://downloads.mariadb.org/interstitial/connector-c-%{version}/mariadb-connector-c-%{version}-src.tar.gz
71edfd
Source2:        my.cnf
71edfd
Source3:        client.cnf
71edfd
Url:            http://mariadb.org/
71edfd
# More information: https://mariadb.com/kb/en/mariadb/building-connectorc-from-source/
71edfd
71edfd
Requires:       %{_sysconfdir}/my.cnf
71edfd
BuildRequires:  zlib-devel cmake openssl-devel gcc-c++
71edfd
# Remote-IO plugin
71edfd
BuildRequires:  libcurl-devel
71edfd
# auth_gssapi_client plugin
71edfd
BuildRequires:  krb5-devel
71edfd
71edfd
Requires:       ( mariadb >= 3:10.3.27 if mariadb )
71edfd
Requires:       ( %{name}-config = %{version}-%{release} if %{name}-config )
71edfd
71edfd
%description
71edfd
The MariaDB Native Client library (C driver) is used to connect applications
71edfd
developed in C/C++ to MariaDB and MySQL databases.
71edfd
71edfd
71edfd
71edfd
%package devel
71edfd
Summary:        Development files for mariadb-connector-c
71edfd
Requires:       %{name} = %{version}-%{release}
71edfd
Requires:       openssl-devel zlib-devel
71edfd
BuildRequires:  multilib-rpm-config
71edfd
Conflicts:      mysql-devel
71edfd
71edfd
Requires:       ( mariadb-devel >= 3:10.3.27 if mariadb-devel )
71edfd
71edfd
%description devel
71edfd
Development files for mariadb-connector-c.
71edfd
Contains everything needed to build against libmariadb.so >=3 client library.
71edfd
71edfd
71edfd
71edfd
%package config
71edfd
Summary:        Configuration files for packages that use /etc/my.cnf as a configuration file
71edfd
BuildArch:      noarch
71edfd
Obsoletes:      mariadb-config <= 3:10.3.8-4
71edfd
71edfd
%description config
71edfd
This package delivers /etc/my.cnf that includes other configuration files
71edfd
from the /etc/my.cnf.d directory and ships this directory as well.
71edfd
Other packages should only put their files into /etc/my.cnf.d directory
71edfd
and require this package, so the /etc/my.cnf file is present.
71edfd
71edfd
71edfd
71edfd
%prep
71edfd
%setup -q -n %{name}-%{version}-src
71edfd
71edfd
# Remove unsused parts
71edfd
rm -r win zlib win-iconv
71edfd
71edfd
71edfd
71edfd
%build
71edfd
%{set_build_flags}
71edfd
71edfd
# Override all optimization flags when making a debug build
71edfd
%{?with_debug: CFLAGS="$CFLAGS -O0 -g"}
71edfd
CXXFLAGS="$CFLAGS"
71edfd
export CFLAGS CXXFLAGS
71edfd
71edfd
# https://jira.mariadb.org/browse/MDEV-13836:
71edfd
#   The server has (used to have for ages) some magic around the port number.
71edfd
#   If it's 0, the default port value will use getservbyname("mysql", "tcp"), that is, whatever is written in /etc/services.
71edfd
#   If it's a positive number, say, 3306, it will be 3306, no matter what /etc/services say.
71edfd
#   I don't know if that behavior makes much sense, /etc/services wasn't supposed to be a system configuration file.
71edfd
71edfd
# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX
71edfd
# so we can't use %%{_datadir} and so forth here.
71edfd
71edfd
%cmake . \
71edfd
       -DCMAKE_BUILD_TYPE="%{?with_debug:Debug}%{!?with_debug:RelWithDebInfo}" \
71edfd
       -DCMAKE_SYSTEM_PROCESSOR="%{_arch}" \
71edfd
\
71edfd
       -DMARIADB_UNIX_ADDR=%{_sharedstatedir}/mysql/mysql.sock \
71edfd
       -DMARIADB_PORT=3306 \
71edfd
\
71edfd
       -DWITH_EXTERNAL_ZLIB=YES \
71edfd
       -DWITH_SSL=OPENSSL \
71edfd
       -DWITH_MYSQLCOMPAT=ON \
71edfd
       -DPLUGIN_CLIENT_ED25519=DYNAMIC \
71edfd
\
71edfd
       -DINSTALL_LAYOUT=RPM \
71edfd
       -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
71edfd
       -DINSTALL_BINDIR="bin" \
71edfd
       -DINSTALL_LIBDIR="%{_lib}" \
71edfd
       -DINSTALL_INCLUDEDIR="include/mysql" \
71edfd
       -DINSTALL_PLUGINDIR="%{_lib}/mariadb/plugin" \
71edfd
       -DINSTALL_PCDIR="%{_lib}/pkgconfig" \
71edfd
\
71edfd
       -DWITH_UNITTEST=ON
71edfd
71edfd
71edfd
71edfd
#cmake -LAH
71edfd
71edfd
%make_build
71edfd
71edfd
71edfd
71edfd
%install
71edfd
%make_install
71edfd
71edfd
%multilib_fix_c_header --file %{_includedir}/mysql/mariadb_version.h
71edfd
71edfd
# Remove static linked libraries and symlinks to them
71edfd
rm %{buildroot}%{_libdir}/lib*.a
71edfd
71edfd
# Add a compatibility symlinks
71edfd
ln -s mariadb_config %{buildroot}%{_bindir}/mysql_config
71edfd
ln -s mariadb_version.h %{buildroot}%{_includedir}/mysql/mysql_version.h
71edfd
71edfd
# Install config files
71edfd
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/my.cnf
71edfd
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf
71edfd
71edfd
71edfd
71edfd
%check
71edfd
# Check the generated configuration on the actual machine
71edfd
%{buildroot}%{_bindir}/mariadb_config
71edfd
71edfd
# Run the unit tests
71edfd
# - don't run mytap tests
71edfd
# - ignore the testsuite result for now. Enable tests now, fix them later.
71edfd
# Note: there must be a database called 'test' created for the testcases to be run
71edfd
pushd unittest/libmariadb/
71edfd
ctest || :
71edfd
popd
71edfd
71edfd
71edfd
71edfd
%files
71edfd
%{_libdir}/libmariadb.so.3
71edfd
71edfd
%dir %{_libdir}/mariadb
71edfd
%dir %{_libdir}/mariadb/plugin
71edfd
%{_libdir}/mariadb/plugin/*
71edfd
71edfd
%doc README
71edfd
%license COPYING.LIB
71edfd
71edfd
71edfd
71edfd
%files devel
71edfd
# Binary which provides compiler info for software compiling against this library
71edfd
%{_bindir}/mariadb_config
71edfd
%{_bindir}/mysql_config
71edfd
71edfd
# Symlinks to the versioned library
71edfd
%{_libdir}/libmariadb.so
71edfd
%{_libdir}/libmysqlclient.so
71edfd
%{_libdir}/libmysqlclient_r.so
71edfd
71edfd
# Pkgconfig
71edfd
%{_libdir}/pkgconfig/libmariadb.pc
71edfd
71edfd
# Header files
71edfd
%dir %{_includedir}/mysql
71edfd
%{_includedir}/mysql/*
71edfd
71edfd
%license COPYING.LIB
71edfd
71edfd
71edfd
%files config
71edfd
%dir %{_sysconfdir}/my.cnf.d
71edfd
%config(noreplace) %{_sysconfdir}/my.cnf
71edfd
%config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf
71edfd
71edfd
71edfd
71edfd
%changelog
71edfd
* Thu Dec 03 2020 Michal Schorm <mschorm@redhat.com> - 3.1.11-2
71edfd
- Require specific minimal version of the 'mariadb' package, if it is installed
71edfd
71edfd
* Tue Nov 10 2020 Michal Schorm <mschorm@redhat.com> - 3.1.11-1
71edfd
- Rebase to 3.1.11
71edfd
71edfd
* Wed Jun 24 2020 Lukas Javorsky <ljavorsk@redhat.com> - 3.1.9-1
71edfd
- Rebase to 3.1.9
71edfd
- Overlinking issues fixed by upstream in 3.1.3 release
71edfd
- Add explicit confict between mariadb-connector-c-devel and mysql-devel packages
71edfd
71edfd
* Fri Jul 12 2019 Michal Schorm <mschorm@redhat.com> - 3.1.2-1
71edfd
- Rebase to 3.1.2
71edfd
- Introducing ED25519 plugin
71edfd
- Plugindir issues (from 3.0.9 release) fixed by upstream
71edfd
  Resolves: #1691176
71edfd
71edfd
* Wed May 15 2019 Michal Schorm <mschorm@redhat.com> - 3.0.10-1
71edfd
- Rebase to 3.0.10
71edfd
- Use macro for tarball name
71edfd
- Use macro to set build flags
71edfd
- Use macros for make commands
71edfd
- Remove the scriptlets non relevant for RHEL-8
71edfd
- Add info for the testsuite execution
71edfd
- Remove glob from library version
71edfd
- Remove info about the upstream issues
71edfd
71edfd
* Fri Mar 29 2019 Michal Schorm <mschorm@redhat.com> - 3.0.8-2
71edfd
- Add "zlib-devel" requirement in "-devel" subpackage. MariaDB requires
71edfd
  linking with "-lz", which will fail without the zlib library
71edfd
- Resolves: #1710471
71edfd
71edfd
* Wed Jan 02 2019 Michal Schorm <mschorm@redhat.com> - 3.0.8-1
71edfd
- Rebase to 3.0.8
71edfd
71edfd
* Mon Dec 10 2018 Michal Schorm <mschorm@redhat.com> - 3.0.7-1
71edfd
- Rebase to 3.0.7
71edfd
71edfd
* Tue Sep 04 2018 Michal Schorm <mschorm@redhat.com> - 3.0.6-2
71edfd
- Fix parallel installability of x86_64 and i686 devel package
71edfd
- Resolves: #1637031
71edfd
71edfd
* Fri Aug 03 2018 Michal Schorm <mschorm@redhat.com> - 3.0.6-1
71edfd
- Rebase to 3.0.6
71edfd
71edfd
* Tue Jul 17 2018 Honza Horak <hhorak@redhat.com> - 3.0.5-2
71edfd
- Add -config sub-package that delivers system-wide /etc/my.cnf and
71edfd
  /etc/my.cnf.d directory, that other packages should use
71edfd
  This package also obsoletes mariadb-config
71edfd
71edfd
* Fri Jun 08 2018 Michal Schorm <mschorm@redhat.com> - 3.0.5-1
71edfd
- Rebase to 3.0.5
71edfd
71edfd
* Thu Apr 26 2018 Michal Schorm <mschorm@redhat.com> - 3.0.4-1
71edfd
- Rebase to 3.0.4
71edfd
71edfd
* Mon Apr 23 2018 Michal Schorm <mschorm@redhat.com> - 3.0.3-4
71edfd
- Further fix of the '--plugindir' output from the config binary
71edfd
  Realted: #1569159
71edfd
71edfd
* Wed Mar 21 2018 Richard W.M. Jones <rjones@redhat.com> - 3.0.3-3
71edfd
- Fix plugin install directory (INSTALL_PLUGINDIR not PLUGIN_INSTALL_DIR).
71edfd
71edfd
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.3-2
71edfd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
71edfd
71edfd
* Fri Jan 19 2018 Michal Schorm <mschorm@redhat.com> - 3.0.3-1
71edfd
- Rebase to 3.0.3
71edfd
71edfd
* Mon Nov 27 2017 Honza Horak <hhorak@redhat.com> - 3.0.2-21
71edfd
- Remove unneeded dependency on xmlto
71edfd
71edfd
* Tue Nov 14 2017 Pavel Raiskup <praiskup@redhat.com> - 3.0.2-19
71edfd
- drop misleading provides
71edfd
71edfd
* Wed Nov 08 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-19
71edfd
- Move the scriptlet to the correct package
71edfd
71edfd
* Thu Nov 02 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-18
71edfd
- Fix typo in require
71edfd
71edfd
* Wed Nov 01 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-17
71edfd
- Use correct require for OpenSSL
71edfd
71edfd
* Wed Nov 01 2017 Merlin Mathesius <mmathesi@redhat.com> - 3.0.2-16
71edfd
- Correct typo in spec file conditional
71edfd
71edfd
* Tue Oct 31 2017 Merlin Mathesius <mmathesi@redhat.com> - 3.0.2-15
71edfd
- Cleanup spec file conditionals
71edfd
71edfd
* Tue Oct 31 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-14
71edfd
- Remove Requires for openssl. Managed by RPM.
71edfd
71edfd
* Mon Oct 30 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-13
71edfd
- Update scriplet dealing with symlinks as Guidelines suggests
71edfd
  Related: #1501933
71edfd
71edfd
* Thu Oct 26 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-12
71edfd
- Move library directly to libdir, don't create any symlinks to directories
71edfd
- Update scritplets, so they only check for old symlinks to directories
71edfd
  Related: #1501933
71edfd
- Add 'Conflicts' with mariadb package on F<28
71edfd
  Related: #1506441
71edfd
71edfd
* Mon Oct 09 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-11
71edfd
- Fix ldconfig path
71edfd
71edfd
* Wed Oct 04 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-10
71edfd
- Add scriptlets to handle errors in /usr/lib64/ created by older versions
71edfd
  of mariadb and mariadb-connector-c pakages
71edfd
71edfd
* Wed Sep 20 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-9
71edfd
- Add symlinks so more packages will build succesfully
71edfd
- Change libdir from .../lib64/mariadb to mysql
71edfd
  Related: #1497234
71edfd
71edfd
* Wed Sep 13 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-7
71edfd
- Move header files to the same location, as they would be in mariadb-server
71edfd
- Add provides "libmysqlclient.so"
71edfd
71edfd
* Tue Sep 05 2017 Honza Horak <hhorak@redhat.com> - 3.0.2-5
71edfd
- Remove a symlink /usr/lib64/mysql that conflicts with mariadb-libs
71edfd
71edfd
* Mon Aug 14 2017 Honza Horak <hhorak@redhat.com> - 3.0.2-4
71edfd
- Add compatibility symlinks
71edfd
71edfd
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-3
71edfd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
71edfd
71edfd
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
71edfd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
71edfd
71edfd
* Wed Jun 07 2017 Michal Schorm <mschorm@redhat.com> - 3.0.2-1
71edfd
- Rebase to version 3.0.2
71edfd
- Library libmariadb.so.3 introduced
71edfd
- Plugin Remote-IO enabled
71edfd
71edfd
* Wed Jun 07 2017 Michal Schorm <mschorm@redhat.com> - 2.3.3-1
71edfd
- Rebase to version 2.3.3
71edfd
- Patch dropped, solved by upstream; https://jira.mariadb.org/browse/CONC-231
71edfd
71edfd
* Tue Feb 07 2017 Michal Schorm <mschorm@redhat.com> - 2.3.2-2
71edfd
- Fix based on output from RPMLint in previous version
71edfd
71edfd
* Tue Jan 24 2017 Michal Schorm <mschorm@redhat.com> - 2.3.2-1
71edfd
- Rebase to version 2.3.2, patch needed (fixed by upstream in later versions)
71edfd
- Plugin dir moved from /libdir/plugin to /libdir/mariadb/plugin
71edfd
71edfd
* Thu Oct 27 2016 Michal Schorm <mschorm@redhat.com> - 2.3.1-3
71edfd
- Fixed ownership of {_libdir}/mariadb (this dir must me owned by package)
71edfd
- Fixed ownership of {_sysconfigdir}/ld.so.conf.d (this dir must me owned by package)
71edfd
- Fixed redundnace on lines with {_sysconfigdir}/ld.so.conf.d
71edfd
- Fixed ownership of {_bindir} (only one program is owned, so let's be accurate)
71edfd
- Some comments added, for me and future maintainers
71edfd
71edfd
* Mon Oct 17 2016 Michal Schorm <mschorm@redhat.com> - 2.3.1-2
71edfd
- Fixed ownership of {_libdir}/mariadb directory and cosmetic specfile changes
71edfd
71edfd
* Tue Sep 13 2016 Michal Schorm <mschorm@redhat.com> - 2.3.1-1
71edfd
- Rebase to version 2.3.1
71edfd
71edfd
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-2
71edfd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
71edfd
71edfd
* Thu Jul 23 2015 Matej Mužila <mmuzila@redhat.com> - 2.1.0-1
71edfd
- Rebase to version 2.1.0
71edfd
71edfd
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-3
71edfd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
71edfd
71edfd
* Wed Sep 24 2014 Matej Mužila <mmuzila@redhat.com> - 2.0.0-2
71edfd
- Fixed html IDs in documentation
71edfd
71edfd
* Tue Aug 26 2014 Matej Mužila <mmuzila@redhat.com> - 2.0.0-2
71edfd
- Initial version for 2.0.0