Distribute DLZ modules in separate packages.

Optional feature not yet enabled.
This commit is contained in:
Petr Menšík 2017-07-13 22:16:50 +02:00
parent f2fb8b7545
commit 43f0ac7c91
2 changed files with 196 additions and 1 deletions

View File

@ -0,0 +1,86 @@
diff --git a/configure.in b/configure.in
index 0bde24d..3272e8e 100644
--- a/configure.in
+++ b/configure.in
@@ -4813,6 +4813,8 @@ DLZ_DRIVER_LIBS=""
DLZ_DRIVER_SRCS=""
DLZ_DRIVER_OBJS=""
DLZ_SYSTEM_TEST=""
+DLZ_DRIVER_MYSQL_INCLUDES=""
+DLZ_DRIVER_MYSQL_LIBS=""
#
# Configure support for building a shared library object
@@ -4935,7 +4937,9 @@ if test -n "$CONTRIB_DLZ"
then
AC_MSG_RESULT(yes)
DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
- AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
+ AC_CONFIG_FILES([$DLZ_DRIVER_RULES
+ contrib/dlz/modules/mysql/Makefile
+ contrib/dlz/modules/mysqldyn/Makefile])
else
AC_MSG_RESULT(no)
DLZ_DRIVER_RULES=/dev/null
@@ -4947,6 +4951,8 @@ AC_SUBST(DLZ_DRIVER_LIBS)
AC_SUBST(DLZ_DRIVER_SRCS)
AC_SUBST(DLZ_DRIVER_OBJS)
AC_SUBST(DLZ_SYSTEM_TEST)
+AC_SUBST(DLZ_DRIVER_MYSQL_INCLUDES)
+AC_SUBST(DLZ_DRIVER_MYSQL_LIBS)
AC_SUBST_FILE(DLZ_DRIVER_RULES)
if test "yes" = "$cross_compiling"; then
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
index db8af01..8a13306 100644
--- a/contrib/dlz/config.dlz.in
+++ b/contrib/dlz/config.dlz.in
@@ -45,10 +45,12 @@ AC_DEFUN(DLZ_ADD_DRIVER, [
if test -n "$3"
then
DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $3"
+ DLZ_DRIVER_$1_INCLUDES="$3"
fi
if test -n "$4"
then
DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $4"
+ DLZ_DRIVER_$1_LIBS="$4"
fi
])
diff --git a/contrib/dlz/modules/mysql/Makefile b/contrib/dlz/modules/mysql/Makefile.in
similarity index 81%
rename from contrib/dlz/modules/mysql/Makefile
rename to contrib/dlz/modules/mysql/Makefile.in
index ad3876c..5ab31be 100644
--- a/contrib/dlz/modules/mysql/Makefile
+++ b/contrib/dlz/modules/mysql/Makefile.in
@@ -1,8 +1,8 @@
prefix = /usr
libdir = $(prefix)/lib/bind9
-CFLAGS=-fPIC -g -I../include
-MYSQL_LIBS=-lmysqlclient
+CFLAGS=-fPIC -Wall -g -I../include @DLZ_DRIVER_MYSQL_INCLUDES@
+MYSQL_LIBS=@DLZ_DRIVER_MYSQL_LIBS@
all: dlz_mysql_dynamic.so
diff --git a/contrib/dlz/modules/mysqldyn/Makefile b/contrib/dlz/modules/mysqldyn/Makefile.in
similarity index 81%
rename from contrib/dlz/modules/mysqldyn/Makefile
rename to contrib/dlz/modules/mysqldyn/Makefile.in
index bba91af..248e3da 100644
--- a/contrib/dlz/modules/mysqldyn/Makefile
+++ b/contrib/dlz/modules/mysqldyn/Makefile.in
@@ -1,8 +1,8 @@
prefix = /usr
libdir = $(prefix)/lib/bind9
-CFLAGS=-fPIC -Wall -g -I../include
-MYSQL_LIBS=-lmysqlclient
+CFLAGS=-fPIC -Wall -g -I../include @DLZ_DRIVER_MYSQL_INCLUDES@
+MYSQL_LIBS=@DLZ_DRIVER_MYSQL_LIBS@
all: dlz_mysqldyn_mod.so

111
bind.spec
View File

@ -15,6 +15,7 @@
# due to extensive changes to Makefiles
%{?!PKCS11: %global PKCS11 1}
%{?!DEVEL: %global DEVEL 1}
%{?!DLZ: %global DLZ 0}
%global bind_dir /var/named
%global chroot_prefix %{bind_dir}/chroot
%if %{SDB}
@ -68,7 +69,6 @@ Patch106:bind93-rh490837.patch
Patch109:bind97-rh478718.patch
Patch112:bind97-rh645544.patch
Patch119:bind97-rh693982.patch
Patch123:bind98-rh735103.patch
Patch130:bind-9.9.1-P2-dlz-libdb.patch
Patch131:bind-9.9.1-P2-multlib-conflict.patch
Patch133:bind99-rh640538.patch
@ -82,6 +82,7 @@ Patch137:bind-9.10-use-of-strlcat.patch
Patch140:bind-9.11-rh1410433.patch
Patch141:bind-9.11-rh1236087.patch
Patch142: bind-9.11-dlz-mysql.patch
Patch143: bind-9.11-dlz-mysql-modules.patch
# SDB patches
Patch11: bind-9.3.2b2-sdbsrc.patch
@ -292,6 +293,58 @@ chroot(2) jail for the named-sdb(8) program from the BIND package.
Based on the code from Jan "Yenya" Kasprzak <kas@fi.muni.cz>
%endif
%if %{DLZ}
%package dlz-bdb
Summary: BIND server bdb DLZ module
Group: System Environment/Libraries
Requires: bind%{?_isa} = %{epoch}:%{version}-%{release}
%description dlz-bdb
Dynamic Loadable Zones module for BIND server.
%package dlz-filesystem
Summary: BIND server filesystem DLZ module
Group: System Environment/Libraries
Requires: bind%{?_isa} = %{epoch}:%{version}-%{release}
%description dlz-filesystem
Dynamic Loadable Zones module for BIND server.
%package dlz-ldap
Summary: BIND server ldap DLZ module
Group: System Environment/Libraries
Requires: bind%{?_isa} = %{epoch}:%{version}-%{release}
%description dlz-ldap
Dynamic Loadable Zones module for BIND server.
%package dlz-mysql
Summary: BIND server mysql DLZ module
Group: System Environment/Libraries
Requires: bind%{?_isa} = %{epoch}:%{version}-%{release}
%description dlz-mysql
Dynamic Loadable Zones module for BIND server.
%package dlz-mysqldyn
Summary: BIND server mysqldyn DLZ module
Group: System Environment/Libraries
Requires: bind%{?_isa} = %{epoch}:%{version}-%{release}
%description dlz-mysqldyn
Dynamic Loadable Zones module for BIND server.
%package dlz-sqlite3
Summary: BIND server sqlite3 DLZ module
Group: System Environment/Libraries
Requires: bind%{?_isa} = %{epoch}:%{version}-%{release}
%description dlz-sqlite3
Dynamic Loadable Zones module for BIND server.
%endif
%package -n python3-bind
Summary: A module allowing rndc commands to be sent from Python programs
Group: Applications/System
@ -324,6 +377,7 @@ This package provides a module which allows commands to be sent to rndc directly
%patch140 -p1 -b .rh1410433
%patch141 -p1 -b .rh1236087
%patch142 -p1 -b .mysql_config
%patch143 -p1 -b .mysql_modules
%if %{PKCS11}
cp -r bin/named{,-pkcs11}
@ -427,6 +481,19 @@ pushd bin/python
make man
popd
%if %{DLZ}
pushd contrib/dlz
pushd bin/dlzbdb
make
popd
pushd modules
for DIR in bdbhpt filesystem ldap mysql mysqldyn sqlite3; do
make -C $DIR
done
popd
popd
%endif
%if %{test}
%check
if [ "`whoami`" = 'root' ]; then
@ -536,6 +603,20 @@ install -m 644 %{SOURCE8} ${RPM_BUILD_ROOT}/etc/openldap/schema/dnszone.schema
install -m 644 %{SOURCE12} contrib/sdb/pgsql/
%endif
%if %{DLZ}
pushd contrib/dlz
pushd bin/dlzbdb
make DESTDIR=${RPM_BUILD_ROOT} install
popd
pushd modules
for DIR in bdbhpt filesystem ldap mysql mysqldyn sqlite3; do
make -C $DIR DESTDIR=${RPM_BUILD_ROOT} libdir=%{_libdir}/bind install
done
mv mysqldyn/testing/README mysqldyn/testing/README.testing
popd
popd
%endif
# Install isc/errno2result.h header
install -m 644 lib/isc/unix/errno2result.h ${RPM_BUILD_ROOT}%{_includedir}/bind9/isc
@ -1019,6 +1100,34 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libisc-pkcs11.so
%endif
%if %{DLZ}
%files dlz-bdb
%{_sbindir}/dlzbdb
%{_libdir}/bind/dlz_bdbhpt_dynamic.so
%doc contrib/dlz/modules/bdbhpt/testing/*
%files dlz-filesystem
%{_libdir}/bind/dlz_filesystem_dynamic.so
%files dlz-mysql
%{_libdir}/bind/dlz_mysql_dynamic.so
%doc contrib/dlz/modules/mysql/testing/*
%files dlz-mysqldyn
%{_libdir}/bind/dlz_mysqldyn_mod.so
%doc contrib/dlz/modules/mysqldyn/testing/*
%doc contrib/dlz/modules/mysqldyn/README
%files dlz-ldap
%{_libdir}/bind/dlz_ldap_dynamic.so
%doc contrib/dlz/modules/ldap/testing/*
%files dlz-sqlite3
%{_libdir}/bind/dlz_sqlite3_dynamic.so
%doc contrib/dlz/modules/sqlite3/testing/*
%endif
%files -n python3-bind
%defattr(-,root,root,-)
%{python3_sitelib}/*py*