From c8e569dd1c5c7fdeae0ad8ab149388896bcf5567 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 10 Mar 2009 21:13:30 -0700 Subject: [PATCH] Build system and packaging (RPM support) (Part 2) Complete support for dist install srpm and rpm make targets. --- Makefile.am | 5 +-- config/zfs-meta.m4 | 11 ++++++ configure.ac | 12 +------ lib/libzpool/Makefile.am | 1 + lib/libzpool/include/Makefile.am | 1 + module/Makefile.in | 37 +++++++++++++++----- module/avl/Makefile.in | 3 -- module/avl/include/Makefile.in | 1 - module/avl/include/sys/Makefile.in | 1 - module/nvpair/Makefile.in | 3 -- module/nvpair/include/Makefile.in | 2 -- module/nvpair/include/sys/Makefile.in | 1 - module/unicode/Makefile.in | 3 -- module/unicode/include/Makefile.in | 1 - module/unicode/include/sys/Makefile.in | 1 - module/zcommon/Makefile.in | 3 -- module/zcommon/include/Makefile.in | 2 -- module/zcommon/include/sys/Makefile.in | 14 -------- module/zcommon/include/sys/fm/Makefile.in | 1 - module/zcommon/include/sys/fm/fs/Makefile.in | 1 - module/zcommon/include/sys/fs/Makefile.in | 1 - module/zfs/Makefile.in | 2 -- zfs.spec.in | 3 +- 23 files changed, 48 insertions(+), 62 deletions(-) create mode 100644 lib/libzpool/include/Makefile.am delete mode 100644 module/avl/include/Makefile.in delete mode 100644 module/avl/include/sys/Makefile.in delete mode 100644 module/nvpair/include/Makefile.in delete mode 100644 module/nvpair/include/sys/Makefile.in delete mode 100644 module/unicode/include/Makefile.in delete mode 100644 module/unicode/include/sys/Makefile.in delete mode 100644 module/zcommon/include/Makefile.in delete mode 100644 module/zcommon/include/sys/Makefile.in delete mode 100644 module/zcommon/include/sys/fm/Makefile.in delete mode 100644 module/zcommon/include/sys/fm/fs/Makefile.in delete mode 100644 module/zcommon/include/sys/fs/Makefile.in diff --git a/Makefile.am b/Makefile.am index ad729f7311..c685f0db55 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,6 @@ SUBDIRS = config doc scripts lib cmd module AUTOMAKE_OPTIONS = foreign dist-zip EXTRA_DIST = autogen.sh zfs.spec.in META DISCLAIMER GIT EXTRA_DIST += OPENSOLARIS.LICENSE ZFS.RELEASE -include_HEADERS = zfs_config.h distclean-local:: -$(RM) -R autom4te*.cache @@ -18,7 +17,9 @@ distclean-local:: -type f -print | xargs $(RM) install-data-local: - $(INSTALL) module/Module.symvers $(DESTDIR)/$(includedir) + /bin/mkdir -p $(DESTDIR)/$(LINUX)/include/zfs + $(INSTALL) module/Module.symvers $(DESTDIR)/$(LINUX)/include/zfs + $(INSTALL) zfs_config.h $(DESTDIR)/$(LINUX)/include/zfs ctags: $(RM) $(top_srcdir)/tags diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4 index 7ec44a3fc3..393ced0dbe 100644 --- a/config/zfs-meta.m4 +++ b/config/zfs-meta.m4 @@ -6,6 +6,17 @@ dnl # AUTHOR: dnl # Chris Dunlap dnl # AC_DEFUN([ZFS_AC_META], [ + + AH_BOTTOM([ +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef STDC_HEADERS +#undef VERSION]) + AC_MSG_CHECKING([metadata]) META="$srcdir/META" diff --git a/configure.ac b/configure.ac index b05d31a1b8..2db261a21c 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ AC_CONFIG_FILES([ lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile + lib/libzpool/include/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile @@ -69,20 +70,9 @@ AC_CONFIG_FILES([ cmd/ztest/Makefile module/Makefile module/avl/Makefile - module/avl/include/Makefile - module/avl/include/sys/Makefile module/nvpair/Makefile - module/nvpair/include/Makefile - module/nvpair/include/sys/Makefile module/unicode/Makefile - module/unicode/include/Makefile - module/unicode/include/sys/Makefile module/zcommon/Makefile - module/zcommon/include/Makefile - module/zcommon/include/sys/Makefile - module/zcommon/include/sys/fs/Makefile - module/zcommon/include/sys/fm/Makefile - module/zcommon/include/sys/fm/fs/Makefile module/zfs/Makefile scripts/Makefile scripts/zpool-config/Makefile diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index c5be7f3418..e436c20ddd 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -1,5 +1,6 @@ include $(top_srcdir)/config/Rules.am +SUBDIRS = include DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libzpool/include \ -I${top_srcdir}/lib/libspl/include \ diff --git a/lib/libzpool/include/Makefile.am b/lib/libzpool/include/Makefile.am new file mode 100644 index 0000000000..71f0eaa8e5 --- /dev/null +++ b/lib/libzpool/include/Makefile.am @@ -0,0 +1 @@ +noinst_HEADERS = sys/*.h diff --git a/module/Makefile.in b/module/Makefile.in index d470487a9a..993b7fc3e9 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -1,13 +1,34 @@ -subdir-m = avl nvpair unicode zcommon zfs +subdir-m += avl +subdir-m += nvpair +subdir-m += unicode +subdir-m += zcommon +subdir-m += zfs +subdir-m += zpios -# Make the exported SPL symbols available to these modules. -# Unfortunately there is not a cleaner way to do this, modpost -# does not contain an option to search additional symbol files. -all: +modules clean: + # Make the exported SPL symbols available to these modules. cp @splsymvers@ . - $(MAKE) -C @LINUX@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ modules - -install uninstall clean distclean maintainer-clean distdir: $(MAKE) -C @LINUX@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@ +modules_install: + $(MAKE) -C @LINUX@ SUBDIRS=`pwd` INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=addon $@ + # Install the required headers in to the kernel source + (mkdir -p $(DESTDIR)/@LINUX@/include/zfs && \ + find . -mindepth 3 -maxdepth 3 -name '*.h' | \ + xargs cp -t $(DESTDIR)/@LINUX@/include/zfs) || exit 1; \ + (mkdir -p $(DESTDIR)/@LINUX@/include/zfs/sys && \ + find . -mindepth 4 -maxdepth 4 -name '*.h' | \ + xargs cp -t $(DESTDIR)/@LINUX@/include/zfs/sys) || exit 1; + +distdir: + distfiles=`find . -name '*.c' -o -name '*.h'`; \ + for distfile in $$distfiles; do \ + distpath=`dirname $$distdir/$$distfile`; \ + (/bin/mkdir -p $$distpath && \ + /bin/cp $$distfile $$distdir/$$distfile) || exit 1; \ + done + +distclean maintainer-clean: clean +install: modules_install +all: modules check: diff --git a/module/avl/Makefile.in b/module/avl/Makefile.in index 086556c637..941de20f4c 100644 --- a/module/avl/Makefile.in +++ b/module/avl/Makefile.in @@ -1,6 +1,3 @@ -subdir-m += include -DISTFILES = *.c - MODULE := zavl EXTRA_CFLAGS = -I@MODDIR@/avl/include diff --git a/module/avl/include/Makefile.in b/module/avl/include/Makefile.in deleted file mode 100644 index 6611e4143d..0000000000 --- a/module/avl/include/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -subdir-m += sys diff --git a/module/avl/include/sys/Makefile.in b/module/avl/include/sys/Makefile.in deleted file mode 100644 index 8149c3861f..0000000000 --- a/module/avl/include/sys/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -DISTFILES = avl.h avl_impl.h diff --git a/module/nvpair/Makefile.in b/module/nvpair/Makefile.in index 29aaa327ca..acd9ac4f99 100644 --- a/module/nvpair/Makefile.in +++ b/module/nvpair/Makefile.in @@ -1,6 +1,3 @@ -subdir-m += include -DISTFILES = *.c - MODULE := znvpair EXTRA_CFLAGS = -I@MODDIR@/nvpair/include diff --git a/module/nvpair/include/Makefile.in b/module/nvpair/include/Makefile.in deleted file mode 100644 index d92f7114c6..0000000000 --- a/module/nvpair/include/Makefile.in +++ /dev/null @@ -1,2 +0,0 @@ -subdir-m += sys -DISTFILES = libnvpair.h diff --git a/module/nvpair/include/sys/Makefile.in b/module/nvpair/include/sys/Makefile.in deleted file mode 100644 index 4f970cea58..0000000000 --- a/module/nvpair/include/sys/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -DISTFILES = nvpair.h nvpair_impl.h diff --git a/module/unicode/Makefile.in b/module/unicode/Makefile.in index 42caf08a6b..1a78fe0b59 100644 --- a/module/unicode/Makefile.in +++ b/module/unicode/Makefile.in @@ -1,6 +1,3 @@ -subdir-m += include -DISTFILES = *.c - MODULE := zunicode EXTRA_CFLAGS = -I@MODDIR@/unicode/include diff --git a/module/unicode/include/Makefile.in b/module/unicode/include/Makefile.in deleted file mode 100644 index 6611e4143d..0000000000 --- a/module/unicode/include/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -subdir-m += sys diff --git a/module/unicode/include/sys/Makefile.in b/module/unicode/include/sys/Makefile.in deleted file mode 100644 index fb0057c0dd..0000000000 --- a/module/unicode/include/sys/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -DISTFILES = u8_textprep.h u8_textprep_data.h diff --git a/module/zcommon/Makefile.in b/module/zcommon/Makefile.in index 802543f8da..58e2591f60 100644 --- a/module/zcommon/Makefile.in +++ b/module/zcommon/Makefile.in @@ -1,6 +1,3 @@ -subdir-m += include -DISTFILES = *.c - MODULE := zcommon EXTRA_CFLAGS = -I@MODDIR@/avl/include diff --git a/module/zcommon/include/Makefile.in b/module/zcommon/include/Makefile.in deleted file mode 100644 index 69ab6afa2e..0000000000 --- a/module/zcommon/include/Makefile.in +++ /dev/null @@ -1,2 +0,0 @@ -subdir-m += sys -DISTFILES = zfs_comutil.h zfs_deleg.h zfs_namecheck.h zfs_prop.h diff --git a/module/zcommon/include/sys/Makefile.in b/module/zcommon/include/sys/Makefile.in deleted file mode 100644 index e73a05fcec..0000000000 --- a/module/zcommon/include/sys/Makefile.in +++ /dev/null @@ -1,14 +0,0 @@ -subdir-m += fm fs - -DISTFILES = arc.h bplist.h compress.h dbuf.h dmu.h dmu_impl.h -DISTFILES += dmu_objset.h dmu_traverse.h dmu_tx.h dmu_zfetch.h -DISTFILES += dnode.h dsl_dataset.h dsl_deleg.h dsl_dir.h dsl_pool.h -DISTFILES += dsl_prop.h dsl_synctask.h list.h list_impl.h metaslab.h -DISTFILES += metaslab_impl.h refcount.h rprwlock.h rrwlock.h spa.h -DISTFILES += spa_boot.h spa_impl.h space_map.h txg.h txg_impl.h uberblock.h -DISTFILES += uberblock_impl.h unique.h vdev.h vdev_disk.h vdev_file.h -DISTFILES += vdev_impl.h zap.h zap_impl.h zap_leaf.h zfs_acl.h -DISTFILES += zfs_context.h zfs_context_user.h zfs_ctldir.h zfs_debug.h -DISTFILES += zfs_dir.h zfs_fuid.h zfs_i18n.h zfs_ioctl.h zfs_rlock.h -DISTFILES += zfs_vfsops.h zfs_znode.h zil.h zil_impl.h zio.h -DISTFILES += zio_checksum.h zio_compress.h zio_impl.h zvol.h diff --git a/module/zcommon/include/sys/fm/Makefile.in b/module/zcommon/include/sys/fm/Makefile.in deleted file mode 100644 index 0a4dc0223e..0000000000 --- a/module/zcommon/include/sys/fm/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -subdir-m += fs diff --git a/module/zcommon/include/sys/fm/fs/Makefile.in b/module/zcommon/include/sys/fm/fs/Makefile.in deleted file mode 100644 index cbfbe3c671..0000000000 --- a/module/zcommon/include/sys/fm/fs/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -DISTFILES = zfs.h diff --git a/module/zcommon/include/sys/fs/Makefile.in b/module/zcommon/include/sys/fs/Makefile.in deleted file mode 100644 index cbfbe3c671..0000000000 --- a/module/zcommon/include/sys/fs/Makefile.in +++ /dev/null @@ -1 +0,0 @@ -DISTFILES = zfs.h diff --git a/module/zfs/Makefile.in b/module/zfs/Makefile.in index 08733a2ad8..2bde8a89a0 100644 --- a/module/zfs/Makefile.in +++ b/module/zfs/Makefile.in @@ -1,5 +1,3 @@ -DISTFILES = *.c - MODULE := zfs EXTRA_CFLAGS = -I@MODDIR@/zfs/include diff --git a/zfs.spec.in b/zfs.spec.in index f4e598c127..db486693fa 100644 --- a/zfs.spec.in +++ b/zfs.spec.in @@ -73,7 +73,7 @@ symbols needed for building additional modules which use %{name}. %prep %setup %build -%configure --includedir=%{kdir}/include/zfs --with-linux=%{kdir} +%configure --with-linux=%{kdir} --with-spl=%{kdir}/include/spl make %install @@ -88,6 +88,7 @@ rm -rf $RPM_BUILD_ROOT %doc AUTHORS ChangeLog COPYING COPYRIGHT DISCLAIMER GIT %doc OPENSOLARIS.LICENSE README TODO ZFS.RELEASE %{_sbindir}/* +%{_libdir}/* /lib/modules/* %files devel