From 6c3816188d123b2565618a1c2fb553e91fc58927 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Fri, 8 Jun 2007 12:37:41 +0000 Subject: [PATCH] - specfile merge from 145241 branch - new sql split patch - support for not building all sql modules - split sql libraries to separate packages --- dovecot-1.0.rc32-split.patch | 311 +++++++++++++++++++++++++++++++++++ dovecot.spec | 70 +++++++- 2 files changed, 378 insertions(+), 3 deletions(-) create mode 100644 dovecot-1.0.rc32-split.patch diff --git a/dovecot-1.0.rc32-split.patch b/dovecot-1.0.rc32-split.patch new file mode 100644 index 0000000..ccbfd55 --- /dev/null +++ b/dovecot-1.0.rc32-split.patch @@ -0,0 +1,311 @@ +--- dovecot-1.0.rc32/src/dict/main.c.split 2007-02-22 15:32:11.000000000 +0100 ++++ dovecot-1.0.rc32/src/dict/main.c 2007-04-13 13:56:55.000000000 +0200 +@@ -22,6 +22,7 @@ + + static struct io *log_io; + static struct module *modules; ++static struct module *sql_modules; + static struct dict_server *dict_server; + + static void sig_die(int signo, void *context __attr_unused__) +@@ -50,6 +51,8 @@ + /* Load built-in SQL drivers (if any) */ + sql_drivers_init(); + sql_drivers_register_all(); ++ sql_modules = sql_drivers_modules_load(); ++ module_dir_init(sql_modules); + + restrict_access_by_env(FALSE); + } +@@ -100,6 +103,7 @@ + dict_sql_unregister(); + dict_client_unregister(); + ++ module_dir_unload(&sql_modules); + sql_drivers_deinit(); + random_deinit(); + lib_signals_deinit(); +--- dovecot-1.0.rc32/src/lib-sql/Makefile.am.split 2007-02-22 22:09:16.000000000 +0100 ++++ dovecot-1.0.rc32/src/lib-sql/Makefile.am 2007-04-13 15:11:18.000000000 +0200 +@@ -1,21 +1,66 @@ + noinst_LIBRARIES = libsql.a + ++if DYNAMIC_SQL ++if BUILD_MYSQL ++MYSQL_LIB=libdriver_mysql.la ++endif ++if BUILD_PGSQL ++PGSQL_LIB=libdriver_pgsql.la ++endif ++if BUILD_SQLITE ++SQLITE_LIB=libdriver_sqlite.la ++endif ++ ++sql_module_LTLIBRARIES = \ ++ $(MYSQL_LIB) \ ++ $(PGSQL_LIB) \ ++ $(SQLITE_LIB) ++ ++sql_moduledir = $(moduledir)/sql ++endif ++ + sql_drivers = @sql_drivers@ + + AM_CPPFLAGS = \ + -I$(top_srcdir)/src/lib \ ++ -DMODULEDIR=\""$(moduledir)"\" \ + $(SQL_CFLAGS) + + dist_sources = \ ++ sql-api.c ++ ++if ! DYNAMIC_SQL ++driver_sources = \ + driver-mysql.c \ + driver-pgsql.c \ +- driver-sqlite.c \ +- sql-api.c ++ driver-sqlite.c ++endif + + libsql_a_SOURCES = \ + $(dist_sources) \ ++ $(driver_sources) \ + sql-drivers-register.c + ++if DYNAMIC_SQL ++libdriver_mysql_la_LDFLAGS = -module -avoid-version ++libdriver_mysql_la_LIBADD = $(MYSQL_LIBS) ++libdriver_mysql_la_CPPFLAGS = -I$(top_srcdir)/src/lib $(MYSQL_CFLAGS) ++libdriver_mysql_la_SOURCES = \ ++ driver-mysql.c ++ ++libdriver_pgsql_la_LDFLAGS = -module -avoid-version ++libdriver_pgsql_la_LIBADD = $(PGSQL_LIBS) ++libdriver_pgsql_la_CPPFLAGS = -I$(top_srcdir)/src/lib $(PGSQL_CFLAGS) ++libdriver_pgsql_la_SOURCES = \ ++ driver-pgsql.c ++ ++libdriver_sqlite_la_LDFLAGS = -module -avoid-version ++libdriver_sqlite_la_LIBADD = $(SQLITE_LIBS) ++libdriver_sqlite_la_CPPFLAGS = -I$(top_srcdir)/src/lib $(SQLITE_CFLAGS) ++libdriver_sqlite_la_SOURCES = \ ++ driver-sqlite.c ++endif ++ + headers = \ + sql-api.h \ + sql-api-private.h +@@ -32,17 +77,21 @@ + echo '/* this file automatically generated by Makefile */' >$@ + echo '#include "lib.h"' >>$@ + echo '#include "sql-api.h"' >>$@ ++if ! DYNAMIC_SQL + for i in $(sql_drivers) null; do \ + if [ "$${i}" != "null" ]; then \ + echo "extern struct sql_db driver_$${i}_db;" >>$@ ; \ + fi \ + done ++endif + echo 'void sql_drivers_register_all(void) {' >>$@ ++if ! DYNAMIC_SQL + for i in $(sql_drivers) null; do \ + if [ "$${i}" != "null" ]; then \ + echo "sql_driver_register(&driver_$${i}_db);" >>$@ ; \ + fi \ + done ++endif + echo '}' >>$@ + + DISTFILES = $(DIST_COMMON) $(dist_sources) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) +--- dovecot-1.0.rc32/src/lib-sql/sql-api.h.split 2006-07-01 19:23:52.000000000 +0200 ++++ dovecot-1.0.rc32/src/lib-sql/sql-api.h 2007-04-13 13:56:55.000000000 +0200 +@@ -20,6 +20,8 @@ + + /* register all built-in SQL drivers */ + void sql_drivers_register_all(void); ++struct module; ++struct module *sql_drivers_modules_load(void); + + void sql_driver_register(const struct sql_db *driver); + void sql_driver_unregister(const struct sql_db *driver); +--- dovecot-1.0.rc32/src/lib-sql/sql-api.c.split 2006-07-01 19:23:52.000000000 +0200 ++++ dovecot-1.0.rc32/src/lib-sql/sql-api.c 2007-04-13 13:56:55.000000000 +0200 +@@ -2,6 +2,7 @@ + + #include "lib.h" + #include "array.h" ++#include "module-dir.h" + #include "sql-api-private.h" + + array_t ARRAY_DEFINE(sql_drivers, const struct sql_db *); +@@ -16,6 +17,12 @@ + array_free(&sql_drivers); + } + ++struct module *sql_drivers_modules_load(void) ++{ ++ return module_dir_load(MODULEDIR"/sql", ++ NULL, TRUE, PACKAGE_VERSION); ++} ++ + void sql_driver_register(const struct sql_db *driver) + { + array_append(&sql_drivers, &driver, 1); +--- dovecot-1.0.rc32/src/auth/main.c.split 2007-03-15 16:48:13.000000000 +0100 ++++ dovecot-1.0.rc32/src/auth/main.c 2007-04-13 13:56:55.000000000 +0200 +@@ -10,6 +10,7 @@ + #include "sql-api.h" + #include "randgen.h" + #include "password-scheme.h" ++#include "module-dir.h" + #include "mech.h" + #include "auth.h" + #include "auth-request-handler.h" +@@ -35,6 +36,8 @@ + static struct auth *auth; + static struct auth_worker_client *worker_client; + ++static struct module *sql_modules; ++ + static void sig_die(int signo, void *context __attr_unused__) + { + /* warn about being killed because of some signal, except SIGINT (^C) +@@ -189,6 +192,8 @@ + /* Load built-in SQL drivers (if any) */ + sql_drivers_init(); + sql_drivers_register_all(); ++ sql_modules = sql_drivers_modules_load(); ++ module_dir_init(sql_modules); + + /* Initialize databases so their configuration files can be readable + only by root. Also load all modules here. */ +@@ -287,6 +292,7 @@ + mech_deinit(); + + password_schemes_deinit(); ++ module_dir_unload(&sql_modules); + sql_drivers_deinit(); + random_deinit(); + +--- dovecot-1.0.rc32/configure.in.split 2007-04-12 19:16:36.000000000 +0200 ++++ dovecot-1.0.rc32/configure.in 2007-04-13 13:56:55.000000000 +0200 +@@ -225,6 +225,15 @@ + fi, + want_sqlite=no) + ++AC_ARG_WITH(dynamic-sql, ++[ --with-dynamic-sql Build SQL modules as shared libs], ++ if test x$withval = xno; then ++ want_dynamic_sql=no ++ else ++ want_dynamic_sql=yes ++ fi, ++ want_dynamic_sql=no) ++ + AC_ARG_WITH(ssl, + [ --with-ssl=[gnutls|openssl] Build with GNUTLS or OpenSSL (default)], + if test x$withval = xno; then +@@ -1559,12 +1568,12 @@ + fi + AC_CHECK_HEADER(libpq-fe.h, [ + if test "$PGSQL_INCLUDE" != ""; then +- SQL_CFLAGS="$SQL_CFLAGS -I$PGSQL_INCLUDE" ++ PGSQL_CFLAGS="$PGSQL_CFLAGS -I$PGSQL_INCLUDE" + fi + if test "$PGSQL_LIBDIR" != ""; then +- SQL_LIBS="$SQL_LIBS -L$PGSQL_LIBDIR" ++ PGSQL_LIBS="$PGSQL_LIBS -L$PGSQL_LIBDIR" + fi +- SQL_LIBS="$SQL_LIBS -lpq" ++ PGSQL_LIBS="$PGSQL_LIBS -lpq" + AC_DEFINE(HAVE_PGSQL,, Build with PostgreSQL support) + found_sql_drivers="$found_sql_drivers pgsql" + +@@ -1610,12 +1619,12 @@ + fi + AC_CHECK_HEADER(mysql.h, [ + if test "$MYSQL_INCLUDE" != ""; then +- SQL_CFLAGS="$SQL_CFLAGS -I$MYSQL_INCLUDE" ++ MYSQL_CFLAGS="$MYSQL_CFLAGS -I$MYSQL_INCLUDE" + fi + if test "$MYSQL_LIBDIR" != ""; then +- SQL_LIBS="$SQL_LIBS -L$MYSQL_LIBDIR" ++ MYSQL_LIBS="$MYSQL_LIBS -L$MYSQL_LIBDIR" + fi +- SQL_LIBS="$SQL_LIBS $mysql_lib" ++ MYSQL_LIBS="$MYSQL_LIBS $mysql_lib" + + AC_CHECK_LIB(mysqlclient, mysql_ssl_set, [ + AC_DEFINE(HAVE_MYSQL_SSL,, Define if your MySQL library has SSL functions) +@@ -1646,13 +1655,18 @@ + if test $want_sqlite = yes; then + AC_CHECK_LIB(sqlite3, sqlite3_open, [ + AC_CHECK_HEADER(sqlite3.h, [ +- SQL_LIBS="$SQL_LIBS -lsqlite3 -lz" ++ SQLITE_LIBS="$SQLITE_LIBS -lsqlite3 -lz" + + AC_DEFINE(HAVE_SQLITE,, Build with SQLite3 support) + found_sql_drivers="$found_sql_drivers sqlite" + ]) + ]) + fi ++ ++SQL_CFLAGS="$MYSQL_CFLAGS $PGSQL_CFLAGS $SQLITE_CFLAGS" ++if test "$want_dynamic_sql" = "no"; then ++ SQL_LIBS="$MYSQL_LIBS $PGSQL_LIBS $SQLITE_LIBS" ++fi + + if test "$found_sql_drivers" != "" -o "$want_sql" = "yes"; then + if test "$all_sql_drivers" = "yes"; then +@@ -1716,6 +1730,12 @@ + AC_SUBST(AUTH_LIBS) + AC_SUBST(SQL_CFLAGS) + AC_SUBST(SQL_LIBS) ++AC_SUBST(MYSQL_CFLAGS) ++AC_SUBST(MYSQL_LIBS) ++AC_SUBST(PGSQL_CFLAGS) ++AC_SUBST(PGSQL_LIBS) ++AC_SUBST(SQLITE_CFLAGS) ++AC_SUBST(SQLITE_LIBS) + + dnl ** + dnl ** Index file compatibility flags +@@ -1783,17 +1803,27 @@ + dnl ** SQL drivers + dnl ** + ++build_pgsql=no ++build_mysql=no ++build_sqlite=no + for driver in $sql_drivers; do + if test "$driver" = "pgsql"; then + AC_DEFINE(BUILD_PGSQL,, Built-in PostgreSQL support) ++ build_pgsql=yes + elif test "$driver" = "mysql"; then + AC_DEFINE(BUILD_MYSQL,, Built-in MySQL support) ++ build_mysql=yes + elif test "$driver" = "sqlite"; then + AC_DEFINE(BUILD_SQLITE,, Built-in SQLite support) ++ build_sqlite=yes + fi + done + + AC_SUBST(sql_drivers) ++AM_CONDITIONAL(BUILD_PGSQL, test "$build_pgsql" = "yes") ++AM_CONDITIONAL(BUILD_MYSQL, test "$build_mysql" = "yes") ++AM_CONDITIONAL(BUILD_SQLITE, test "$build_sqlite" = "yes") ++AM_CONDITIONAL(DYNAMIC_SQL, test "$want_dynamic_sql" = "yes") + + dnl ** + dnl ** Plugins +@@ -1873,4 +1903,8 @@ + echo "Building with GSSAPI support ........ : $have_gssapi" + echo "Building with user database modules . :$userdb" + echo "Building with password lookup modules :$passdb" +-echo "Building with SQL drivers ............:$sql_drivers" ++if test "$want_dynamic_sql" = "yes"; then ++ echo "Building with SQL drivers ............:$sql_drivers (dynamic)" ++else ++ echo "Building with SQL drivers ............:$sql_drivers" ++fi diff --git a/dovecot.spec b/dovecot.spec index 80196e7..062a127 100644 --- a/dovecot.spec +++ b/dovecot.spec @@ -1,7 +1,7 @@ %define upstream 1.0.0 %define sieve_upstream 1.0.1 %define pkg_version 1.0.0 -%define my_release 11.1 +%define my_release 11.7 %define pkg_release %{my_release}%{?dist} %define pkg_sieve_version 1.0.1 %define pkg_sieve_release %{my_release}%{?dist} @@ -15,6 +15,7 @@ Group: System Environment/Daemons %define build_postgres 1 %define build_mysql 1 +%define build_sqlite 1 %define build_sieve 1 %define sieve_name dovecot-sieve @@ -35,6 +36,7 @@ Patch103: dovecot-1.0.beta2-mkcert-permissions.patch # 104 not applied #Patch104: dovecot-1.0.beta2-lib64.patch Patch105: dovecot-1.0.rc7-mkcert-paths.patch +Patch106: dovecot-1.0.rc32-split.patch #Patch105: dovecot-1.0.beta2-sqlite-check.patch # XXX this patch needs review and forward porting @@ -71,6 +73,10 @@ BuildRequires: postgresql-devel BuildRequires: mysql-devel %endif +%if %{build_sqlite} +BuildRequires: sqlite-devel +%endif + %define docdir %{_docdir}/%{name} %define ssldir %{_sysconfdir}/pki/%{name} %define restart_flag /var/run/%{name}-restart-after-rpm-install @@ -82,6 +88,7 @@ Dovecot is an IMAP server for Linux/UNIX-like systems, written with security primarily in mind. It also contains a small POP3 server. It supports mail in either of maildir or mbox formats. + %if %{build_sieve} %package sieve Requires: %{name} = %{version}-%{release} @@ -94,9 +101,39 @@ Release: %{pkg_sieve_release} This package provides the CMU Cieve plugin for dovecot LDA. %endif + %define version %{pkg_version} %define release %{pkg_release} + +%if %{build_postgres} +%package pgsql +Requires: %{name} = %{version}-%{release} +Summary: Postgres SQL backend for dovecot +Group: System Environment/Daemons +%description pgsql +This package provides the Postgres SQL backend for dovecot-auth etc. +%endif + +%if %{build_mysql} +%package mysql +Requires: %{name} = %{version}-%{release} +Summary: MySQL backend for dovecot +Group: System Environment/Daemons +%description mysql +This package provides the MySQL backend for dovecot-auth etc. +%endif + +%if %{build_sqlite} +%package sqlite +Requires: %{name} = %{version}-%{release} +Summary: SQLite backend for dovecot +Group: System Environment/Daemons +%description sqlite +This package provides the SQLite backend for dovecot-auth etc. +%endif + + %prep %setup -q -n %{name}-%{upstream} @@ -108,6 +145,8 @@ This package provides the CMU Cieve plugin for dovecot LDA. #%patch104 -p1 -b .lib64 %patch105 -p1 -b .mkcert-paths +%patch106 -p1 -b .split + %if %{build_sieve} %setup -q -n %{name}-%{upstream} -D -T -a 8 %endif @@ -115,7 +154,7 @@ This package provides the CMU Cieve plugin for dovecot LDA. %build rm -f ./configure libtoolize -f -autoreconf +autoreconf -i %configure \ INSTALL_DATA="install -c -p -m644" \ --with-doc \ @@ -125,6 +164,10 @@ autoreconf %if %{build_mysql} --with-mysql \ %endif +%if %{build_sqlite} + --with-sqlite \ +%endif + --with-dynamic-sql \ --with-ssl=openssl \ --with-ssldir=%{ssldir} \ --with-ldap \ @@ -212,7 +255,8 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}/dovecot-config #prepare the filelist ( find ${RPM_BUILD_ROOT}/%{_libdir}/%{name} -type d | sed -e "s|^|%dir |"; - find ${RPM_BUILD_ROOT}/%{_libdir}/%{name} -! -type d | grep -v 'lib90_cmusieve_plugin.so'; + find ${RPM_BUILD_ROOT}/%{_libdir}/%{name} -! -type d | \ + grep -v 'lib90_cmusieve_plugin.so\|libdriver_.*.so'; ) | sed -e "s|$RPM_BUILD_ROOT||" >libs.filelist %pre @@ -293,8 +337,28 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/%{name}/lda/lib90_cmusieve_plugin.so %endif +%if %{build_mysql} +%files mysql +%{_libdir}/%{name}/sql/libdriver_mysql.so +%endif + +%if %{build_postgres} +%files pgsql +%{_libdir}/%{name}/sql/libdriver_pgsql.so +%endif + +%if %{build_sqlite} +%files sqlite +%{_libdir}/%{name}/sql/libdriver_sqlite.so +%endif %changelog +* Fri Jun 08 2007 Tomas Janousek - 1.0.0-11.7 +- specfile merge from 145241 branch + - new sql split patch + - support for not building all sql modules + - split sql libraries to separate packages + * Sat Apr 14 2007 Tomas Janousek - 1.0.0-11.1 - dovecot-1.0.beta2-pam-tty.patch is no longer needed