
Vendor: Project Vine
Distribution: Vine Linux
Packager: tomop

%define soversion 18

Name:		libmysqlclient
Summary:	libraries and headers of MariaDB.
Version:	10.1.14
Release:	2%{_dist_release}

Group:		Applications/Databases
License:	GPLv2
URL:		http://www.mariadb.org/

Source:		mariadb-%{version}.tar.gz

#Patch0:		mysql-5.5.15-jp-all.patch
# lib64 patch for vine
#Patch200:	pysql-5.1.44-lib64.patch

BuildRoot:		%{_tmppath}/%{name}-%{version}-root
BuildRequires:	perl, readline-devel, libaio-devel, libevent-devel
BuildRequires:	gcc-c++, ncurses-devel, zlib-devel, openssl-devel
BuildRequires:	groff, cmake, bison
Requires:		fileutils sh-utils

%description
 build client libraries and headers of MariaDB.


%package -n mariadb-common
Summary: The configuration file of MariaDB server and clients
Group: Applications/System

%description -n mariadb-common
 This package contains the configuration file for MariaDB server and
clients.


%package -n libmysqlclient%{soversion}
Summary: The shared libraries required for MariaDB/MySQL clients
Group: System Environment/Libraries
Requires: mariadb-common
Obsoletes: MySQL-shared < 5.5.0

%description -n libmysqlclient%{soversion}
 This package contains the shared libraries which certain languages
and applications need to dynamically load and use MariaDB/MySQL.


%package devel
Summary: libraries and headers for MariaDB/MySQL clients
Group: Development/Libraries
Requires: libmysqlclient%{soversion} = %{version}-%{release}
Requires: openssl-devel, zlib-devel
Provides: MySQL-devel mysql-devel MySQL5-devel
Obsoletes: MySQL-devel mysql-devel MySQL5-devel
Conflicts: mariadb-devel

%description devel
 This package contains the development header files and libraries
necessary to develop MariaDB/MySQL client applications.


%prep
%setup -q -n mariadb-%{version}

#%patch0 -p1 -b .jp


%build

# Be strict about variables, bail at earliest opportunity, etc.
set -eu

# Optional package files
touch optional-files-devel

export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}}
export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti}}
export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}}
export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}}
export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:-}

# Build full release
mkdir release
(
  cd release
  # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
  # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
  ${CMAKE} ../ \
      -DINSTALL_LAYOUT=RPM \
      -DCMAKE_BUILD_TYPE=Release \
      -DINSTALL_UNIX_ADDRDIR="/var/lib/mysql/mysql.sock" \
      -DMANUFACTURER="Vine Linux MariaDB RPM" \
      -DWITH_PIC="ON" \
      -DWITHOUT_SERVER="yes" \
      -DWITH_ZLIB="system" \
      -DWITH_LIBEVENT="system" \
      -DWITH_LOCALES="yes" \
      -DWITH_UNIT_TESTS="no"

#      -DWITH_PCRE="system"

  echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG
  make %{?_smp_mflags}
#  make %{?_smp_mflags} -C libmysql
#  make %{?_smp_mflags} -C include
)


##############################################################################
%install
rm -rf %{buildroot}

# Install all binaries 
# Install all binaries
(
  cd release
  make DESTDIR=%{buildroot} install
)

mv -f  %{buildroot}%{_datadir}/doc ./

rm -rf %{buildroot}%{_sysconfdir}/{init.d,logrotate.d}
rm -rf %{buildroot}%{_sysconfdir}/my.cnf.d/{mysql-clients.cnf,server.cnf,enable_encryption.preset}
rm -rf %{buildroot}%{_datadir}/{man/man8,mysql}
rm -f %{buildroot}%{_libdir}/*.a
find %{buildroot}%{_bindir} -type f | grep -v -e mysql_config | xargs rm -f
find %{buildroot}%{_mandir} -type f | grep -v -e mysql_config | xargs rm -f

rm -rf %{buildroot}%{_libdir}/mysql/plugin
rm -rf %{buildroot}%{_datadir}/mysql-test

##############################################################################


%post -n libmysqlclient%{soversion}
/sbin/ldconfig

%postun -n libmysqlclient%{soversion}
/sbin/ldconfig

%clean
rm -rf %{buildroot}

%files -n mariadb-common
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/my.cnf
%dir %{_sysconfdir}/my.cnf.d
%config(noreplace) %{_sysconfdir}/my.cnf.d/client.cnf

%files -n libmysqlclient%{soversion}
%defattr(-, root, root)
%doc doc/*
%{_libdir}/libmysql*.so.*

%files devel
%defattr(-, root, root)
%doc %{_mandir}/man1/mysql_config.1*
%{_bindir}/mysql_config
%{_datadir}/pkgconfig/mariadb.pc
%{_includedir}/mysql
%{_datadir}/aclocal/mysql.m4
%{_libdir}/*.so


%changelog
* Sun May 22 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.1.14-2
- rebuilt with new binutils.

* Wed May 11 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.1.14-1
- new upstream release.

* Fri Apr  1 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.1.13-1
- new upstream release.

* Tue Mar 15 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.1.12-1
- new upstream release.

* Sat Jan  9 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.1.10-1
- new upstream release.

* Mon Nov 30 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.1.9-1
- new upstream release.

* Fri Aug  7 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.21-1
- new upstream release.

* Fri Jun 19 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.20-1
- new upstream release.

* Sun May 10 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.19-1
- new upstream release.

* Fri May  8 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.18-1
- new upstream release.

* Tue Mar  3 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.17-1
- new upstream release.

* Wed Jan 28 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.16-1
- new upstream release.

* Thu Nov 27 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.15-1
- new upstream release.

* Sat May 31 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.11-1
- new upstream release.

* Sun Apr 13 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.10-2
- fixed Conflicts: and Obsoletes:.

* Mon Mar 31 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.10-1
- new upstream release.

* Mon Mar 24 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.9-1
- new upstream release.

* Tue Feb 11 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.8-1
- new upstream release.

* Tue Dec 03 2013 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 10.0.6-1
- initial build.
