From: James Simmons Date: Wed, 16 Dec 2015 15:38:25 +0000 (-0500) Subject: LU-7356 build: handle library configure options for SNMP/LNet X-Git-Tag: 2.7.65~32 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=75f07b2fa054b69d1c20eef8dddb831af41fd7a5;hp=2b16de10d79f930283a1a0dc6e8c9c2a779aae5d LU-7356 build: handle library configure options for SNMP/LNet Currently if you build lustre with configure options --disable-shared and/or --disable-static it will fail to build in the case of the mount plugins or just plain ignore the configure request. This work enables the ability to create only static or only dynamic libraries for lustre SNMP and libnetconfig. Change-Id: I8b526acd50a7b8eb4f65e7a3bdd0a664e9144376 Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/17576 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index 11ca27a..21976fc69 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -534,6 +534,8 @@ for arg; do --with-release=* ) ;; --with-kmp-moddir=* ) ;; --with-linux=* | --with-linux-obj=* ) ;; + --enable-shared | --disable-shared ) ;; + --enable-static | --disable-static ) ;; --enable-ldiskfs | --disable-ldiskfs ) ;; --enable-modules | --disable-modules ) ;; --enable-server | --disable-server ) ;; @@ -605,6 +607,12 @@ fi if test x$enable_manpages != xyes ; then RPMBINARGS="$RPMBINARGS --without manpages" fi +if test x$enable_shared != xyes ; then + RPMBINARGS="$RPMBINARGS --without shared" +fi +if test x$enable_static != xyes ; then + RPMBINARGS="$RPMBINARGS --without static" +fi RPMBUILD_BINARY_ARGS=$RPMBINARGS diff --git a/debian/lustre-dev.install b/debian/lustre-dev.install index 65ab682..2894dfa 100644 --- a/debian/lustre-dev.install +++ b/debian/lustre-dev.install @@ -1,5 +1,6 @@ lustre/contrib/README usr/share/doc/lustre-dev/contrib lustre/contrib/mpich-1.2.6-lustre.patch usr/share/doc/lustre-dev/contrib debian/tmp/usr/include/lustre/* usr/include/lustre +debian/tmp/usr/lib/*.so.* usr/lib debian/tmp/usr/lib/*.so usr/lib debian/tmp/usr/lib/*.a usr/lib diff --git a/lnet/utils/Makefile.am b/lnet/utils/Makefile.am index 9b93ff0..015970a 100644 --- a/lnet/utils/Makefile.am +++ b/lnet/utils/Makefile.am @@ -41,7 +41,6 @@ AM_LDFLAGS := -L. if BUILD_DLC SUBDIRS = lnetconfig -AM_LDFLAGS += -L$(top_builddir)/lnet/utils/lnetconfig endif # BUILD_DLC LIBCFS= $(top_builddir)/libcfs/libcfs/libcfs.a @@ -72,7 +71,7 @@ libptlctl_a_SOURCES = portals.c debug.c CYAML := $(top_builddir)/lnet/utils/cyaml/cyaml.c lnetctl_SOURCES = lnetctl.c $(CYAML) -lnetctl_LDADD = -llnetconfig $(LIBCFSUTIL) $(LIBCFS) \ - $(LIBREADLINE) $(LIBEFENCE) -lyaml -lm -lnetctl_DEPENDENCIES = $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.so +lnetctl_LDADD = $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la \ + $(LIBCFSUTIL) $(LIBCFS) $(LIBREADLINE) $(LIBEFENCE) -lyaml -lm +lnetctl_DEPENDENCIES = $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la endif # UTILS diff --git a/lnet/utils/lnetconfig/Makefile.am b/lnet/utils/lnetconfig/Makefile.am index 689c2e1..9b6db632 100644 --- a/lnet/utils/lnetconfig/Makefile.am +++ b/lnet/utils/lnetconfig/Makefile.am @@ -26,26 +26,13 @@ # Amir Shehata # -AM_CFLAGS := -fPIC \ - -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLUSTRE_UTILS=1 \ - -I$(top_builddir)/lnet/utils \ - -I$(top_builddir)/lnet/utils/cyaml -AM_LDFLAGS := -L$(top_builddir)/libcfs/libcfs - -lib_LIBRARIES = liblnetconfig.a -noinst_LIBRARIES = liblnetconfigtmp.a +lib_LTLIBRARIES = liblnetconfig.la CYAML := $(top_builddir)/lnet/utils/cyaml/cyaml.c \ $(top_builddir)/lnet/utils/cyaml/cyaml.h -liblnetconfigtmp_a_SOURCES := liblnetconfig.c liblnetconfig.h $(CYAML) - -# build static and share lib lnet config library -liblnetconfig.a : liblnetconfigtmp.a - rm -f liblnetconfig.a liblnetconfig.so - $(CC) $(LDFLAGS) $(AM_LDFLAGS) -shared -o liblnetconfig.so `$(AR) -t liblnetconfigtmp.a` - mv liblnetconfigtmp.a liblnetconfig.a - -install-exec-hook: - cp liblnetconfig.so $(DESTDIR)$(libdir)/ +liblnetconfig_la_SOURCES = liblnetconfig.c liblnetconfig.h $(CYAML) +liblnetconfig_la_CPPFLAGS = -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ + -DLUSTRE_UTILS=1 -I$(top_builddir)/lnet/utils/cyaml +liblnetconfig_la_LDFLAGS = -L$(top_builddir)/libcfs/libcfs -version-info 1:0:0 EXTRA_DIST = diff --git a/lustre.spec.in b/lustre.spec.in index 38659cd..cbf123e 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -10,6 +10,8 @@ %bcond_without lustre_modules %bcond_with lnet_dlc %bcond_without manpages +%bcond_without shared +%bcond_without static %if %{without servers} # --without servers overrides --with {ldiskfs|zfs} @@ -338,6 +340,8 @@ fi %{?with_lustre_tests:--enable-tests}%{!?with_lustre_tests:--disable-tests} \ %{?with_lustre_utils:--enable-utils}%{!?with_lustre_utils:--disable-utils} \ %{?with_lustre_modules:--enable-modules}%{!?with_lustre_modules:--disable-modules} \ + %{!?with_shared:--disable-shared} \ + %{!?with_static:--disable-static} \ %{!?with_lustre_iokit:--disable-iokit} \ %{!?with_ldiskfs:--disable-ldiskfs} \ %{!?with_servers:--disable-server} \ @@ -385,8 +389,14 @@ chmod -R go-w lustre-source/lustre-%{version} find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \; %if %{with lnet_dlc} +rm -f $RPM_BUILD_ROOT%{_libdir}/liblnetconfig.la +%if %{with static} echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files +%endif +%if %{with shared} echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre.files +echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so.*' >>lustre.files +%endif %endif %if %{with ldiskfs} diff --git a/snmp/Makefile.am b/snmp/Makefile.am index 729031a..f616215 100644 --- a/snmp/Makefile.am +++ b/snmp/Makefile.am @@ -1,7 +1,7 @@ -agent_LTLIBRARIES = lustresnmp.la +agent_LTLIBRARIES = liblustresnmp.la mib_DATA = Lustre-MIB.txt -lustresnmp_la_SOURCES = \ +liblustresnmp_la_SOURCES = \ lustre-snmp.c \ lustre-snmp.h \ lustre-snmp-trap.c \ @@ -9,9 +9,9 @@ lustresnmp_la_SOURCES = \ lustre-snmp-util.c \ lustre-snmp-util.h -lustresnmp_la_LIBADD := $(NET_SNMP_LIBS) -lustresnmp_la_CFLAGS := -fPIC $(NET_SNMP_CFLAGS) -lustresnmp_la_LDFLAGS = -fPIC -shared -module -avoid-version +liblustresnmp_la_CFLAGS := $(NET_SNMP_CFLAGS) +liblustresnmp_la_LIBADD := $(NET_SNMP_LIBS) +liblustresnmp_la_LDFLAGS := -version-info 1:0:0 SUBDIRS = DIST_SUBDIRS = autoconf