From 81227ae2b36f0fa0c38d04e00b0e61d04fee3dbf Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Tue, 5 Oct 2010 11:51:27 +0200 Subject: [PATCH] Build dhcp's libraries as shared libs instead of static libs. Signed-off-by: Adam Tkac --- dhcp.spec | 39 +++++++++++-- dhcp420-sharedlib.patch | 121 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 dhcp420-sharedlib.patch diff --git a/dhcp.spec b/dhcp.spec index 668b752..2df26b4 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -7,7 +7,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.2.0 -Release: 14%{?dist} +Release: 15%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -58,6 +58,7 @@ Patch29: dhcp-4.2.0-PIE-RELRO.patch Patch30: dhcp-4.2.0-honor-expired.patch Patch31: dhcp-4.2.0-noprefixavail.patch Patch32: dhcp420-rh637017.patch +Patch33: dhcp420-sharedlib.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: autoconf @@ -110,13 +111,21 @@ To use DHCP on your network, install a DHCP service (or relay agent), and on clients run a DHCP client daemon. The dhclient package provides the ISC DHCP client daemon. +%package libs +Summary: Shared libraries used by ISC dhcp client and server +Group: System Environment/Base + +%description libs +This package contains shared libraries used by ISC dhcp client and server + + %package devel Summary: Development headers and libraries for interfacing to the DHCP server Group: Development/Libraries Obsoletes: libdhcp4client-devel <= 12:4.0.0-34.fc10 Obsoletes: libdhcp-devel <= 1.99.8-1 Provides: %{name}-static = %{epoch}:%{version}-%{release} -Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: %{name}-libs = %{epoch}:%{version}-%{release} %description devel Header files and API documentation for using the ISC DHCP libraries. The @@ -255,6 +264,7 @@ rm bind/bind.tar.gz # prefix in IA_PD (as a preference) and this prefix was not in any of server's pools. %patch31 -p1 -b .noprefixavail %patch32 -p1 -b .rh637017 +%patch33 -p1 -b .sharedlib # Copy in the Fedora/RHEL dhclient script %{__install} -p -m 0755 %{SOURCE4} client/scripts/linux @@ -315,6 +325,7 @@ for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8 ; do done %build +libtoolize --copy --force autoreconf --verbose --force --install CFLAGS="%{optflags} -fno-strict-aliasing -D_GNU_SOURCE" \ @@ -330,7 +341,8 @@ CFLAGS="%{optflags} -fno-strict-aliasing -D_GNU_SOURCE" \ --with-relay-pid-file=%{_localstatedir}/run/dhcrelay.pid \ --with-ldap \ --with-ldapcrypto \ - --with-libbind=%{_includedir} --with-libbind-libs=%{_libdir} + --with-libbind=%{_includedir} --with-libbind-libs=%{_libdir} \ + --disable-static %{__make} %{?_smp_mflags} %install @@ -423,6 +435,9 @@ EOF %{__mkdir} -p %{buildroot}%{_libdir}/pm-utils/sleep.d %{__install} -p -m 0755 %{SOURCE8} %{buildroot}%{_libdir}/pm-utils/sleep.d +# Don't package libtool *.la files +find ${RPM_BUILD_ROOT}/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';'; + %clean %{__rm} -rf %{buildroot} @@ -484,6 +499,10 @@ if [ $1 -ge 1 ]; then /sbin/service dhcrelay condrestart >/dev/null 2>&1 || : fi +%post libs -p /sbin/ldconfig + +%postun libs -p /sbin/ldconfig + %files %defattr(-,root,root,-) %doc LICENSE README RELNOTES dhcpd.conf.sample dhcpd6.conf.sample @@ -535,18 +554,26 @@ fi %attr(0644,root,root) %{_mandir}/man5/dhcp-options.5.gz %attr(0644,root,root) %{_mandir}/man5/dhcp-eval.5.gz +%files libs +%{_libdir}/libdhcpctl.so.* +%{_libdir}/libomapi.so.* +%{_libdir}/libdst.so.* + %files devel %defattr(-,root,root,-) %{_includedir}/dhcpctl %{_includedir}/isc-dhcp %{_includedir}/omapip -%{_libdir}/libdhcpctl.a -%{_libdir}/libomapi.a -%{_libdir}/libdst.a +%{_libdir}/libdhcpctl.so +%{_libdir}/libomapi.so +%{_libdir}/libdst.so %attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz %changelog +* Wed Oct 20 2010 Adam Tkac - 12:4.2.0-15 +- build dhcp's libraries as shared libs instead of static libs + * Wed Oct 20 2010 Adam Tkac - 12:4.2.0-14 - fire away bundled BIND source diff --git a/dhcp420-sharedlib.patch b/dhcp420-sharedlib.patch new file mode 100644 index 0000000..6ed8ea5 --- /dev/null +++ b/dhcp420-sharedlib.patch @@ -0,0 +1,121 @@ +diff -up dhcp-4.2.0/client/Makefile.am.sharedlib dhcp-4.2.0/client/Makefile.am +--- dhcp-4.2.0/client/Makefile.am.sharedlib 2010-10-01 14:22:36.020002772 +0200 ++++ dhcp-4.2.0/client/Makefile.am 2010-10-01 14:22:36.030002772 +0200 +@@ -6,7 +6,7 @@ dhclient_SOURCES = clparse.c dhclient.c + scripts/solaris scripts/openwrt + dhclient_CPPFLAGS = -DCLIENT_PATH='"$(sbindir)"' -DLOCALSTATEDIR='"$(localstatedir)"' + dhclient_CFLAGS = -fpie +-dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ ++dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) + dhclient_LDFLAGS = -pie -Wl,-z,relro -Wl,-z,now + +diff -up dhcp-4.2.0/configure.ac.sharedlib dhcp-4.2.0/configure.ac +--- dhcp-4.2.0/configure.ac.sharedlib 2010-10-01 14:22:36.020002772 +0200 ++++ dhcp-4.2.0/configure.ac 2010-10-01 14:22:36.060002772 +0200 +@@ -30,7 +30,8 @@ fi + # Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API. + AC_USE_SYSTEM_EXTENSIONS + +-AC_PROG_RANLIB ++# Use libtool to simplify building of shared libraries ++AC_PROG_LIBTOOL + AC_CONFIG_HEADERS([includes/config.h]) + + # we sometimes need to know byte order for building packets +diff -up dhcp-4.2.0/dhcpctl/Makefile.am.sharedlib dhcp-4.2.0/dhcpctl/Makefile.am +--- dhcp-4.2.0/dhcpctl/Makefile.am.sharedlib 2010-10-01 14:22:36.020002772 +0200 ++++ dhcp-4.2.0/dhcpctl/Makefile.am 2010-10-01 14:22:36.030002772 +0200 +@@ -1,15 +1,15 @@ + bin_PROGRAMS = omshell +-lib_LIBRARIES = libdhcpctl.a ++lib_LTLIBRARIES = libdhcpctl.la + noinst_PROGRAMS = cltest + man_MANS = omshell.1 dhcpctl.3 + EXTRA_DIST = $(man_MANS) + + omshell_SOURCES = omshell.c +-omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ ++omshell_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export + +-libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c ++libdhcpctl_la_SOURCES = dhcpctl.c callback.c remote.c + + cltest_SOURCES = cltest.c +-cltest_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ ++cltest_LDADD = libdhcpctl.la ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export +diff -up dhcp-4.2.0/dst/base64.c.sharedlib dhcp-4.2.0/dst/base64.c +--- dhcp-4.2.0/dst/base64.c.sharedlib 2010-10-01 14:27:18.280002774 +0200 ++++ dhcp-4.2.0/dst/base64.c 2010-10-01 14:28:10.650002773 +0200 +@@ -64,6 +64,7 @@ static const char rcsid[] = "$Id: base64 + + #include + ++#include "dst_internal.h" + #include "cdefs.h" + #include "osdep.h" + #include "arpa/nameser.h" +diff -up dhcp-4.2.0/dst/Makefile.am.sharedlib dhcp-4.2.0/dst/Makefile.am +--- dhcp-4.2.0/dst/Makefile.am.sharedlib 2007-05-29 18:32:10.000000000 +0200 ++++ dhcp-4.2.0/dst/Makefile.am 2010-10-01 14:22:36.030002772 +0200 +@@ -1,8 +1,8 @@ + AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5 + +-lib_LIBRARIES = libdst.a ++lib_LTLIBRARIES = libdst.la + +-libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \ ++libdst_la_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \ + base64.c prandom.c + + EXTRA_DIST = dst_internal.h md5.h md5_locl.h +diff -up dhcp-4.2.0/omapip/Makefile.am.sharedlib dhcp-4.2.0/omapip/Makefile.am +--- dhcp-4.2.0/omapip/Makefile.am.sharedlib 2010-10-01 14:22:36.020002772 +0200 ++++ dhcp-4.2.0/omapip/Makefile.am 2010-10-01 14:22:36.030002772 +0200 +@@ -1,9 +1,9 @@ + AM_CFLAGS = -fpic + +-lib_LIBRARIES = libomapi.a ++lib_LTLIBRARIES = libomapi.la + noinst_PROGRAMS = svtest + +-libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \ ++libomapi_la_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \ + errwarn.c listener.c dispatch.c generic.c support.c \ + handle.c message.c convert.c hash.c auth.c inet_addr.c \ + array.c trace.c toisc.c iscprint.c isclib.c +@@ -13,5 +13,5 @@ EXTRA_DIST = $(man_MANS) + + svtest_SOURCES = test.c + svtest_CFLAGS = -fpie +-svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export ++svtest_LDADD = libomapi.la $(BIND9_LIBDIR) -ldns-export -lisc-export + +diff -up dhcp-4.2.0/relay/Makefile.am.sharedlib dhcp-4.2.0/relay/Makefile.am +--- dhcp-4.2.0/relay/Makefile.am.sharedlib 2010-10-01 14:22:36.020002772 +0200 ++++ dhcp-4.2.0/relay/Makefile.am 2010-10-01 14:22:36.030002772 +0200 +@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst + sbin_PROGRAMS = dhcrelay + dhcrelay_SOURCES = dhcrelay.c + dhcrelay_CFLAGS = -fpie +-dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ ++dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ + $(BIND9_LIBDIR) -ldns-export -lisc-export + dhcrelay_LDFLAGS = -pie -Wl,-z,relro -Wl,-z,now + +diff -up dhcp-4.2.0/server/Makefile.am.sharedlib dhcp-4.2.0/server/Makefile.am +--- dhcp-4.2.0/server/Makefile.am.sharedlib 2010-10-01 14:22:36.020002772 +0200 ++++ dhcp-4.2.0/server/Makefile.am 2010-10-01 14:22:36.030002772 +0200 +@@ -7,8 +7,8 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c + dhcpv6.c mdb6.c ldap.c ldap_casa.c + + dhcpd_CFLAGS = $(LDAP_CFLAGS) -fpie +-dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export ++dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ ++ ../dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export + dhcpd_LDFLAGS = -pie -Wl,-z,relro -Wl,-z,now + + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5