Simplify rpm build rules, added config/rpm.am.

Distro friendly changes such that the kernel modules are packaged seperately.
This commit is contained in:
Brian Behlendorf 2009-07-01 14:37:44 -07:00
parent 5c3c70adec
commit 86933a6e51
12 changed files with 2998 additions and 334 deletions

View File

@ -1,4 +1,12 @@
SUBDIRS = lib cmd module include scripts
include $(top_srcdir)/config/rpm.am
if CONFIG_USER
USER_DIR = lib cmd scripts
endif
if CONFIG_KERNEL
KERNEL_DIR = module include
endif
SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
AUTOMAKE_OPTIONS = foreign dist-zip
EXTRA_DIST = autogen.sh spl.spec.in META DISCLAIMER
@ -15,6 +23,7 @@ distclean-local::
-o -name 'Makefile' -o -name '$(LINUX_SYMBOLS)' \) \
-type f -print | xargs $(RM)
if CONFIG_KERNEL
install-data-local:
destname=spl-$(SPL_META_VERSION)/$(LINUX_VERSION); \
instdest=$(DESTDIR)/${prefix}/src/$$destname; \
@ -22,6 +31,7 @@ install-data-local:
for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
done
endif
ctags:
$(RM) $(top_srcdir)/tags
@ -33,27 +43,22 @@ etags:
tags: ctags etags
rpm-local:
mkdir -p $(rpmbuild)/TMP && \
mkdir -p $(rpmbuild)/BUILD && \
mkdir -p $(rpmbuild)/RPMS && \
mkdir -p $(rpmbuild)/SRPMS && \
mkdir -p $(rpmbuild)/SPECS && cp $(PACKAGE).spec $(rpmbuild)/SPECS && \
mkdir -p $(rpmbuild)/SOURCES && cp $(distdir).tar.gz $(rpmbuild)/SOURCES
srpm-modules:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
srpm: dist
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 "build_src_rpm 1" --define "dist %{nil}" --nodeps -bs $$rpmbuild/SPECS/$(PACKAGE).spec || exit 1; \
cp $$rpmbuild/SRPMS/$(distdir)-$(SPL_META_RELEASE).src.rpm . || exit 1;\
$(RM) -R $$rpmbuild
srpm-utils:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
# Use 'make rpm LINUX_VERSION=2.x.y-z' to rebuild the source RPM
# against any installed kernel-devel-2.x.y-z package. This will
# override the LINUX_VERSION detected at configure time.
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_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
srpm: srpm-modules srpm-utils
rpm-modules: srpm-modules
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
rpm-utils: srpm-utils
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
rpm-modules: srpm-modules
rpm-utils: srpm-utils
rpm: rpm-modules rpm-utils

View File

@ -39,7 +39,8 @@ host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(am__configure_deps) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/spl.spec.in $(srcdir)/spl_config.h.in \
$(srcdir)/spl-modules.spec.in $(srcdir)/spl.spec.in \
$(srcdir)/spl_config.h.in $(top_srcdir)/config/rpm.am \
$(top_srcdir)/configure $(top_srcdir)/module/Makefile.in \
$(top_srcdir)/module/spl/Makefile.in \
$(top_srcdir)/module/splat/Makefile.in AUTHORS COPYING \
@ -57,7 +58,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = spl_config.h
CONFIG_CLEAN_FILES = module/Makefile module/spl/Makefile \
module/splat/Makefile spl.spec
module/splat/Makefile spl.spec spl-modules.spec
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@ -69,7 +70,7 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = lib cmd scripts module include
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -93,6 +94,10 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIG_KERNEL_FALSE = @CONFIG_KERNEL_FALSE@
CONFIG_KERNEL_TRUE = @CONFIG_KERNEL_TRUE@
CONFIG_USER_FALSE = @CONFIG_USER_FALSE@
CONFIG_USER_TRUE = @CONFIG_USER_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
@ -114,13 +119,13 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNELCFLAGS = @KERNELCFLAGS@
KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LICENSE = @LICENSE@
LINUX = @LINUX@
LINUX_OBJ = @LINUX_OBJ@
LINUX_SYMBOLS = @LINUX_SYMBOLS@
@ -143,6 +148,7 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SPL_CONFIG = @SPL_CONFIG@
SPL_META_ALIAS = @SPL_META_ALIAS@
SPL_META_AUTHOR = @SPL_META_AUTHOR@
SPL_META_DATA = @SPL_META_DATA@
@ -201,7 +207,9 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
SUBDIRS = lib cmd module include scripts
@CONFIG_USER_TRUE@USER_DIR = lib cmd scripts
@CONFIG_KERNEL_TRUE@KERNEL_DIR = module include
SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
AUTOMAKE_OPTIONS = foreign dist-zip
EXTRA_DIST = autogen.sh spl.spec.in META DISCLAIMER
noinst_HEADERS = spl_config.h spl_unconfig.h
@ -211,7 +219,7 @@ all: spl_config.h
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/rpm.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -267,6 +275,8 @@ module/splat/Makefile: $(top_builddir)/config.status $(top_srcdir)/module/splat/
cd $(top_builddir) && $(SHELL) ./config.status $@
spl.spec: $(top_builddir)/config.status $(srcdir)/spl.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
spl-modules.spec: $(top_builddir)/config.status $(srcdir)/spl-modules.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
@ -580,6 +590,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
@CONFIG_KERNEL_FALSE@install-data-local:
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
@ -648,6 +659,49 @@ uninstall-info: uninstall-info-recursive
mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am uninstall-info-am
rpm-local:
mkdir -p $(rpmbuild)/TMP && \
mkdir -p $(rpmbuild)/BUILD && \
mkdir -p $(rpmbuild)/RPMS && \
mkdir -p $(rpmbuild)/SRPMS && \
mkdir -p $(rpmbuild)/SPECS && cp $(rpmspec) $(rpmbuild)/SPECS && \
mkdir -p $(rpmbuild)/SOURCES && cp $(distdir).tar.gz $(rpmbuild)/SOURCES
srpm-common: dist
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(MAKE) $(AM_MAKEFLAGS) \
rpmbuild="$$rpmbuild" \
rpmspec="$$rpmspec" \
rpm-local || exit 1; \
/usr/bin/rpmbuild \
--define "_tmppath $$rpmbuild/TMP" \
--define "_topdir $$rpmbuild" \
--define "build_src_rpm 1" \
--define "dist %{nil}" \
--nodeps -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
$(RM) -R $$rpmbuild
rpm-common:
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(MAKE) $(AM_MAKEFLAGS) \
rpmbuild="$$rpmbuild" \
rpmspec="$$rpmspec" \
rpm-local || 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 $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/*/* . || exit 1; \
$(RM) -R $$rpmbuild
distclean-local::
-$(RM) -R autom4te*.cache
@ -660,13 +714,13 @@ distclean-local::
-o -name 'Makefile' -o -name '$(LINUX_SYMBOLS)' \) \
-type f -print | xargs $(RM)
install-data-local:
destname=spl-$(SPL_META_VERSION)/$(LINUX_VERSION); \
instdest=$(DESTDIR)/${prefix}/src/$$destname; \
echo "${SPL_META_VERSION}" >$$instdest/spl.release; \
for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
done
@CONFIG_KERNEL_TRUE@install-data-local:
@CONFIG_KERNEL_TRUE@ destname=spl-$(SPL_META_VERSION)/$(LINUX_VERSION); \
@CONFIG_KERNEL_TRUE@ instdest=$(DESTDIR)/${prefix}/src/$$destname; \
@CONFIG_KERNEL_TRUE@ echo "${SPL_META_VERSION}" >$$instdest/spl.release; \
@CONFIG_KERNEL_TRUE@ for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
@CONFIG_KERNEL_TRUE@ $(INSTALL) -D $$instfile $$instdest/$$instfile; \
@CONFIG_KERNEL_TRUE@ done
ctags:
$(RM) $(top_srcdir)/tags
@ -678,30 +732,25 @@ etags:
tags: ctags etags
rpm-local:
mkdir -p $(rpmbuild)/TMP && \
mkdir -p $(rpmbuild)/BUILD && \
mkdir -p $(rpmbuild)/RPMS && \
mkdir -p $(rpmbuild)/SRPMS && \
mkdir -p $(rpmbuild)/SPECS && cp $(PACKAGE).spec $(rpmbuild)/SPECS && \
mkdir -p $(rpmbuild)/SOURCES && cp $(distdir).tar.gz $(rpmbuild)/SOURCES
srpm-modules:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
srpm: dist
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 "build_src_rpm 1" --define "dist %{nil}" --nodeps -bs $$rpmbuild/SPECS/$(PACKAGE).spec || exit 1; \
cp $$rpmbuild/SRPMS/$(distdir)-$(SPL_META_RELEASE).src.rpm . || exit 1;\
$(RM) -R $$rpmbuild
srpm-utils:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
# Use 'make rpm LINUX_VERSION=2.x.y-z' to rebuild the source RPM
# against any installed kernel-devel-2.x.y-z package. This will
# override the LINUX_VERSION detected at configure time.
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_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
srpm: srpm-modules srpm-utils
rpm-modules: srpm-modules
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
rpm-utils: srpm-utils
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
rpm-modules: srpm-modules
rpm-utils: srpm-utils
rpm: rpm-modules rpm-utils
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -85,6 +85,10 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIG_KERNEL_FALSE = @CONFIG_KERNEL_FALSE@
CONFIG_KERNEL_TRUE = @CONFIG_KERNEL_TRUE@
CONFIG_USER_FALSE = @CONFIG_USER_FALSE@
CONFIG_USER_TRUE = @CONFIG_USER_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
@ -106,13 +110,13 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNELCFLAGS = @KERNELCFLAGS@
KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LICENSE = @LICENSE@
LINUX = @LINUX@
LINUX_OBJ = @LINUX_OBJ@
LINUX_SYMBOLS = @LINUX_SYMBOLS@
@ -135,6 +139,7 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SPL_CONFIG = @SPL_CONFIG@
SPL_META_ALIAS = @SPL_META_ALIAS@
SPL_META_AUTHOR = @SPL_META_AUTHOR@
SPL_META_DATA = @SPL_META_DATA@

43
config/rpm.am Normal file
View File

@ -0,0 +1,43 @@
rpm-local:
mkdir -p $(rpmbuild)/TMP && \
mkdir -p $(rpmbuild)/BUILD && \
mkdir -p $(rpmbuild)/RPMS && \
mkdir -p $(rpmbuild)/SRPMS && \
mkdir -p $(rpmbuild)/SPECS && cp $(rpmspec) $(rpmbuild)/SPECS && \
mkdir -p $(rpmbuild)/SOURCES && cp $(distdir).tar.gz $(rpmbuild)/SOURCES
srpm-common: dist
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(MAKE) $(AM_MAKEFLAGS) \
rpmbuild="$$rpmbuild" \
rpmspec="$$rpmspec" \
rpm-local || exit 1; \
/usr/bin/rpmbuild \
--define "_tmppath $$rpmbuild/TMP" \
--define "_topdir $$rpmbuild" \
--define "build_src_rpm 1" \
--define "dist %{nil}" \
--nodeps -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
$(RM) -R $$rpmbuild
rpm-common:
rpmpkg=$(pkg)-$(SPL_META_VERSION)-$(SPL_META_RELEASE).src.rpm; \
rpmspec=$(pkg).spec; \
rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
$(MAKE) $(AM_MAKEFLAGS) \
rpmbuild="$$rpmbuild" \
rpmspec="$$rpmspec" \
rpm-local || 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 $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/*/* . || exit 1; \
$(RM) -R $$rpmbuild

View File

@ -1,3 +1,82 @@
dnl #
dnl # Default SPL kernel configuration
dnl #
AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_KERNEL
dnl # Kernel build make options
dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build
KERNELMAKE_PARAMS="V=1"
dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
dnl # compiler options are added by the kernel build system.
abs_srcdir=`readlink -f ${srcdir}`
KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir} -I${abs_srcdir}/include"
if test "${LINUX_OBJ}" != "${LINUX}"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
AC_SUBST(KERNELMAKE_PARAMS)
AC_SUBST(KERNELCPPFLAGS)
SPL_AC_DEBUG
SPL_AC_DEBUG_KMEM
SPL_AC_DEBUG_MUTEX
SPL_AC_DEBUG_KSTAT
SPL_AC_DEBUG_CALLB
SPL_AC_TYPE_UINTPTR_T
SPL_AC_TYPE_ATOMIC64_T
SPL_AC_3ARGS_INIT_WORK
SPL_AC_2ARGS_REGISTER_SYSCTL
SPL_AC_SET_SHRINKER
SPL_AC_PATH_IN_NAMEIDATA
SPL_AC_TASK_CURR
SPL_AC_CTL_UNNUMBERED
SPL_AC_FLS64
SPL_AC_DEVICE_CREATE
SPL_AC_5ARGS_DEVICE_CREATE
SPL_AC_CLASS_DEVICE_CREATE
SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
SPL_AC_TIMESPEC_SUB
SPL_AC_INIT_UTSNAME
SPL_AC_FDTABLE_HEADER
SPL_AC_FILES_FDTABLE
SPL_AC_UACCESS_HEADER
SPL_AC_KMALLOC_NODE
SPL_AC_MONOTONIC_CLOCK
SPL_AC_INODE_I_MUTEX
SPL_AC_MUTEX_LOCK_NESTED
SPL_AC_DIV64_64
SPL_AC_DIV64_U64
SPL_AC_3ARGS_ON_EACH_CPU
SPL_AC_KALLSYMS_LOOKUP_NAME
SPL_AC_GET_VMALLOC_INFO
SPL_AC_PGDAT_HELPERS
SPL_AC_FIRST_ONLINE_PGDAT
SPL_AC_NEXT_ONLINE_PGDAT
SPL_AC_NEXT_ZONE
SPL_AC_PGDAT_LIST
SPL_AC_GET_ZONE_COUNTS
SPL_AC_GLOBAL_PAGE_STATE
SPL_AC_ZONE_STAT_ITEM_FIA
SPL_AC_2ARGS_VFS_UNLINK
SPL_AC_4ARGS_VFS_RENAME
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
AC_MSG_CHECKING([kernel file name for module symbols])
if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost; then
LINUX_SYMBOLS=Modules.symvers
else
LINUX_SYMBOLS=Module.symvers
fi
AC_MSG_RESULT($LINUX_SYMBOLS)
AC_SUBST(LINUX_SYMBOLS)
])
AC_DEFUN([SPL_AC_KERNEL], [
AC_ARG_WITH([linux],
AS_HELP_STRING([--with-linux=PATH],
@ -72,41 +151,54 @@ AC_DEFUN([SPL_AC_KERNEL], [
LINUX_OBJ=${kernelbuild}
LINUX_VERSION=${kernsrcver}
abs_srcdir=`readlink -f ${srcdir}`
kerninclude="-I${abs_srcdir} -I${abs_srcdir}/include"
kernwarn="-Wstrict-prototypes -Werror"
if test "${LINUX_OBJ}" != "${LINUX}"; then
kernobjs="O=$kernelbuild"
fi
KERNELCFLAGS=
KERNELCPPFLAGS="${kerninclude} ${kernwarn}"
KERNELMAKE_PARAMS="${kernobjs}"
AC_SUBST(LINUX)
AC_SUBST(LINUX_OBJ)
AC_SUBST(LINUX_VERSION)
AC_SUBST(KERNELMAKE_PARAMS)
AC_SUBST(KERNELCPPFLAGS)
AC_SUBST(KERNELCFLAGS)
SPL_AC_MODULE_SYMVERS
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
AC_MSG_CHECKING([kernel file name for module symbols])
if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost; then
LINUX_SYMBOLS=Modules.symvers
else
LINUX_SYMBOLS=Module.symvers
fi
AC_MSG_RESULT($LINUX_SYMBOLS)
AC_SUBST(LINUX_SYMBOLS)
])
dnl #
dnl # Default SPL user configuration
dnl #
AC_DEFUN([SPL_AC_CONFIG_USER], [])
AC_DEFUN([SPL_AC_LICENSE], [
AC_MSG_CHECKING([license])
AC_MSG_RESULT([GPL])
AC_MSG_CHECKING([spl license])
LICENSE=GPL
AC_MSG_RESULT([$LICENSE])
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
AC_SUBST(LICENSE)
])
AC_DEFUN([SPL_AC_CONFIG], [
SPL_CONFIG=all
AC_ARG_WITH([config],
AS_HELP_STRING([--with-config=CONFIG],
[Config file 'kernel|user|all']),
[SPL_CONFIG="$withval"])
AC_MSG_CHECKING([spl config])
AC_MSG_RESULT([$SPL_CONFIG]);
AC_SUBST(SPL_CONFIG)
case "$SPL_CONFIG" in
kernel) SPL_AC_CONFIG_KERNEL ;;
user) SPL_AC_CONFIG_USER ;;
all) SPL_AC_CONFIG_KERNEL
SPL_AC_CONFIG_USER ;;
*)
AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
user kernel|user|all]) ;;
esac
AM_CONDITIONAL([CONFIG_USER],
[test "$SPL_CONFIG" = user] ||
[test "$SPL_CONFIG" = all])
AM_CONDITIONAL([CONFIG_KERNEL],
[test "$SPL_CONFIG" = kernel] ||
[test "$SPL_CONFIG" = all])
])
AC_DEFUN([SPL_AC_DEBUG], [

2583
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -38,52 +38,8 @@ AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_LIBTOOL
SPL_AC_KERNEL
SPL_AC_MODULE_SYMVERS
SPL_AC_LICENSE
SPL_AC_DEBUG
SPL_AC_DEBUG_KMEM
SPL_AC_DEBUG_MUTEX
SPL_AC_DEBUG_KSTAT
SPL_AC_DEBUG_CALLB
SPL_AC_TYPE_UINTPTR_T
SPL_AC_TYPE_ATOMIC64_T
SPL_AC_3ARGS_INIT_WORK
SPL_AC_2ARGS_REGISTER_SYSCTL
SPL_AC_SET_SHRINKER
SPL_AC_PATH_IN_NAMEIDATA
SPL_AC_TASK_CURR
SPL_AC_CTL_UNNUMBERED
SPL_AC_FLS64
SPL_AC_DEVICE_CREATE
SPL_AC_5ARGS_DEVICE_CREATE
SPL_AC_CLASS_DEVICE_CREATE
SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
SPL_AC_TIMESPEC_SUB
SPL_AC_INIT_UTSNAME
SPL_AC_FDTABLE_HEADER
SPL_AC_FILES_FDTABLE
SPL_AC_UACCESS_HEADER
SPL_AC_KMALLOC_NODE
SPL_AC_MONOTONIC_CLOCK
SPL_AC_INODE_I_MUTEX
SPL_AC_MUTEX_LOCK_NESTED
SPL_AC_DIV64_64
SPL_AC_DIV64_U64
SPL_AC_3ARGS_ON_EACH_CPU
SPL_AC_KALLSYMS_LOOKUP_NAME
SPL_AC_GET_VMALLOC_INFO
SPL_AC_PGDAT_HELPERS
SPL_AC_FIRST_ONLINE_PGDAT
SPL_AC_NEXT_ONLINE_PGDAT
SPL_AC_NEXT_ZONE
SPL_AC_PGDAT_LIST
SPL_AC_GET_ZONE_COUNTS
SPL_AC_GLOBAL_PAGE_STATE
SPL_AC_ZONE_STAT_ITEM_FIA
SPL_AC_2ARGS_VFS_UNLINK
SPL_AC_4ARGS_VFS_RENAME
SPL_AC_CONFIG
AC_CONFIG_FILES([
Makefile
@ -95,6 +51,7 @@ AC_CONFIG_FILES([
include/Makefile
scripts/Makefile
spl.spec
spl-modules.spec
])
AC_OUTPUT

View File

@ -66,6 +66,10 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIG_KERNEL_FALSE = @CONFIG_KERNEL_FALSE@
CONFIG_KERNEL_TRUE = @CONFIG_KERNEL_TRUE@
CONFIG_USER_FALSE = @CONFIG_USER_FALSE@
CONFIG_USER_TRUE = @CONFIG_USER_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
@ -87,13 +91,13 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNELCFLAGS = @KERNELCFLAGS@
KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LICENSE = @LICENSE@
LINUX = @LINUX@
LINUX_OBJ = @LINUX_OBJ@
LINUX_SYMBOLS = @LINUX_SYMBOLS@
@ -116,6 +120,7 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SPL_CONFIG = @SPL_CONFIG@
SPL_META_ALIAS = @SPL_META_ALIAS@
SPL_META_AUTHOR = @SPL_META_AUTHOR@
SPL_META_DATA = @SPL_META_DATA@

View File

@ -79,6 +79,10 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIG_KERNEL_FALSE = @CONFIG_KERNEL_FALSE@
CONFIG_KERNEL_TRUE = @CONFIG_KERNEL_TRUE@
CONFIG_USER_FALSE = @CONFIG_USER_FALSE@
CONFIG_USER_TRUE = @CONFIG_USER_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
@ -100,13 +104,13 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNELCFLAGS = @KERNELCFLAGS@
KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LICENSE = @LICENSE@
LINUX = @LINUX@
LINUX_OBJ = @LINUX_OBJ@
LINUX_SYMBOLS = @LINUX_SYMBOLS@
@ -129,6 +133,7 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SPL_CONFIG = @SPL_CONFIG@
SPL_META_ALIAS = @SPL_META_ALIAS@
SPL_META_AUTHOR = @SPL_META_AUTHOR@
SPL_META_DATA = @SPL_META_DATA@

View File

@ -61,6 +61,10 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIG_KERNEL_FALSE = @CONFIG_KERNEL_FALSE@
CONFIG_KERNEL_TRUE = @CONFIG_KERNEL_TRUE@
CONFIG_USER_FALSE = @CONFIG_USER_FALSE@
CONFIG_USER_TRUE = @CONFIG_USER_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
@ -82,13 +86,13 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNELCFLAGS = @KERNELCFLAGS@
KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LICENSE = @LICENSE@
LINUX = @LINUX@
LINUX_OBJ = @LINUX_OBJ@
LINUX_SYMBOLS = @LINUX_SYMBOLS@
@ -111,6 +115,7 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SPL_CONFIG = @SPL_CONFIG@
SPL_META_ALIAS = @SPL_META_ALIAS@
SPL_META_AUTHOR = @SPL_META_AUTHOR@
SPL_META_DATA = @SPL_META_DATA@

171
spl-modules.spec.in Normal file
View File

@ -0,0 +1,171 @@
# The following block is used to allow the source RPM to be rebuilt
# against specific kernels. It is preferable that rpmbuild define the
# require_kver, require_kdir, require_obj constants for us, but if it does not
# not we attempt to determine the correct values based on your distro.
%{?require_kver: %define kver %{require_kver}}
%{?require_kdir: %define kdir %{require_kdir}}
%{?require_kobj: %define kobj %{require_kobj}}
# kdir: Full path to the kernel source headers
# kobj: Full path to the kernel build objects
# kver: Kernel version
# kpkg: Kernel package name
# kdevpkg: Kernel devel package name
# kverpkg: Kernel package version
# SLES*:
%if %{defined sles_version}
%if %{undefined kver}
%define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu}
%define kver %((echo X; %{__cat} %{klnk}/.kernelrelease
2>/dev/null) | tail -1)
%endif
%define kpkg kernel-%{_target_cpu}
%define kdevpkg kernel-source kernel-syms
%define kverpkg %(echo %{kver} | cut -d'-' -f1-2)
%if %{undefined kdir}
%define kdir %{_usrsrc}/linux-%{kverpkg}
%endif
%if %{undefined kobj}
%define kobj %{kdir}-obj/%{_target_cpu}/%{_target_cpu}
%endif
# CHAOS4:
%else
%if %{defined ch4}
%if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
2>/dev/null) | tail -1)
%endif
%define kpkg chaos-kernel
%define kdevpkg chaos-kernel-devel
%define kverpkg %{kver}
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
# RHEL*/Fedora:
%else
%if %{defined fedora} || %{defined rhel}
%if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
2>/dev/null) | tail -1)
%endif
%define kpkg kernel
%define kdevpkg kernel-devel
%define kverpkg %(echo %{kver} | cut -d'.' -f1-7)
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
%else
# Unsupported distro:
%if %{undefined kver}
%define kver X
%endif
%define kpkg kernel
%define kdevpkg kernel-devel
%define kverpkg %{kver}
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
%endif
%endif
%endif
# Distro agnostic:
%define name @PACKAGE@-modules
%define version @VERSION@
%define debug_package %{nil}
# The kernel version should only be appended to a binary RPM. When
# building a source RPM it must be kernel version agnostic. This means
# the source RPM must never specify a required kernel version, but the
# final RPM should be keyed to the kernel version it was built against.
%if %{defined build_src_rpm}
%define release @SPL_META_RELEASE@
%define requires %{kpkg}
%else
%define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
%define release @SPL_META_RELEASE@_%{relext}
%define requires %{kpkg} = %{kverpkg}
%endif
Summary: Solaris Porting Layer Modules
Group: Utilities/System
Name: %{name}
Version: %{version}
Release: %{release}
License: @LICENSE@
URL: git://eris.llnl.gov/spl.git
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
Source: @PACKAGE@-%{version}.tar.gz
Requires: %{requires}
BuildRequires: %{kdevpkg}
%description
The %{name} package contains kernel modules for emulating Solaris style
primatives in the linux kernel. These include, but are not limited to:
atomic, condvar, debug, error, memory, kobject, kstat, mutex, rwlock,
taskq, thread, time, and vnode APIs.
%package devel
Summary: Solaris Porting Layer Headers and Symbols
Group: Development/Libraries
Requires: %{requires}
BuildRequires: %{kdevpkg}
%description devel
The %{name}-devel package contains the header files and Module{s}.symvers
symbols needed for building additional modules which use %{name}.
%prep
%setup -n @PACKAGE@-%{version}
%build
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj} \
--with-config=kernel
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
/lib/modules/*
%files devel
%defattr(-,root,root)
%{_prefix}/src/*
%post
if [ -f /boot/System.map-%{kver} ]; then
depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
else
depmod -ae %{kver} || exit 0
fi
%postun
if [ -f /boot/System.map-%{kver} ]; then
depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
else
depmod -ae %{kver} || exit 0
fi

View File

@ -1,143 +1,25 @@
# The following block is used to allow the source RPM to be rebuilt
# against specific kernels. It is preferable that rpmbuild define the
# require_kver, require_kdir, require_obj constants for us, but if it does not
# not we attempt to determine the correct values based on your distro.
%{?require_kver: %define kver %{require_kver}}
%{?require_kdir: %define kdir %{require_kdir}}
%{?require_kobj: %define kobj %{require_kobj}}
# kdir: Full path to the kernel source headers
# kobj: Full path to the kernel build objects
# kver: Kernel version
# kpkg: Kernel package name
# kdevpkg: Kernel devel package name
# kverpkg: Kernel package version
# SLES*:
%if %{defined sles_version}
%if %{undefined kver}
%define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu}
%define kver %((echo X; %{__cat} %{klnk}/.kernelrelease
2>/dev/null) | tail -1)
%endif
%define kpkg kernel-%{_target_cpu}
%define kdevpkg kernel-source kernel-syms
%define kverpkg %(echo %{kver} | cut -d'-' -f1-2)
%if %{undefined kdir}
%define kdir %{_usrsrc}/linux-%{kverpkg}
%endif
%if %{undefined kobj}
%define kobj %{kdir}-obj/%{_target_cpu}/%{_target_cpu}
%endif
# CHAOS4:
%else
%if %{defined ch4}
%if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
2>/dev/null) | tail -1)
%endif
%define kpkg chaos-kernel
%define kdevpkg chaos-kernel-devel
%define kverpkg %{kver}
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
# RHEL*/Fedora:
%else
%if %{defined fedora} || %{defined rhel}
%if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
2>/dev/null) | tail -1)
%endif
%define kpkg kernel
%define kdevpkg kernel-devel
%define kverpkg %(echo %{kver} | cut -d'.' -f1-7)
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
%else
# Unsupported distro:
%if %{undefined kver}
%define kver X
%endif
%define kpkg kernel
%define kdevpkg kernel-devel
%define kverpkg %{kver}
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
%endif
%endif
%endif
# Distro agnostic:
%define name @PACKAGE@
%define version @VERSION@
%define release @SPL_META_RELEASE@
%define debug_package %{nil}
# The kernel version should only be appended to a binary RPM. When
# building a source RPM it must be kernel version agnostic. This means
# the source RPM must never specify a required kernel version, but the
# final RPM should be keyed to the kernel version it was built against.
%if %{defined build_src_rpm}
%define release @SPL_META_RELEASE@
%define requires %{kpkg}
%else
%define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
%define release @SPL_META_RELEASE@_%{relext}
%define requires %{kpkg} = %{kverpkg}
%endif
Summary: Solaris Porting Layer
Summary: SPL Utils
Group: Utilities/System
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
License: @LICENSE@
URL: git://eris.llnl.gov/spl.git
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
Source: %{name}-%{version}.tar.gz
Requires: %{requires}
BuildRequires: %{kdevpkg}
%description
The %{name} package contains kernel modules and support utilities for
emulating Solaris style primatives in the linux kernel. These include,
but are not limited too, atomic, condvar, debug, error, memory, kobject,
kstat, mutex, rwlock, taskq, thread, time, and vnode APIs.
%package devel
Summary: Solaris Porting Layer Headers and Symbols
Group: Development/Libraries
Requires: %{requires}
BuildRequires: %{kdevpkg}
%description devel
The %{name}-devel package contains the header files and Module{s}.symvers
symbols needed for building additional modules which use %{name}.
The %{name} package contains the support utilities for the spl.
%prep
%setup
%build
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj}
%configure --with-config=user
make
%install
@ -151,22 +33,6 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-, root, root)
%doc AUTHORS ChangeLog COPYING DISCLAIMER INSTALL
%{_sbindir}/*
/lib/modules/*
%files devel
%defattr(-,root,root)
%{_prefix}/src/*
%post
if [ -f /boot/System.map-%{kver} ]; then
depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
else
depmod -ae %{kver} || exit 0
fi
%postun
if [ -f /boot/System.map-%{kver} ]; then
depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
else
depmod -ae %{kver} || exit 0
fi