Skip to content

Commit

Permalink
Add build system
Browse files Browse the repository at this point in the history
Add autoconf style build infrastructure to the ZFS tree.  This
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
and makefiles for all the core ZFS components.
  • Loading branch information
behlendorf committed Aug 31, 2010
1 parent 40b84e7 commit c9c0d07
Show file tree
Hide file tree
Showing 108 changed files with 5,853 additions and 0 deletions.
576 changes: 576 additions & 0 deletions ChangeLog

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions META
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Meta: 1
Name: zfs
Branch: 1.0
Version: 0.5.0
Release: 1
Release-Tags: relext
License: CDDL
Author: Sun Microsystems/Oracle, Lawrence Livermore National Laboratory
56 changes: 56 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
include $(top_srcdir)/config/rpm.am
include ${top_srcdir}/config/deb.am
include ${top_srcdir}/config/tgz.am

if CONFIG_USER
USER_DIR = config etc man scripts lib cmd
endif
if CONFIG_KERNEL
KERNEL_DIR = module
endif
SUBDIRS = $(USER_DIR) $(KERNEL_DIR)

AUTOMAKE_OPTIONS = foreign dist-zip
EXTRA_DIST = autogen.sh zfs.spec.in zfs-modules.spec.in
EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
EXTRA_DIST += META DISCLAIMER COPYRIGHT GIT README.markdown
EXTRA_DIST += OPENSOLARIS.LICENSE ZFS.RELEASE

noinst_HEADERS = zfs_config.h

distclean-local::
-$(RM) -R autom4te*.cache
-find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
-o -name .pc -o -name .hg -o -name .git \) -prune -o \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -name 'aclocal.m4' -o -size 0 \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \
-o -name 'Makefile' -o -name 'Module.symvers' \
-o -name '*.order' -o -name '*.markers' \
-o -name '.script-config' \) \
-type f -print | xargs $(RM)

if CONFIG_KERNEL
install-data-local:
destname=zfs-$(ZFS_META_VERSION)/$(LINUX_VERSION); \
instdest=$(DESTDIR)/usr/src/$$destname; \
echo "${ZFS_META_VERSION}" >$$instdest/zfs.release; \
for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
done
endif

ctags:
$(RM) $(top_srcdir)/tags
find $(top_srcdir) -name .git -prune -o -name '*.[hc]' | xargs ctags

etags:
$(RM) $(top_srcdir)/TAGS
find $(top_srcdir) -name .pc -prune -o -name '*.[hc]' | xargs etags -a

tags: ctags etags

pkg: @DEFAULT_PACKAGE@
pkg-modules: @DEFAULT_PACKAGE@-modules
pkg-utils: @DEFAULT_PACKAGE@-utils
8 changes: 8 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

aclocal -I config &&
libtoolize --automake --copy
autoheader &&
automake --add-missing --include-deps --copy
autoconf
rm -rf autom4te.cache aclocal.m4
1 change: 1 addition & 0 deletions cmd/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = zfs zpool zpool_id zpool_layout zdb zinject ztest
31 changes: 31 additions & 0 deletions cmd/zdb/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
include $(top_srcdir)/config/Rules.am

DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libzpool/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include

sbin_PROGRAMS = zdb

zdb_SOURCES = \
${top_srcdir}/cmd/zdb/zdb.c \
${top_srcdir}/cmd/zdb/zdb_il.c

zdb_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la

zdb_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
32 changes: 32 additions & 0 deletions cmd/zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include $(top_srcdir)/config/Rules.am

DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include

sbin_PROGRAMS = zfs

zfs_SOURCES = \
${top_srcdir}/cmd/zfs/zfs_iter.c \
${top_srcdir}/cmd/zfs/zfs_iter.h \
${top_srcdir}/cmd/zfs/zfs_main.c \
${top_srcdir}/cmd/zfs/zfs_util.h

zfs_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la

zfs_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
34 changes: 34 additions & 0 deletions cmd/zinject/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
include $(top_srcdir)/config/Rules.am

DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libzpool/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zfs \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include

sbin_PROGRAMS = zinject

zinject_SOURCES = \
${top_srcdir}/cmd/zinject/translate.c \
${top_srcdir}/cmd/zinject/zinject.c \
${top_srcdir}/cmd/zinject/zinject.h

zinject_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la

zinject_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
34 changes: 34 additions & 0 deletions cmd/zpool/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
include $(top_srcdir)/config/Rules.am

DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include

sbin_PROGRAMS = zpool

zpool_SOURCES = \
${top_srcdir}/cmd/zpool/zpool_iter.c \
${top_srcdir}/cmd/zpool/zpool_main.c \
${top_srcdir}/cmd/zpool/zpool_util.c \
${top_srcdir}/cmd/zpool/zpool_util.h \
${top_srcdir}/cmd/zpool/zpool_vdev.c

zpool_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libzfs/libzfs.la

zpool_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) $(LIBBLKID)
1 change: 1 addition & 0 deletions cmd/zpool_id/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist_bin_SCRIPTS = zpool_id
60 changes: 60 additions & 0 deletions cmd/zpool_id/zpool_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

CONFIG=${CONFIG:-/etc/zfs/zdev.conf}
PATH_ID=${PATH_ID:-/lib/udev/path_id}
AWK=${AWK:-/bin/awk}

die() {
echo "Error: $*"
exit 1
}

usage() {
cat << EOF
Usage: zpool_id [h] [-c configfile] <devpath>
-c Alternate config file [default /etc/zfs/zdev.conf]
-d Use path_id from device as the mapping key
-h Show this message
EOF
exit 1
}

while getopts 'c:d:h' OPTION; do
case ${OPTION} in
c)
CONFIG=${OPTARG}
;;
d)
DEVICE=${OPTARG}
;;
h)
usage
;;
esac
done

# Check that a device was requested
[ -z ${DEVICE} ] && usage

# Check for the existence of a configuration file
[ ! -f ${CONFIG} ] && die "Missing config file: ${CONFIG}"

# Use udev's path_id to generate a unique persistent key
eval `${PATH_ID} ${DEVICE}`
[ -z ${ID_PATH} ] && die "Missing ID_PATH for ${DEVICE}"

# Use the persistent key to lookup the zpool device id in the
# configuration file which is of the format <device id> <key>.
# Lines starting with #'s are treated as comments and ignored.
# Exact matches are required, wild cards are not supported,
# and only the first match is returned.
ID_ZPOOL=`${AWK} "/${ID_PATH}\>/ && !/^#/ { print \\$1; exit }" ${CONFIG}`
[ -z ${ID_ZPOOL} ] && die "Missing ID_ZPOOL for ID_PATH: ${ID_PATH}"

if [ ${ID_ZPOOL} ]; then
echo "ID_PATH=${ID_PATH}"
echo "ID_ZPOOL=${ID_ZPOOL}"
echo "ID_ZPOOL_PATH=disk/zpool/${ID_ZPOOL}"
fi

exit 0
1 change: 1 addition & 0 deletions cmd/zpool_layout/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist_bin_SCRIPTS = zpool_layout
Loading

0 comments on commit c9c0d07

Please sign in to comment.