Whamcloud - gitweb
LU-5091 build: Support alternate locations of libzfs.so 01/10401/5
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Wed, 21 May 2014 18:08:30 +0000 (14:08 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 28 May 2014 15:35:05 +0000 (15:35 +0000)
Due to the change for with-zfs-devel (LU-3497), also add support to
search for libzfs.so along with the alternate locations supplied with
the header files.
Also need to unpack zfs{,-devel}.  The zfs RPM is needed because it
has the actual libraries in it and the zfs-devel RPM only has un-
versioned symlinks to the libraries in the zfs RPM.
This will all change one day when we have a libzfs RPM per
https://github.com/zfsonlinux/zfs/issues/2329 and it looks like it
could be one day soon: https://github.com/zfsonlinux/zfs/pull/2341.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Brian J. Murrell <brian.murrell@intel.com>
Change-Id: Ic78bd0eb88d8ab0f2456b8cf684bb8b9c0c0833a
Reviewed-on: http://review.whamcloud.com/10401
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
config/lustre-build-zfs.m4
contrib/lbuild/lbuild
lustre/utils/Makefile.am

index 51c606b..0cc1e62 100644 (file)
@@ -22,6 +22,11 @@ dnl # --with-zfs-devel=path
 dnl #                 - User provided directory where zfs development headers
 dnl #                   are located. This option is typically used when user
 dnl #                   uses rpm2cpio to unpack src rpm.
+dnl #                   Assumes layout of:
+dnl #                     ${zfs-devel-path}/usr/include/libzfs
+dnl #                     ${zfs-devel-path}/usr/include/libspl
+dnl #                     ${zfs-devel-path}/lib64/libzfs.so.* or
+dnl #                     ${zfs-devel-path}/lib/libzfs.so.*
 dnl #
 dnl # --with-zfs=path - Enable zfs support and use the zfs headers in the
 dnl #                   provided path.  No autodetection is performed and
@@ -277,12 +282,13 @@ AC_DEFUN([LB_ZFS_DEVEL], [
        AC_MSG_CHECKING([user provided zfs devel headers])
        AS_IF([test ! -z "${zfsdevel}"], [
                AS_IF([test -d "${zfsdevel}/usr/include/libspl" && test -d "${zfsdevel}/usr/include/libzfs"], [
-                       zfslib="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
+                       zfsinc="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
+                       zfslib="-L$zfsdevel/lib64 -L$zfsdevel/lib"
                ], [
                        AC_MSG_ERROR([Path to development headers directory does not exist])
                ])
        ])
-       AC_MSG_RESULT([$zfslib])
+       AC_MSG_RESULT([$zfsinc])
 ])
 
 AC_DEFUN([LB_ZFS_USER], [
@@ -290,20 +296,23 @@ AC_DEFUN([LB_ZFS_USER], [
        dnl # Detect user space zfs development headers.
        dnl #
        AC_MSG_CHECKING([zfs devel headers])
-       AS_IF([test -z "${zfslib}"], [
+       AS_IF([test -z "${zfsinc}"], [
                AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
-                       zfslib="-I $zfssrc/lib/libspl/include -I $zfssrc/include"
+                       zfsinc="-I $zfssrc/lib/libspl/include -I $zfssrc/include"
+                       zfslib="-L$zfssrc/lib/libzfs/.libs/"
                ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
-                       zfslib="-I /usr/include/libspl -I /usr/include/libzfs"
+                       zfsinc="-I/usr/include/libspl -I /usr/include/libzfs"
+                       zfslib=""
                ], [
-                       zfslib="[Not Found]"
+                       zfsinc="[Not Found]"
+                       zfslib=""
                        enable_zfs=no
                ])
        ])
-       AC_MSG_RESULT([$zfslib])
+       AC_MSG_RESULT([$zfsinc])
 
-       ZFS_LIBZFS_INCLUDE=${zfslib}
-       ZFS_LIBZFS_LDFLAGS=-lzfs
+       ZFS_LIBZFS_INCLUDE=${zfsinc}
+       ZFS_LIBZFS_LDFLAGS="-lzfs ${zfslib}"
        AC_SUBST(ZFS_LIBZFS_INCLUDE)
        AC_SUBST(ZFS_LIBZFS_LDFLAGS)
 ])
index 7d0c690..7c0dac1 100755 (executable)
@@ -1077,24 +1077,24 @@ build_spl_zfs() {
         git clone ${SPLZFSGITREPO:-"https://github.com/zfsonlinux"}/$pkg.git $pkg 2>&1
 
         pushd $pkg || return 255
-       if [ -n "$SPLZFSTAG" ]; then
-           git checkout $SPLZFSTAG
-       else
-           git checkout -b lbuild $pkg-$SPLZFSVER
-       fi
-
-       # This differentiates between older zfs versions
-       if [ -f $pkg-modules.spec.in ]; then
-           rpmpkg=$pkg-modules
-           specdir=.
-           speclist="$pkg.spec $rpmpkg.spec"
-       else
+        if [ -n "$SPLZFSTAG" ]; then
+            git checkout $SPLZFSTAG
+        else
+            git checkout -b lbuild $pkg-$SPLZFSVER
+        fi
+
+        # This differentiates between older zfs versions
+        if [ -f $pkg-modules.spec.in ]; then
+            rpmpkg=$pkg-modules
+            specdir=.
+            speclist="$pkg.spec $rpmpkg.spec"
+        else
             rpmpkg=kmod-$pkg-devel
-           specdir=rpm/generic
-           speclist="$pkg.spec $pkg-kmod.spec $pkg-dkms.spec"
-       fi
+            specdir=rpm/generic
+            speclist="$pkg.spec $pkg-kmod.spec $pkg-dkms.spec"
+        fi
 
-       sh autogen.sh || return 255
+        sh autogen.sh || return 255
 
         if  ! ./configure --with-linux=${LINUX} --with-linux-obj=${LINUXOBJ:-$LINUX} \
                           ${spldir:+--with-spl="${spldir}"} 2>&1 ||
@@ -1106,40 +1106,36 @@ build_spl_zfs() {
 
         ln -f $pkg/$pkg-*.tar.gz $TOPDIR/SOURCES ||
            error "failed to link $pkg/$pkg-*.tar.gz into $TOPDIR/SOURCES"
-       if [ -f $pkg/scripts/kmodtool ]; then
-           ln -f $pkg/scripts/kmodtool $TOPDIR/SOURCES/
-       fi
-
-       local rpmb
-       if $DO_SRC; then
-           rpmb=-ba
-       else
-           rpmb=-bb
-       fi
-
-       # set search dir for our own kmodtool to find correct
-       # directories
-       export KERNELSOURCE=$(dirname ${LINUX})
-       # Manually build rpms
-       for spec in $speclist; do
-           echo "Building RPMs from $pkg/$specdir/$spec"
+        if [ -f $pkg/scripts/kmodtool ]; then
+            ln -f $pkg/scripts/kmodtool $TOPDIR/SOURCES/
+        fi
+
+        local rpmb
+        if $DO_SRC; then
+            rpmb=-ba
+        else
+            rpmb=-bb
+        fi
+
+        # set search dir for our own kmodtool to find correct
+        # directories
+        export KERNELSOURCE=$(dirname ${LINUX})
+        # Manually build rpms
+        for spec in $speclist; do
+            echo "Building RPMs from $pkg/$specdir/$spec"
             if ! $RPMBUILD $rpmb $pkg/$specdir/$spec \
-               --nodeps -v \
-               --define "require_kdir ${LINUX}" \
-               ${LINUXOBJ:+--define "require_kobj ${LINUXOBJ}"} \
-               ${spldir:+--define "require_spldir ${spldir}"} \
-               --define "kver $kver" \
-               --define "kernels $kver" \
-               --define "_tmppath /var/tmp" \
-               --define "kernelbuildroot $TOPDIR/reused" \
-               --define "_topdir $TOPDIR" 2>&1; then
-               return 255
+                --nodeps -v \
+                --define "require_kdir ${LINUX}" \
+                ${LINUXOBJ:+--define "require_kobj ${LINUXOBJ}"} \
+                ${spldir:+--define "require_spldir ${spldir}"} \
+                --define "kver $kver" \
+                --define "kernels $kver" \
+                --define "_tmppath /var/tmp" \
+                --define "kernelbuildroot $TOPDIR/reused" \
+                --define "_topdir $TOPDIR" 2>&1; then
+                return 255
             fi
-       done
-
-#      $DO_SRC && mv $pkg*.src.rpm $TOPDIR/SRPMS/
-#      mv $pkg*.noarch.rpm $TOPDIR/RPMS/noarch/
-#      mv *$pkg*.$TARGET_ARCH.rpm $TOPDIR/RPMS/$(basearch $TARGET_ARCH)/
+        done
 
         # We have built the rpms for the package. Now we need to extract the
         # contained files so we can build further things against them
@@ -1147,19 +1143,25 @@ build_spl_zfs() {
 
         # cpio only extract to pwd so we need to go there.
         pushd $TOPDIR
-       local rpm
-       for rpm in $rpms; do
+        local rpm
+        for rpm in $rpms; do
             rpm2cpio $rpm | cpio -id
-       done
+        done
 
         if [ "$pkg" == "zfs" ]; then
-            mkdir -p $TOPDIR/zfsdevel
-            pushd $TOPDIR/zfsdevel
-            # We also need to extract zfs-devel rpm
-            local devel_rpm=$(ls -1 $TOPDIR/RPMS/*/$pkg-devel-*.rpm)
-            rpm2cpio $devel_rpm | cpio -id
-            popd
-            CONFIGURE_FLAGS="--with-$pkg-devel=$TOPDIR/zfsdevel ${CONFIGURE_FLAGS}"
+            # We also need to extract both the zfs and zfs-devel rpms
+            # the zfs rpm is needed because it has the actual libraries in
+            # it and the zfs-devel rpm only has unversioned symlinks to the
+            # libraries in the zfs rpm
+            # this will all change one day when we have a libzfs rpm per
+            # https://github.com/zfsonlinux/zfs/issues/2329
+            # and it looks like it could be one day soon:
+            # https://github.com/zfsonlinux/zfs/pull/2341
+            local devel_rpms=$(ls -1 $TOPDIR/RPMS/*/{$pkg-devel,$pkg-$SPLZFSVER}-*.rpm)
+            for rpm in $devel_rpms; do
+                rpm2cpio $rpm | cpio -id
+            done
+            CONFIGURE_FLAGS="--with-$pkg-devel=$TOPDIR ${CONFIGURE_FLAGS}"
         fi
         popd
 
index 5effd90..67144f8 100644 (file)
@@ -136,7 +136,6 @@ pkglib_LTLIBRARIES += mount_osd_ldiskfs.la
 
 mount_osd_ldiskfs_la_SOURCES = mount_utils_ldiskfs.c
 mount_osd_ldiskfs_la_LDFLAGS = -shared -export-dynamic -module -avoid-version
-mount_osd_ldiskfs_LDADD = libiam.a
 endif
 
 mount_lustre_SOURCES = mount_lustre.c mount_utils.c mount_utils.h