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:
Brian Behlendorf 2009-06-16 10:44:59 -07:00
parent e554dffa60
commit 39a3d2a421
9 changed files with 69 additions and 29 deletions

View File

@ -16,8 +16,11 @@ distclean-local::
-type f -print | xargs $(RM)
install-data-local:
$(INSTALL) -D spl_config.h $(DESTDIR)/$(LINUX)/include/spl/spl_config.h
$(INSTALL) -D spl_unconfig.h $(DESTDIR)/$(LINUX)/include/spl/spl_unconfig.h
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
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:
$(RM) $(top_srcdir)/tags
@ -50,6 +53,6 @@ srpm: dist
rpm: srpm
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(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; \
$(RM) -R $$rpmbuild

View File

@ -660,8 +660,11 @@ distclean-local::
-type f -print | xargs $(RM)
install-data-local:
$(INSTALL) -D spl_config.h $(DESTDIR)/$(LINUX)/include/spl/spl_config.h
$(INSTALL) -D spl_unconfig.h $(DESTDIR)/$(LINUX)/include/spl/spl_unconfig.h
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
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:
$(RM) $(top_srcdir)/tags
@ -694,7 +697,7 @@ srpm: dist
rpm: srpm
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(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; \
$(RM) -R $$rpmbuild
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -3,6 +3,6 @@
aclocal -I config &&
libtoolize --automake --copy
autoheader &&
automake --add-missing --include-deps --copy 2>/dev/null
automake --add-missing --include-deps --copy
autoconf
rm -rf autom4te.cache aclocal.m4

View File

@ -2,7 +2,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
AC_ARG_WITH([linux],
AS_HELP_STRING([--with-linux=PATH],
[Path to kernel source]),
[kernelsrc="$withval"; kernelbuild="$withval"])
[kernelsrc="$withval"])
AC_ARG_WITH([linux-obj],
AS_HELP_STRING([--with-linux-obj=PATH],
@ -16,7 +16,6 @@ AC_DEFUN([SPL_AC_KERNEL], [
if test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
kernelbuild=
else
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([
@ -31,10 +30,14 @@ AC_DEFUN([SPL_AC_KERNEL], [
AC_MSG_RESULT([$kernelsrc])
AC_MSG_CHECKING([kernel build directory])
if test -z "$kernelbuild" && test -d ${kernelsrc}-obj; then
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
else
kernelbuild=${kernelsrc}
if test -z "$kernelbuild"; then
if test -d ${kernelsrc}-obj; then
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
elif test -d `dirname ${kernelsrc}`/build-`arch`; then
kernelbuild=`dirname ${kernelsrc}`/build-`arch`
else
kernelbuild=${kernelsrc}
fi
fi
AC_MSG_RESULT([$kernelbuild])

15
configure vendored
View File

@ -18930,7 +18930,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
# Check whether --with-linux or --without-linux was given.
if test "${with_linux+set}" = set; then
withval="$with_linux"
kernelsrc="$withval"; kernelbuild="$withval"
kernelsrc="$withval"
fi;
@ -18948,7 +18948,6 @@ echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6
if test -e ${sourcelink}; then
kernelsrc=`readlink -f ${sourcelink}`
kernelbuild=
else
echo "$as_me:$LINENO: result: Not found" >&5
echo "${ECHO_T}Not found" >&6
@ -18970,10 +18969,14 @@ echo "$as_me: error:
echo "${ECHO_T}$kernelsrc" >&6
echo "$as_me:$LINENO: checking kernel build directory" >&5
echo $ECHO_N "checking kernel build directory... $ECHO_C" >&6
if test -z "$kernelbuild" && test -d ${kernelsrc}-obj; then
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
else
kernelbuild=${kernelsrc}
if test -z "$kernelbuild"; then
if test -d ${kernelsrc}-obj; then
kernelbuild=${kernelsrc}-obj/`arch`/`arch`
elif test -d `dirname ${kernelsrc}`/build-`arch`; then
kernelbuild=`dirname ${kernelsrc}`/build-`arch`
else
kernelbuild=${kernelsrc}
fi
fi
echo "$as_me:$LINENO: result: $kernelbuild" >&5
echo "${ECHO_T}$kernelbuild" >&6

View File

@ -16,7 +16,7 @@ noinst_HEADERS += util/*.h
noinst_HEADERS += vm/*.h
install-data-local:
instdest=$(DESTDIR)/$(LINUX)/include/spl; \
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
instfiles=`find . -name '*.h'`; \
for instfile in $$instfiles; do \
$(INSTALL) -D $$instfile $$instdest/$$instfile; \

View File

@ -387,7 +387,7 @@ uninstall-am: uninstall-info-am
install-data-local:
instdest=$(DESTDIR)/$(LINUX)/include/spl; \
instdest=$(DESTDIR)/${prefix}/src/spl-$(SPL_META_VERSION); \
instfiles=`find . -name '*.h'`; \
for instfile in $$instfiles; do \
$(INSTALL) -D $$instfile $$instdest/$$instfile; \

View File

@ -9,8 +9,6 @@ modules clean:
modules_install:
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` \
INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=addon $@
$(INSTALL) -D Module.symvers \
$(DESTDIR)/@LINUX@/include/spl/Module.symvers
distdir:
list='$(subdir-m)'; for subdir in $$list; do \

View File

@ -1,22 +1,52 @@
# The following block is used to allow the source RPM to be rebuilt
# against arbitrary kernels. It ensure the release name is correct
# 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}
%define kver %{require_kver}
%define kdir %{require_kdir}
%else
%define _kdir %((echo X; ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null)|sed -e 's/linux-//' | tail -1)
%define kver %(basename %{_kdir})
%{!?require_kobj: %define require_kobj %{require_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
# Each distro has its own kernel package naming convention.
%if 0%{?ch4}
%define kstr chaos-kernel
%define kdev chaos-kernel-devel
%define kdir /usr/src/kernels/%{kver}
%else
%define kstr kernel
%define kdev kernel-devel
%define kdir /usr/src/kernels/%{kver}
%endif
%define debug_package %{nil}
@ -69,7 +99,7 @@ symbols needed for building additional modules which use %{name}.
%prep
%setup
%build
%configure --with-linux=%{kdir}
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj}
make
%install
@ -87,7 +117,7 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root)
%{kdir}/include/spl/*
%{_prefix}/src/*
%post
if [ -f /boot/System.map-%{kver} ]; then