diff options
author | Brian Behlendorf <[email protected]> | 2009-06-16 10:44:59 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2009-06-16 10:44:59 -0700 |
commit | 39a3d2a421bf067329bae352866a5d1fccbcee70 (patch) | |
tree | 326b0cb2c65c3d9150bfe4717095e046940cadce | |
parent | e554dffa6031a2cf37537fc8451f757d5ae9e46f (diff) |
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.
-rw-r--r-- | Makefile.am | 9 | ||||
-rw-r--r-- | Makefile.in | 9 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | config/spl-build.m4 | 15 | ||||
-rwxr-xr-x | configure | 15 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/Makefile.in | 2 | ||||
-rw-r--r-- | module/Makefile.in | 2 | ||||
-rw-r--r-- | spl.spec.in | 42 |
9 files changed, 69 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am index 63d6ba7e4..c0a4a6b65 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/Makefile.in b/Makefile.in index 27825361e..5c3bf0227 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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. diff --git a/autogen.sh b/autogen.sh index e5614cf32..728000ae4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 750218941..a141fce50 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -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]) @@ -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 diff --git a/include/Makefile.am b/include/Makefile.am index f85380f79..d1990dcb0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -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; \ diff --git a/include/Makefile.in b/include/Makefile.in index e70ab9ff7..7b1437a4d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -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; \ diff --git a/module/Makefile.in b/module/Makefile.in index abb379482..b93a1d769 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -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 \ diff --git a/spl.spec.in b/spl.spec.in index cb2648509..4cd71de05 100644 --- a/spl.spec.in +++ b/spl.spec.in @@ -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 +%{!?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 _kdir %((echo X; ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null)|sed -e 's/linux-//' | tail -1) -%define kver %(basename %{_kdir}) +%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 |