Whamcloud - gitweb
LU-3497 build: Use alt. path for ZFS development headers 50/6750/5
authorJames Simmons <uja.ornl@gmail.com>
Mon, 24 Jun 2013 14:19:35 +0000 (10:19 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 3 Sep 2013 05:58:25 +0000 (05:58 +0000)
In the move to dkms the ability to use ZFS userland developement
headers from the ZFS source tree instead of /usr/include was
removed. This patch restores the ability to build lustre using
ZFS on any build box that lacks having the ZFS developement rpms
installed.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I4307d07072f655df86f542686ece71e11cc97045
Reviewed-on: http://review.whamcloud.com/6750
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Brian J. Murrell <brian.murrell@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
config/lustre-build-zfs.m4
contrib/lbuild/lbuild

index 507afd8..ef155d3 100644 (file)
@@ -18,6 +18,11 @@ dnl #                       * /usr/src/zfs-${VERSION}
 dnl #                       * ../spl/
 dnl #                       * $LINUX
 dnl #
+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 #
 dnl # --with-zfs=path - Enable zfs support and use the zfs headers in the
 dnl #                   provided path.  No autodetection is performed and
 dnl #                   if no headers are found this is a fatal error.
@@ -263,16 +268,37 @@ AC_DEFUN([LB_ZFS], [
        AC_SUBST(ZFS_SYMBOLS)
 ])
 
+AC_DEFUN([LB_ZFS_DEVEL], [
+       AC_ARG_WITH([zfs-devel],
+               [AS_HELP_STRING([--with-zfs-devel=PATH],
+               [Path to zfs development headers])],
+               [zfsdevel="$withval"])
+
+       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"
+               ], [
+                       AC_MSG_ERROR([Path to development headers directory does not exist])
+               ])
+       ])
+       AC_MSG_RESULT([$zfslib])
+])
+
 AC_DEFUN([LB_ZFS_USER], [
        dnl #
        dnl # Detect user space zfs development headers.
        dnl #
        AC_MSG_CHECKING([zfs devel headers])
-       AS_IF([test -d /usr/include/libzfs && test -d /usr/include/libspl], [
-               zfslib="-I /usr/include/libspl -I /usr/include/libzfs"
-       ], [
-               zfslib="[Not found]"
-               enable_zfs=no
+       AS_IF([test -z "${zfslib}"], [
+               AS_IF([test -e $zfssrc/include/libzfs.h && test -e $zfssrc/lib/libspl/include], [
+                       zfslib="-I $zfssrc/lib/libspl/include -I $zfssrc/include"
+               ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
+                       zfslib="-I /usr/include/libspl -I /usr/include/libzfs"
+               ], [
+                       zfslib="[Not Found]"
+                       enable_zfs=no
+               ])
        ])
        AC_MSG_RESULT([$zfslib])
 
@@ -314,7 +340,7 @@ AC_DEFUN([LB_PATH_ZFS], [
                        LB_SPL
                        LB_ZFS
                ])
-
+               LB_ZFS_DEVEL
                LB_ZFS_USER
 
                dnl #
index a2dec4a..30ae2af 100755 (executable)
@@ -1048,6 +1048,16 @@ build_spl_zfs() {
        for rpm in $rpms; do
             rpm2cpio $rpm | cpio -id
        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}"
+        fi
         popd
 
         CONFIGURE_FLAGS="--with-$pkg=$(ls -d $TOPDIR/usr/src/$pkg-*/|tail -1) ${CONFIGURE_FLAGS}"