From: James Simmons Date: Mon, 24 Jun 2013 14:19:35 +0000 (-0400) Subject: LU-3497 build: Use alt. path for ZFS development headers X-Git-Tag: 2.4.92~8 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=fa16465704e1497146b461ebe59af420ae79fa9b;hp=1f63b38d2a45071d30ba499bf631b60a6f25d484 LU-3497 build: Use alt. path for ZFS development headers 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 Change-Id: I4307d07072f655df86f542686ece71e11cc97045 Reviewed-on: http://review.whamcloud.com/6750 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Brian J. Murrell Reviewed-by: Oleg Drokin --- diff --git a/config/lustre-build-zfs.m4 b/config/lustre-build-zfs.m4 index 507afd8..ef155d3 100644 --- a/config/lustre-build-zfs.m4 +++ b/config/lustre-build-zfs.m4 @@ -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 # diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index a2dec4a..30ae2af 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -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}"