Whamcloud - gitweb
LU-7356 build: handle library configure options for SNMP/LNet 76/17576/4
authorJames Simmons <uja.ornl@yahoo.com>
Wed, 16 Dec 2015 15:38:25 +0000 (10:38 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 6 Jan 2016 02:56:34 +0000 (02:56 +0000)
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 <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/17576
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
config/lustre-build.m4
debian/lustre-dev.install
lnet/utils/Makefile.am
lnet/utils/lnetconfig/Makefile.am
lustre.spec.in
snmp/Makefile.am

index 11ca27a..21976fc 100644 (file)
@@ -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
 
index 65ab682..2894dfa 100644 (file)
@@ -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
index 9b93ff0..015970a 100644 (file)
@@ -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
index 689c2e1..9b6db63 100644 (file)
 #   Amir Shehata <amir.shehata@intel.com>
 #
 
-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 =
index 38659cd..cbf123e 100644 (file)
@@ -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}
index 729031a..f616215 100644 (file)
@@ -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