From 287b2fb117f1ce964dc79c1f694e7d473a6b9db0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 27 Jul 2010 10:19:44 -0700 Subject: Add Debian and Slackware style packaging via alien The long term fix for Debian and Slackware style packaging is to add native support for building these packages. Unfortunately, that is a large chunk of work I don't have time for right now. That said it would be nice to have at least basic packages for these distributions. As a quick short/medium term solution I've settled on using alien to convert the RPM packages to DEB or TGZ style packages. The build system has been updated with the following build targets which will first build RPM packages and then convert them as needed to the target package type: make rpm: Create .rpm packages make deb: Create .deb packages make tgz: Create .tgz packages make pkg: Create the right package type for your distribution The solution comes with lot of caveats and your mileage may vary. But basically the big limitations are that the resulting packages: 1) Will not have the correct dependency information. 2) Will not not include the kernel version in the release. 3) Will not handle all differences between distributions. But the resulting packages should be easy to install and remove from your system and take care of running 'depmod -a' and such. As I said at the top this is not the right long term solution. If any of the upstream distribution maintainers want to jump in and help do this right for their distribution I'd love the help. --- Makefile.am | 27 ++------ Makefile.in | 81 +++++++++++++++------- cmd/Makefile.in | 16 +++++ config/deb.am | 49 +++++++++++++ config/rpm.am | 37 ++++++++-- config/spl-build.m4 | 149 +++++++++++++++++++++++++++++++++++++-- config/tgz.am | 42 +++++++++++ configure | 195 +++++++++++++++++++++++++++++++++++++++++++++++----- configure.ac | 1 + include/Makefile.in | 16 +++++ lib/Makefile.in | 16 +++++ scripts/Makefile.in | 16 +++++ 12 files changed, 574 insertions(+), 71 deletions(-) create mode 100644 config/deb.am create mode 100644 config/tgz.am diff --git a/Makefile.am b/Makefile.am index 8c4fed9c8..cae511de7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ include $(top_srcdir)/config/rpm.am +include ${top_srcdir}/config/deb.am +include ${top_srcdir}/config/tgz.am if CONFIG_USER USER_DIR = lib cmd scripts @@ -9,7 +11,8 @@ endif SUBDIRS = $(USER_DIR) $(KERNEL_DIR) AUTOMAKE_OPTIONS = foreign dist-zip -EXTRA_DIST = autogen.sh spl.spec.in config/config.awk META DISCLAIMER +EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META DISCLAIMER +EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am noinst_HEADERS = spl_config.h distclean-local:: @@ -44,22 +47,6 @@ etags: tags: ctags etags -srpm-modules: - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common - -srpm-utils: - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common - -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 +pkg: @DEFAULT_PACKAGE@ +pkg-modules: @DEFAULT_PACKAGE@-modules +pkg-utils: @DEFAULT_PACKAGE@-utils diff --git a/Makefile.in b/Makefile.in index 572e88ec2..4b0e8c838 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,7 +20,7 @@ # Copyright (C) 2007 The Regents of the University of California. # Written by Brian Behlendorf . ############################################################################### -# Build targets for RPM. +# Build targets for RPM packages. ############################################################################### VPATH = @srcdir@ @@ -127,6 +127,8 @@ GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ +ALIEN = @ALIEN@ +ALIEN_VERSION = @ALIEN_VERSION@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ @@ -141,8 +143,13 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFAULT_PACKAGE = @DEFAULT_PACKAGE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DPKG = @DPKG@ +DPKGBUILD = @DPKGBUILD@ +DPKGBUILD_VERSION = @DPKGBUILD_VERSION@ +DPKG_VERSION = @DPKG_VERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -152,6 +159,11 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_ALIEN = @HAVE_ALIEN@ +HAVE_DPKG = @HAVE_DPKG@ +HAVE_DPKGBUILD = @HAVE_DPKGBUILD@ +HAVE_RPM = @HAVE_RPM@ +HAVE_RPMBUILD = @HAVE_RPMBUILD@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -189,6 +201,10 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPM = @RPM@ +RPMBUILD = @RPMBUILD@ +RPMBUILD_VERSION = @RPMBUILD_VERSION@ +RPM_VERSION = @RPM_VERSION@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -264,7 +280,9 @@ top_srcdir = @top_srcdir@ @CONFIG_KERNEL_TRUE@KERNEL_DIR = module include SUBDIRS = $(USER_DIR) $(KERNEL_DIR) AUTOMAKE_OPTIONS = foreign dist-zip -EXTRA_DIST = autogen.sh spl.spec.in config/config.awk META DISCLAIMER +EXTRA_DIST = autogen.sh spl.spec.in spl-modules.spec.in META \ + DISCLAIMER config/config.awk config/rpm.am config/deb.am \ + config/tgz.am noinst_HEADERS = spl_config.h all: spl_config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -772,13 +790,40 @@ uninstall-am: tags tags-recursive uninstall uninstall-am +srpm-modules: + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common + +srpm-utils: + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common + +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: rpm-modules rpm-utils + rpm-local: + @(if test "${HAVE_RPMBUILD}" = "no"; then \ + echo -e "\n" \ + "*** Required util ${RPMBUILD} missing. Please install the\n" \ + "*** package for your distribution which provides ${RPMBUILD},\n" \ + "*** re-run configure, and try again.\n"; \ + exit 1; \ + fi; \ 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 + 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; \ @@ -788,7 +833,7 @@ srpm-common: dist rpmbuild="$$rpmbuild" \ rpmspec="$$rpmspec" \ rpm-local || exit 1; \ - /usr/bin/rpmbuild \ + $(RPMBUILD) \ --define "_tmppath $$rpmbuild/TMP" \ --define "_topdir $$rpmbuild" \ --define "build_src_rpm 1" \ @@ -805,7 +850,7 @@ rpm-common: rpmbuild="$$rpmbuild" \ rpmspec="$$rpmspec" \ rpm-local || exit 1; \ - /usr/bin/rpmbuild \ + ${RPMBUILD} \ --define "_tmppath $$rpmbuild/TMP" \ --define "_topdir $$rpmbuild" \ --define "dist %{nil}" \ @@ -815,6 +860,8 @@ rpm-common: --nodeps --rebuild $$rpmpkg || exit 1; \ cp $$rpmbuild/RPMS/*/* . || exit 1; \ $(RM) -R $$rpmbuild +include ${top_srcdir}/config/deb.am +include ${top_srcdir}/config/tgz.am distclean-local:: -$(RM) -R autom4te*.cache @@ -846,25 +893,9 @@ etags: tags: ctags etags -srpm-modules: - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common - -srpm-utils: - $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common - -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 +pkg: @DEFAULT_PACKAGE@ +pkg-modules: @DEFAULT_PACKAGE@-modules +pkg-utils: @DEFAULT_PACKAGE@-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. diff --git a/cmd/Makefile.in b/cmd/Makefile.in index 75e5d8d2f..fa53b0b15 100644 --- a/cmd/Makefile.in +++ b/cmd/Makefile.in @@ -101,6 +101,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALIEN = @ALIEN@ +ALIEN_VERSION = @ALIEN_VERSION@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ @@ -115,8 +117,13 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFAULT_PACKAGE = @DEFAULT_PACKAGE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DPKG = @DPKG@ +DPKGBUILD = @DPKGBUILD@ +DPKGBUILD_VERSION = @DPKGBUILD_VERSION@ +DPKG_VERSION = @DPKG_VERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -126,6 +133,11 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_ALIEN = @HAVE_ALIEN@ +HAVE_DPKG = @HAVE_DPKG@ +HAVE_DPKGBUILD = @HAVE_DPKGBUILD@ +HAVE_RPM = @HAVE_RPM@ +HAVE_RPMBUILD = @HAVE_RPMBUILD@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -163,6 +175,10 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPM = @RPM@ +RPMBUILD = @RPMBUILD@ +RPMBUILD_VERSION = @RPMBUILD_VERSION@ +RPM_VERSION = @RPM_VERSION@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/config/deb.am b/config/deb.am new file mode 100644 index 000000000..766655dcf --- /dev/null +++ b/config/deb.am @@ -0,0 +1,49 @@ +############################################################################### +# Copyright (C) 2010 Lawrence Livermore National Security, LLC. +# Written by Brian Behlendorf . +############################################################################### +# Build targets for DEB packages. +# +# Long term native distro specific Debian style packaging should be added. +# In the short term RPM packages are built and converted to DEB packages +# using alien. If someone familiar with Debian style packaging were to +# update the build system to correctly build Debian style packages I would +# happily take it. Until then we will have to make due with alien. +# +############################################################################### + +deb-local: + @(if test "${HAVE_DPKGBUILD}" = "no"; then \ + echo -e "\n" \ + "*** Required util ${DPKGBUILD} missing. Please install the\n" \ + "*** package for your distribution which provides ${DPKGBUILD},\n" \ + "*** re-run configure, and try again.\n"; \ + exit 1; \ + fi; \ + if test "${HAVE_ALIEN}" = "no"; then \ + echo -e "\n" \ + "*** Required util ${ALIEN} missing. Please install the\n" \ + "*** package for your distribution which provides ${ALIEN},\n" \ + "*** re-run configure, and try again.\n"; \ + exit 1; \ + fi) + +deb-modules: deb-local rpm-modules + name=${PACKAGE}-modules; \ + version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ + release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ + arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \ + pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \ + pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \ + fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \ + $(RM) $$pkg1 $$pkg2 + +deb-utils: deb-local rpm-utils + name=${PACKAGE}; \ + version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ + arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \ + pkg1=$${name}-$${version}.$${arch}.rpm; \ + fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \ + $(RM) $$pkg1 + +deb: deb-modules deb-utils diff --git a/config/rpm.am b/config/rpm.am index 7fb95a72d..0aae42586 100644 --- a/config/rpm.am +++ b/config/rpm.am @@ -3,16 +3,43 @@ # Copyright (C) 2007 The Regents of the University of California. # Written by Brian Behlendorf . ############################################################################### -# Build targets for RPM. +# Build targets for RPM packages. ############################################################################### +srpm-modules: + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common + +srpm-utils: + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common + +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: rpm-modules rpm-utils + rpm-local: + @(if test "${HAVE_RPMBUILD}" = "no"; then \ + echo -e "\n" \ + "*** Required util ${RPMBUILD} missing. Please install the\n" \ + "*** package for your distribution which provides ${RPMBUILD},\n" \ + "*** re-run configure, and try again.\n"; \ + exit 1; \ + fi; \ 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 + 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; \ @@ -22,7 +49,7 @@ srpm-common: dist rpmbuild="$$rpmbuild" \ rpmspec="$$rpmspec" \ rpm-local || exit 1; \ - /usr/bin/rpmbuild \ + $(RPMBUILD) \ --define "_tmppath $$rpmbuild/TMP" \ --define "_topdir $$rpmbuild" \ --define "build_src_rpm 1" \ @@ -39,7 +66,7 @@ rpm-common: rpmbuild="$$rpmbuild" \ rpmspec="$$rpmspec" \ rpm-local || exit 1; \ - /usr/bin/rpmbuild \ + ${RPMBUILD} \ --define "_tmppath $$rpmbuild/TMP" \ --define "_topdir $$rpmbuild" \ --define "dist %{nil}" \ diff --git a/config/spl-build.m4 b/config/spl-build.m4 index b908a56d5..a11d8866d 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -188,12 +188,11 @@ AC_DEFUN([SPL_AC_KERNEL], [ ]) dnl # -dnl # Default SPL user configuration +dnl # Explicitly check for gawk, we require it for the the usermode +dnl # helper. For some reason the standard awk command does not +dnl # behave correctly when invoked from the usermode helper. dnl # -AC_DEFUN([SPL_AC_CONFIG_USER], [ - dnl # Explicitly check for gawk, we require it for the the usermode - dnl # helper. For some reason the standard awk command does not - dnl # behave correctly when invoked from the usermode helper. +AC_DEFUN([SPL_AC_GAWK], [ AS_IF([test "x$AWK" != xgawk], [ AC_MSG_ERROR([ *** Required util gawk missing. Please install the required @@ -201,6 +200,146 @@ AC_DEFUN([SPL_AC_CONFIG_USER], [ ]) ]) +dnl # +dnl # Default SPL user configuration +dnl # +AC_DEFUN([SPL_AC_CONFIG_USER], [ + SPL_AC_GAWK +]) + +dnl # +dnl # Check for rpm+rpmbuild to build RPM packages. If these tools +dnl # are missing it is non-fatal but you will not be able to build +dnl # RPM packages and will be warned if you try too. +dnl # +AC_DEFUN([SPL_AC_RPM], [ + RPM=rpm + RPMBUILD=rpmbuild + + AC_MSG_CHECKING([whether $RPM is available]) + AS_IF([tmp=$($RPM --version 2>/dev/null)], [ + RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') + HAVE_RPM=yes + AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) + ],[ + HAVE_RPM=no + AC_MSG_RESULT([$HAVE_RPM]) + ]) + + AC_MSG_CHECKING([whether $RPMBUILD is available]) + AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ + RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') + HAVE_RPMBUILD=yes + AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) + ],[ + HAVE_RPMBUILD=no + AC_MSG_RESULT([$HAVE_RPMBUILD]) + ]) + + AC_SUBST(HAVE_RPM) + AC_SUBST(RPM) + AC_SUBST(RPM_VERSION) + + AC_SUBST(HAVE_RPMBUILD) + AC_SUBST(RPMBUILD) + AC_SUBST(RPMBUILD_VERSION) +]) + +dnl # +dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these +dnl # tools are missing it is non-fatal but you will not be able to build +dnl # DEB packages and will be warned if you try too. +dnl # +AC_DEFUN([SPL_AC_DPKG], [ + DPKG=dpkg + DPKGBUILD=dpkg-buildpackage + + AC_MSG_CHECKING([whether $DPKG is available]) + AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ + DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') + HAVE_DPKG=yes + AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) + ],[ + HAVE_DPKG=no + AC_MSG_RESULT([$HAVE_DPKG]) + ]) + + AC_MSG_CHECKING([whether $DPKGBUILD is available]) + AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ + DPKGBUILD_VERSION=$(echo $tmp | \ + $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') + HAVE_DPKGBUILD=yes + AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) + ],[ + HAVE_DPKGBUILD=no + AC_MSG_RESULT([$HAVE_DPKGBUILD]) + ]) + + AC_SUBST(HAVE_DPKG) + AC_SUBST(DPKG) + AC_SUBST(DPKG_VERSION) + + AC_SUBST(HAVE_DPKGBUILD) + AC_SUBST(DPKGBUILD) + AC_SUBST(DPKGBUILD_VERSION) +]) + +dnl # +dnl # Until native packaging for various different packing systems +dnl # can be added the least we can do is attempt to use alien to +dnl # convert the RPM packages to the needed package type. This is +dnl # a hack but so far it has worked reasonable well. +dnl # +AC_DEFUN([SPL_AC_ALIEN], [ + ALIEN=alien + + AC_MSG_CHECKING([whether $ALIEN is available]) + AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ + ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') + HAVE_ALIEN=yes + AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) + ],[ + HAVE_ALIEN=no + AC_MSG_RESULT([$HAVE_ALIEN]) + ]) + + AC_SUBST(HAVE_ALIEN) + AC_SUBST(ALIEN) + AC_SUBST(ALIEN_VERSION) +]) + +dnl # +dnl # Using the VENDOR tag from config.guess set the default +dnl # package type for 'make pkg': (rpm | deb | tgz) +dnl # +AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [ + VENDOR=$(echo $ac_build_alias | cut -f2 -d'-') + + AC_MSG_CHECKING([default package type]) + case "$VENDOR" in + fedora) DEFAULT_PACKAGE=rpm ;; + redhat) DEFAULT_PACKAGE=rpm ;; + sles) DEFAULT_PACKAGE=rpm ;; + ubuntu) DEFAULT_PACKAGE=deb ;; + debian) DEFAULT_PACKAGE=deb ;; + slackware) DEFAULT_PACKAGE=tgz ;; + *) DEFAULT_PACKAGE=rpm ;; + esac + + AC_MSG_RESULT([$DEFAULT_PACKAGE]) + AC_SUBST(DEFAULT_PACKAGE) +]) + +dnl # +dnl # Default SPL user configuration +dnl # +AC_DEFUN([SPL_AC_PACKAGE], [ + SPL_AC_RPM + SPL_AC_DPKG + SPL_AC_ALIEN + SPL_AC_DEFAULT_PACKAGE +]) + AC_DEFUN([SPL_AC_LICENSE], [ AC_MSG_CHECKING([spl license]) LICENSE=GPL diff --git a/config/tgz.am b/config/tgz.am new file mode 100644 index 000000000..57d2eee3b --- /dev/null +++ b/config/tgz.am @@ -0,0 +1,42 @@ +############################################################################### +# Copyright (C) 2010 Lawrence Livermore National Security, LLC. +# Written by Brian Behlendorf . +############################################################################### +# Build targets for TGZ packages. +# +# Long term native distro specific Slackware style packaging should be added. +# In the short term RPM packages are built and converted to TGZ packages +# using alien. If someone familiar with Slackware style packaging were to +# update the build system to correctly build Slackware style packages I would +# happily take it. Until then we will have to make due with alien. +# +############################################################################### + +tgz-local: + @(if test "${HAVE_ALIEN}" = "no"; then \ + echo -e "\n" \ + "*** Required util ${ALIEN} missing. Please install the\n" \ + "*** package for your distribution which provides ${ALIEN},\n" \ + "*** re-run configure, and try again.\n"; \ + exit 1; \ + fi) + +tgz-modules: tgz-local rpm-modules + name=${PACKAGE}-modules; \ + version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ + release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \ + arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \ + pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \ + pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \ + fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \ + $(RM) $$pkg1 $$pkg2 + +tgz-utils: tgz-local rpm-utils + name=${PACKAGE}; \ + version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \ + arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \ + pkg1=$${name}-$${version}.$${arch}.rpm; \ + fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \ + $(RM) $$pkg1 + +tgz: tgz-modules tgz-utils diff --git a/configure b/configure index 656f0425a..4a24a41f5 100755 --- a/configure +++ b/configure @@ -799,6 +799,22 @@ LINUX_VERSION LINUX_OBJ LINUX SPL_CONFIG +DEFAULT_PACKAGE +ALIEN_VERSION +ALIEN +HAVE_ALIEN +DPKGBUILD_VERSION +DPKGBUILD +HAVE_DPKGBUILD +DPKG_VERSION +DPKG +HAVE_DPKG +RPMBUILD_VERSION +RPMBUILD +HAVE_RPMBUILD +RPM_VERSION +RPM +HAVE_RPM LICENSE CPP OTOOL64 @@ -4760,13 +4776,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4763: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4779: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4766: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4782: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4769: output\"" >&5) + (eval echo "\"\$as_me:4785: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5972,7 +5988,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5975 "configure"' > conftest.$ac_ext + echo '#line 5991 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7825,11 +7841,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7828: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7844: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7832: \$? = $ac_status" >&5 + echo "$as_me:7848: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8164,11 +8180,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8167: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8183: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8171: \$? = $ac_status" >&5 + echo "$as_me:8187: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8269,11 +8285,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8272: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8288: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8276: \$? = $ac_status" >&5 + echo "$as_me:8292: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8324,11 +8340,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8327: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8343: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8331: \$? = $ac_status" >&5 + echo "$as_me:8347: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11127,7 +11143,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11130 "configure" +#line 11146 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11223,7 +11239,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11226 "configure" +#line 11242 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11461,6 +11477,149 @@ $as_echo "$LICENSE" >&6; } + + RPM=rpm + RPMBUILD=rpmbuild + + { $as_echo "$as_me:$LINENO: checking whether $RPM is available" >&5 +$as_echo_n "checking whether $RPM is available... " >&6; } + if tmp=$($RPM --version 2>/dev/null); then + + RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $3 }') + HAVE_RPM=yes + { $as_echo "$as_me:$LINENO: result: $HAVE_RPM ($RPM_VERSION)" >&5 +$as_echo "$HAVE_RPM ($RPM_VERSION)" >&6; } + +else + + HAVE_RPM=no + { $as_echo "$as_me:$LINENO: result: $HAVE_RPM" >&5 +$as_echo "$HAVE_RPM" >&6; } + +fi + + + { $as_echo "$as_me:$LINENO: checking whether $RPMBUILD is available" >&5 +$as_echo_n "checking whether $RPMBUILD is available... " >&6; } + if tmp=$($RPMBUILD --version 2>/dev/null); then + + RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $3 }') + HAVE_RPMBUILD=yes + { $as_echo "$as_me:$LINENO: result: $HAVE_RPMBUILD ($RPMBUILD_VERSION)" >&5 +$as_echo "$HAVE_RPMBUILD ($RPMBUILD_VERSION)" >&6; } + +else + + HAVE_RPMBUILD=no + { $as_echo "$as_me:$LINENO: result: $HAVE_RPMBUILD" >&5 +$as_echo "$HAVE_RPMBUILD" >&6; } + +fi + + + + + + + + + + + + DPKG=dpkg + DPKGBUILD=dpkg-buildpackage + + { $as_echo "$as_me:$LINENO: checking whether $DPKG is available" >&5 +$as_echo_n "checking whether $DPKG is available... " >&6; } + if tmp=$($DPKG --version 2>/dev/null); then + + DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $7 }') + HAVE_DPKG=yes + { $as_echo "$as_me:$LINENO: result: $HAVE_DPKG ($DPKG_VERSION)" >&5 +$as_echo "$HAVE_DPKG ($DPKG_VERSION)" >&6; } + +else + + HAVE_DPKG=no + { $as_echo "$as_me:$LINENO: result: $HAVE_DPKG" >&5 +$as_echo "$HAVE_DPKG" >&6; } + +fi + + + { $as_echo "$as_me:$LINENO: checking whether $DPKGBUILD is available" >&5 +$as_echo_n "checking whether $DPKGBUILD is available... " >&6; } + if tmp=$($DPKGBUILD --version 2>/dev/null); then + + DPKGBUILD_VERSION=$(echo $tmp | \ + $AWK '/Debian/ { print $4 }' | cut -f-4 -d'.') + HAVE_DPKGBUILD=yes + { $as_echo "$as_me:$LINENO: result: $HAVE_DPKGBUILD ($DPKGBUILD_VERSION)" >&5 +$as_echo "$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)" >&6; } + +else + + HAVE_DPKGBUILD=no + { $as_echo "$as_me:$LINENO: result: $HAVE_DPKGBUILD" >&5 +$as_echo "$HAVE_DPKGBUILD" >&6; } + +fi + + + + + + + + + + + + ALIEN=alien + + { $as_echo "$as_me:$LINENO: checking whether $ALIEN is available" >&5 +$as_echo_n "checking whether $ALIEN is available... " >&6; } + if tmp=$($ALIEN --version 2>/dev/null); then + + ALIEN_VERSION=$(echo $tmp | $AWK '{ print $3 }') + HAVE_ALIEN=yes + { $as_echo "$as_me:$LINENO: result: $HAVE_ALIEN ($ALIEN_VERSION)" >&5 +$as_echo "$HAVE_ALIEN ($ALIEN_VERSION)" >&6; } + +else + + HAVE_ALIEN=no + { $as_echo "$as_me:$LINENO: result: $HAVE_ALIEN" >&5 +$as_echo "$HAVE_ALIEN" >&6; } + +fi + + + + + + + + VENDOR=$(echo $ac_build_alias | cut -f2 -d'-') + + { $as_echo "$as_me:$LINENO: checking default package type" >&5 +$as_echo_n "checking default package type... " >&6; } + case "$VENDOR" in + fedora) DEFAULT_PACKAGE=rpm ;; + redhat) DEFAULT_PACKAGE=rpm ;; + sles) DEFAULT_PACKAGE=rpm ;; + ubuntu) DEFAULT_PACKAGE=deb ;; + debian) DEFAULT_PACKAGE=deb ;; + slackware) DEFAULT_PACKAGE=tgz ;; + *) DEFAULT_PACKAGE=rpm ;; + esac + + { $as_echo "$as_me:$LINENO: result: $DEFAULT_PACKAGE" >&5 +$as_echo "$DEFAULT_PACKAGE" >&6; } + + + + SPL_CONFIG=all # Check whether --with-config was given. @@ -14972,7 +15131,8 @@ fi ;; user) - if test "x$AWK" != xgawk; then + + if test "x$AWK" != xgawk; then { { $as_echo "$as_me:$LINENO: error: *** Required util gawk missing. Please install the required @@ -14984,6 +15144,7 @@ $as_echo "$as_me: error: fi + ;; all) @@ -18481,7 +18642,8 @@ fi - if test "x$AWK" != xgawk; then + + if test "x$AWK" != xgawk; then { { $as_echo "$as_me:$LINENO: error: *** Required util gawk missing. Please install the required @@ -18493,6 +18655,7 @@ $as_echo "$as_me: error: fi + ;; srpm) ;; *) diff --git a/configure.ac b/configure.ac index 0217e9cd9..562d03657 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,7 @@ AC_PROG_CC AC_PROG_LIBTOOL SPL_AC_LICENSE +SPL_AC_PACKAGE SPL_AC_CONFIG AC_CONFIG_FILES([ diff --git a/include/Makefile.in b/include/Makefile.in index 21ce72f8e..cdbeff05f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -60,6 +60,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALIEN = @ALIEN@ +ALIEN_VERSION = @ALIEN_VERSION@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ @@ -74,8 +76,13 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFAULT_PACKAGE = @DEFAULT_PACKAGE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DPKG = @DPKG@ +DPKGBUILD = @DPKGBUILD@ +DPKGBUILD_VERSION = @DPKGBUILD_VERSION@ +DPKG_VERSION = @DPKG_VERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -85,6 +92,11 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_ALIEN = @HAVE_ALIEN@ +HAVE_DPKG = @HAVE_DPKG@ +HAVE_DPKGBUILD = @HAVE_DPKGBUILD@ +HAVE_RPM = @HAVE_RPM@ +HAVE_RPMBUILD = @HAVE_RPMBUILD@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -122,6 +134,10 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPM = @RPM@ +RPMBUILD = @RPMBUILD@ +RPMBUILD_VERSION = @RPMBUILD_VERSION@ +RPM_VERSION = @RPM_VERSION@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/lib/Makefile.in b/lib/Makefile.in index eb2e83134..7860a1592 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -93,6 +93,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALIEN = @ALIEN@ +ALIEN_VERSION = @ALIEN_VERSION@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ @@ -107,8 +109,13 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFAULT_PACKAGE = @DEFAULT_PACKAGE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DPKG = @DPKG@ +DPKGBUILD = @DPKGBUILD@ +DPKGBUILD_VERSION = @DPKGBUILD_VERSION@ +DPKG_VERSION = @DPKG_VERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -118,6 +125,11 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_ALIEN = @HAVE_ALIEN@ +HAVE_DPKG = @HAVE_DPKG@ +HAVE_DPKGBUILD = @HAVE_DPKGBUILD@ +HAVE_RPM = @HAVE_RPM@ +HAVE_RPMBUILD = @HAVE_RPMBUILD@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -155,6 +167,10 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPM = @RPM@ +RPMBUILD = @RPMBUILD@ +RPMBUILD_VERSION = @RPMBUILD_VERSION@ +RPM_VERSION = @RPM_VERSION@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 64e414acb..4e2f8150e 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -55,6 +55,8 @@ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALIEN = @ALIEN@ +ALIEN_VERSION = @ALIEN_VERSION@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ @@ -69,8 +71,13 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFAULT_PACKAGE = @DEFAULT_PACKAGE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DPKG = @DPKG@ +DPKGBUILD = @DPKGBUILD@ +DPKGBUILD_VERSION = @DPKGBUILD_VERSION@ +DPKG_VERSION = @DPKG_VERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -80,6 +87,11 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HAVE_ALIEN = @HAVE_ALIEN@ +HAVE_DPKG = @HAVE_DPKG@ +HAVE_DPKGBUILD = @HAVE_DPKGBUILD@ +HAVE_RPM = @HAVE_RPM@ +HAVE_RPMBUILD = @HAVE_RPMBUILD@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -117,6 +129,10 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPM = @RPM@ +RPMBUILD = @RPMBUILD@ +RPMBUILD_VERSION = @RPMBUILD_VERSION@ +RPM_VERSION = @RPM_VERSION@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -- cgit v1.2.3