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 ||
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
# 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