mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Packaging improvements for RHEL and SLES
- Properly honor --prefix in build system and rpm spec file. - Add '--define require_kdir' to spec file to support building rpms against kernel sources installed in non-default locations. - Add '--define require_kobj' to spec file to support building rpms against kernel object installed in non-default locations. - Stop suppressing errors in autogen.sh script. - Improved logic to detect missing kernel objects when they are not located with the source. This is the common case for SLES as well as in-tree chaos kernel builds and is done to simply support for multiple arches. - Moved spl-devel build products to /usr/src/spl-<version>, a spl symlink is created to reference the last installed version.
This commit is contained in:
parent
e554dffa60
commit
39a3d2a421
@ -16,8 +16,11 @@ distclean-local::
|
|||||||
-type f -print | xargs $(RM)
|
-type f -print | xargs $(RM)
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(INSTALL) -D spl_config.h $(DESTDIR)/$(LINUX)/include/spl/spl_config.h
|
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
|
||||||
$(INSTALL) -D spl_unconfig.h $(DESTDIR)/$(LINUX)/include/spl/spl_unconfig.h
|
for instfile in $(noinst_HEADERS) module/Module.symvers; do \
|
||||||
|
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
|
||||||
|
done
|
||||||
|
(cd $(DESTDIR)/${prefix}/src && ln -f -s spl-$(SPL_META_VERSION) spl)
|
||||||
|
|
||||||
ctags:
|
ctags:
|
||||||
$(RM) $(top_srcdir)/tags
|
$(RM) $(top_srcdir)/tags
|
||||||
@ -50,6 +53,6 @@ srpm: dist
|
|||||||
rpm: srpm
|
rpm: srpm
|
||||||
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
||||||
$(MAKE) $(AM_MAKEFLAGS) rpmbuild="$$rpmbuild" rpm-local || exit 1; \
|
$(MAKE) $(AM_MAKEFLAGS) rpmbuild="$$rpmbuild" rpm-local || exit 1; \
|
||||||
/usr/bin/rpmbuild --define "_tmppath $$rpmbuild/TMP" --define "_topdir $$rpmbuild" --define "dist %{nil}" --define "require_kver $(LINUX_VERSION)" --nodeps --rebuild $(distdir)-$(SPL_META_RELEASE).src.rpm || exit 1; \
|
/usr/bin/rpmbuild --define "_tmppath $$rpmbuild/TMP" --define "_topdir $$rpmbuild" --define "dist %{nil}" --define "require_kdir $(LINUX)" --define "require_kobj $(LINUX_OBJ)" --define "require_kver $(LINUX_VERSION)" --nodeps --rebuild $(distdir)-$(SPL_META_RELEASE).src.rpm || exit 1; \
|
||||||
cp $$rpmbuild/RPMS/*/* . || exit 1; \
|
cp $$rpmbuild/RPMS/*/* . || exit 1; \
|
||||||
$(RM) -R $$rpmbuild
|
$(RM) -R $$rpmbuild
|
||||||
|
@ -660,8 +660,11 @@ distclean-local::
|
|||||||
-type f -print | xargs $(RM)
|
-type f -print | xargs $(RM)
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(INSTALL) -D spl_config.h $(DESTDIR)/$(LINUX)/include/spl/spl_config.h
|
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
|
||||||
$(INSTALL) -D spl_unconfig.h $(DESTDIR)/$(LINUX)/include/spl/spl_unconfig.h
|
for instfile in $(noinst_HEADERS) module/Module.symvers; do \
|
||||||
|
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
|
||||||
|
done
|
||||||
|
(cd $(DESTDIR)/${prefix}/src && ln -f -s spl-$(SPL_META_VERSION) spl)
|
||||||
|
|
||||||
ctags:
|
ctags:
|
||||||
$(RM) $(top_srcdir)/tags
|
$(RM) $(top_srcdir)/tags
|
||||||
@ -694,7 +697,7 @@ srpm: dist
|
|||||||
rpm: srpm
|
rpm: srpm
|
||||||
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
|
||||||
$(MAKE) $(AM_MAKEFLAGS) rpmbuild="$$rpmbuild" rpm-local || exit 1; \
|
$(MAKE) $(AM_MAKEFLAGS) rpmbuild="$$rpmbuild" rpm-local || exit 1; \
|
||||||
/usr/bin/rpmbuild --define "_tmppath $$rpmbuild/TMP" --define "_topdir $$rpmbuild" --define "dist %{nil}" --define "require_kver $(LINUX_VERSION)" --nodeps --rebuild $(distdir)-$(SPL_META_RELEASE).src.rpm || exit 1; \
|
/usr/bin/rpmbuild --define "_tmppath $$rpmbuild/TMP" --define "_topdir $$rpmbuild" --define "dist %{nil}" --define "require_kdir $(LINUX)" --define "require_kobj $(LINUX_OBJ)" --define "require_kver $(LINUX_VERSION)" --nodeps --rebuild $(distdir)-$(SPL_META_RELEASE).src.rpm || exit 1; \
|
||||||
cp $$rpmbuild/RPMS/*/* . || exit 1; \
|
cp $$rpmbuild/RPMS/*/* . || exit 1; \
|
||||||
$(RM) -R $$rpmbuild
|
$(RM) -R $$rpmbuild
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
aclocal -I config &&
|
aclocal -I config &&
|
||||||
libtoolize --automake --copy
|
libtoolize --automake --copy
|
||||||
autoheader &&
|
autoheader &&
|
||||||
automake --add-missing --include-deps --copy 2>/dev/null
|
automake --add-missing --include-deps --copy
|
||||||
autoconf
|
autoconf
|
||||||
rm -rf autom4te.cache aclocal.m4
|
rm -rf autom4te.cache aclocal.m4
|
||||||
|
@ -2,7 +2,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
|
|||||||
AC_ARG_WITH([linux],
|
AC_ARG_WITH([linux],
|
||||||
AS_HELP_STRING([--with-linux=PATH],
|
AS_HELP_STRING([--with-linux=PATH],
|
||||||
[Path to kernel source]),
|
[Path to kernel source]),
|
||||||
[kernelsrc="$withval"; kernelbuild="$withval"])
|
[kernelsrc="$withval"])
|
||||||
|
|
||||||
AC_ARG_WITH([linux-obj],
|
AC_ARG_WITH([linux-obj],
|
||||||
AS_HELP_STRING([--with-linux-obj=PATH],
|
AS_HELP_STRING([--with-linux-obj=PATH],
|
||||||
@ -16,7 +16,6 @@ AC_DEFUN([SPL_AC_KERNEL], [
|
|||||||
|
|
||||||
if test -e ${sourcelink}; then
|
if test -e ${sourcelink}; then
|
||||||
kernelsrc=`readlink -f ${sourcelink}`
|
kernelsrc=`readlink -f ${sourcelink}`
|
||||||
kernelbuild=
|
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([Not found])
|
AC_MSG_RESULT([Not found])
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
@ -31,10 +30,14 @@ AC_DEFUN([SPL_AC_KERNEL], [
|
|||||||
|
|
||||||
AC_MSG_RESULT([$kernelsrc])
|
AC_MSG_RESULT([$kernelsrc])
|
||||||
AC_MSG_CHECKING([kernel build directory])
|
AC_MSG_CHECKING([kernel build directory])
|
||||||
if test -z "$kernelbuild" && test -d ${kernelsrc}-obj; then
|
if test -z "$kernelbuild"; then
|
||||||
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
|
if test -d ${kernelsrc}-obj; then
|
||||||
else
|
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
|
||||||
kernelbuild=${kernelsrc}
|
elif test -d `dirname ${kernelsrc}`/build-`arch`; then
|
||||||
|
kernelbuild=`dirname ${kernelsrc}`/build-`arch`
|
||||||
|
else
|
||||||
|
kernelbuild=${kernelsrc}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT([$kernelbuild])
|
AC_MSG_RESULT([$kernelbuild])
|
||||||
|
|
||||||
|
15
configure
vendored
15
configure
vendored
@ -18930,7 +18930,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
|||||||
# Check whether --with-linux or --without-linux was given.
|
# Check whether --with-linux or --without-linux was given.
|
||||||
if test "${with_linux+set}" = set; then
|
if test "${with_linux+set}" = set; then
|
||||||
withval="$with_linux"
|
withval="$with_linux"
|
||||||
kernelsrc="$withval"; kernelbuild="$withval"
|
kernelsrc="$withval"
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
@ -18948,7 +18948,6 @@ echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6
|
|||||||
|
|
||||||
if test -e ${sourcelink}; then
|
if test -e ${sourcelink}; then
|
||||||
kernelsrc=`readlink -f ${sourcelink}`
|
kernelsrc=`readlink -f ${sourcelink}`
|
||||||
kernelbuild=
|
|
||||||
else
|
else
|
||||||
echo "$as_me:$LINENO: result: Not found" >&5
|
echo "$as_me:$LINENO: result: Not found" >&5
|
||||||
echo "${ECHO_T}Not found" >&6
|
echo "${ECHO_T}Not found" >&6
|
||||||
@ -18970,10 +18969,14 @@ echo "$as_me: error:
|
|||||||
echo "${ECHO_T}$kernelsrc" >&6
|
echo "${ECHO_T}$kernelsrc" >&6
|
||||||
echo "$as_me:$LINENO: checking kernel build directory" >&5
|
echo "$as_me:$LINENO: checking kernel build directory" >&5
|
||||||
echo $ECHO_N "checking kernel build directory... $ECHO_C" >&6
|
echo $ECHO_N "checking kernel build directory... $ECHO_C" >&6
|
||||||
if test -z "$kernelbuild" && test -d ${kernelsrc}-obj; then
|
if test -z "$kernelbuild"; then
|
||||||
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
|
if test -d ${kernelsrc}-obj; then
|
||||||
else
|
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
|
||||||
kernelbuild=${kernelsrc}
|
elif test -d `dirname ${kernelsrc}`/build-`arch`; then
|
||||||
|
kernelbuild=`dirname ${kernelsrc}`/build-`arch`
|
||||||
|
else
|
||||||
|
kernelbuild=${kernelsrc}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo "$as_me:$LINENO: result: $kernelbuild" >&5
|
echo "$as_me:$LINENO: result: $kernelbuild" >&5
|
||||||
echo "${ECHO_T}$kernelbuild" >&6
|
echo "${ECHO_T}$kernelbuild" >&6
|
||||||
|
@ -16,7 +16,7 @@ noinst_HEADERS += util/*.h
|
|||||||
noinst_HEADERS += vm/*.h
|
noinst_HEADERS += vm/*.h
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
instdest=$(DESTDIR)/$(LINUX)/include/spl; \
|
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
|
||||||
instfiles=`find . -name '*.h'`; \
|
instfiles=`find . -name '*.h'`; \
|
||||||
for instfile in $$instfiles; do \
|
for instfile in $$instfiles; do \
|
||||||
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
|
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
|
||||||
|
@ -387,7 +387,7 @@ uninstall-am: uninstall-info-am
|
|||||||
|
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
instdest=$(DESTDIR)/$(LINUX)/include/spl; \
|
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
|
||||||
instfiles=`find . -name '*.h'`; \
|
instfiles=`find . -name '*.h'`; \
|
||||||
for instfile in $$instfiles; do \
|
for instfile in $$instfiles; do \
|
||||||
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
|
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
|
||||||
|
@ -9,8 +9,6 @@ modules clean:
|
|||||||
modules_install:
|
modules_install:
|
||||||
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` \
|
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` \
|
||||||
INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=addon $@
|
INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=addon $@
|
||||||
$(INSTALL) -D Module.symvers \
|
|
||||||
$(DESTDIR)/@LINUX@/include/spl/Module.symvers
|
|
||||||
|
|
||||||
distdir:
|
distdir:
|
||||||
list='$(subdir-m)'; for subdir in $$list; do \
|
list='$(subdir-m)'; for subdir in $$list; do \
|
||||||
|
42
spl.spec.in
42
spl.spec.in
@ -1,22 +1,52 @@
|
|||||||
# The following block is used to allow the source RPM to be rebuilt
|
# The following block is used to allow the source RPM to be rebuilt
|
||||||
# against arbitrary kernels. It ensure the release name is correct
|
# against arbitrary kernels. It ensure the release name is correct
|
||||||
# and the proper build/install requires are set.
|
# and the proper build/install requires are set.
|
||||||
|
|
||||||
|
# When require_kdir is defined we do one of two things:
|
||||||
|
# require_kver: Ideally defined to match the kernel.
|
||||||
|
# !require_kver: A best guess is made.
|
||||||
|
%if 0%{?require_kdir:1}
|
||||||
%if 0%{?require_kver:1}
|
%if 0%{?require_kver:1}
|
||||||
%define kver %{require_kver}
|
%define kver %{require_kver}
|
||||||
|
%define kdir %{require_kdir}
|
||||||
%else
|
%else
|
||||||
%define _kdir %((echo X; ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null)|sed -e 's/linux-//' | tail -1)
|
%{!?require_kobj: %define require_kobj %{require_kdir}}
|
||||||
%define kver %(basename %{_kdir})
|
%define kdir %{require_kdir}
|
||||||
|
%define kuts %{require_kobj}/include/linux/utsrelease.h \
|
||||||
|
%{require_kobj}/include/linux/version.h
|
||||||
|
%define kver %((grep UTS_RELEASE %{kuts}) | cut -f2 -d'"' | tail -1)
|
||||||
|
%endif
|
||||||
|
|
||||||
|
# When require_kdir is not defined we do one of two things:
|
||||||
|
# require_kver: Locate the requested kernel in default dirs.
|
||||||
|
# !require_kver: Locate the newest kernel in default dirs.
|
||||||
|
%else
|
||||||
|
%if 0%{?require_kver:1}
|
||||||
|
%define kver %{require_kver}
|
||||||
|
%define kdef %{_prefix}/src/kernels/%{kver} %{_prefix}/src/linux-%{kver}
|
||||||
|
%define kdir %((echo X; ls -1d %kdef 2>/dev/null)|sed -e 's/linux-//'|tail -1)
|
||||||
|
%else
|
||||||
|
%define kdef %{_prefix}/src/kernels/* %{_prefix}/src/linux-*
|
||||||
|
%define kdir %((echo X; ls -1d %kdef 2>/dev/null)|sed -e 's/linux-//'|tail -1)
|
||||||
|
%define kver %(basename %{kdir})
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
# Kernel objects may not be located with the source. Assume
|
||||||
|
# that they are but allow this to be overrided if required.
|
||||||
|
%if 0%{?require_kobj:1}
|
||||||
|
%define kobj %{require_kobj}
|
||||||
|
%else
|
||||||
|
%define kobj %{kdir}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Each distro has its own kernel package naming convention.
|
# Each distro has its own kernel package naming convention.
|
||||||
%if 0%{?ch4}
|
%if 0%{?ch4}
|
||||||
%define kstr chaos-kernel
|
%define kstr chaos-kernel
|
||||||
%define kdev chaos-kernel-devel
|
%define kdev chaos-kernel-devel
|
||||||
%define kdir /usr/src/kernels/%{kver}
|
|
||||||
%else
|
%else
|
||||||
%define kstr kernel
|
%define kstr kernel
|
||||||
%define kdev kernel-devel
|
%define kdev kernel-devel
|
||||||
%define kdir /usr/src/kernels/%{kver}
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
@ -69,7 +99,7 @@ symbols needed for building additional modules which use %{name}.
|
|||||||
%prep
|
%prep
|
||||||
%setup
|
%setup
|
||||||
%build
|
%build
|
||||||
%configure --with-linux=%{kdir}
|
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj}
|
||||||
make
|
make
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -87,7 +117,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{kdir}/include/spl/*
|
%{_prefix}/src/*
|
||||||
|
|
||||||
%post
|
%post
|
||||||
if [ -f /boot/System.map-%{kver} ]; then
|
if [ -f /boot/System.map-%{kver} ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user