From 2dceb7c1c5323edfac2ab767badf133e5fed556c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 1 Oct 2008 23:17:59 +0000 Subject: [PATCH] Build mysql's embedded server library. --- mysql.spec | 62 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/mysql.spec b/mysql.spec index 7dae86a..af2d97f 100644 --- a/mysql.spec +++ b/mysql.spec @@ -1,6 +1,6 @@ Name: mysql Version: 5.0.67 -Release: 1%{?dist} +Release: 2%{?dist} Summary: MySQL client programs and shared libraries Group: Applications/Databases URL: http://www.mysql.com @@ -116,6 +116,28 @@ MySQL is a multi-user, multi-threaded SQL database server. This package contains the libraries and header files that are needed for developing MySQL client applications. +%package embedded + +Summary: MySQL as an embeddable library +Group: Applications/Databases + +%description embedded +MySQL is a multi-user, multi-threaded SQL database server. This +package contains a version of the MySQL server that can be embedded +into a client application instead of running as a separate process. + +%package embedded-devel + +Summary: Development files for MySQL as an embeddable library +Group: Applications/Databases +Requires: %{name}-embedded = %{version}-%{release} +Requires: %{name}-devel = %{version}-%{release} + +%description embedded-devel +MySQL is a multi-user, multi-threaded SQL database server. This +package contains files needed for developing and testing with +the embedded version of the MySQL server. + %package bench Summary: MySQL benchmark scripts and data @@ -168,11 +190,8 @@ CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" # MySQL 4.1.10 definitely doesn't work under strict aliasing; also, # gcc 4.1 breaks MySQL 5.0.16 without -fwrapv CFLAGS="$CFLAGS -fno-strict-aliasing -fwrapv" -%ifarch alpha -# Can't link C++ objects into an executable without this. Odd! -# -ECL 2002-12-19 +# force PIC mode so that we can build libmysqld.so CFLAGS="$CFLAGS -fPIC" -%endif CXXFLAGS="$CFLAGS -fno-rtti -fno-exceptions" export CFLAGS CXXFLAGS @@ -182,6 +201,7 @@ export CFLAGS CXXFLAGS --without-debug \ --enable-shared \ --with-bench \ + --with-embedded-server \ --localstatedir=/var/lib/mysql \ --with-unix-socket-path=/var/lib/mysql/mysql.sock \ --with-mysqld-user="mysql" \ @@ -200,6 +220,16 @@ gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4} # Not enabling assembler make %{?_smp_mflags} + +# regular build will make libmysqld.a but not libmysqld.so :-( +mkdir libmysqld/work +cd libmysqld/work +ar -x ../libmysqld.a +gcc -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 *.o \ + ../../bdb/build_unix/libdb.a -lpthread -lcrypt -lnsl -lssl -lcrypto -lrt -lstdc++ -lm -lc +cd ../.. + +%check make check %if %runselftest @@ -260,6 +290,11 @@ install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysql_config install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a +install -m 0755 libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0.0.1 +ln -s libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0 +ln -s libmysqld.so.0 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so + rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1* rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_binary_distribution @@ -568,6 +603,18 @@ fi %{_libdir}/mysql/libmysqlclient*.so %{_libdir}/mysql/libndbclient.so +%files embedded +%defattr(-,root,root) +%{_libdir}/mysql/libmysqld.so.* + +%files embedded-devel +%defattr(-,root,root) +%{_libdir}/mysql/libmysqld.so +%{_bindir}/mysql_client_test_embedded +%{_bindir}/mysqltest_embedded +%{_mandir}/man1/mysql_client_test_embedded.1* +%{_mandir}/man1/mysqltest_embedded.1* + %files bench %defattr(-,root,root) %{_datadir}/sql-bench @@ -580,6 +627,11 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Wed Oct 1 2008 Tom Lane 5.0.67-2 +- Build the "embedded server" library, and package it in a new sub-RPM + mysql-embedded, along with mysql-embedded-devel for devel support files. +Resolves: #149829 + * Sat Aug 23 2008 Tom Lane 5.0.67-1 - Update to mysql version 5.0.67 - Move mysql_config's man page to base package, again (apparently I synced