diff options
author | Arvind Sankar <[email protected]> | 2020-06-30 13:10:41 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-07-10 14:26:00 -0700 |
commit | 4d61ade1a317606dc899e38b516410a0c2fdae0e (patch) | |
tree | d6c2003638fe28b2fe341515aaded236d6c1320f | |
parent | b6437ea41c7611481925d72d294677434639b847 (diff) |
Clean up lib dependencies
libzutil is currently statically linked into libzfs, libzfs_core and
libzpool. Avoid the unnecessary duplication by removing it from libzfs
and libzpool, and adding libzfs_core to libzpool.
Remove a few unnecessary dependencies:
- libuutil from libzfs_core
- libtirpc from libspl
- keep only libcrypto in libzfs, as we don't use any functions from
libssl
- librt is only used for clock_gettime, however on modern systems that's
in libc rather than librt. Add a configure check to see if we actually
need librt
- libdl from raidz_test
Add a few missing dependencies:
- zlib to libefi and libzfs
- libuuid to zpool, and libuuid and libudev to zed
- libnvpair uses assertions, so add assert.c to provide aok and
libspl_assertf
Sort the LDADD for programs so that libraries that satisfy dependencies
come at the end rather than the beginning of the linker command line.
Revamp the configure tests for libaries to use FIND_SYSTEM_LIBRARY
instead. This can take advantage of pkg-config, and it also avoids
polluting LIBS.
List all the required dependencies in the pkgconfig files, and move the
one for libzfs_core into the latter's directory. Install pkgconfig files
in $(libdir)/pkgconfig on linux and $(prefix)/libdata/pkgconfig on
FreeBSD, instead of /usr/share/pkgconfig, as the more correct location
for library .pc files.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Arvind Sankar <[email protected]>
Closes #10538
45 files changed, 170 insertions, 167 deletions
diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index ddacf32c6..616ee65a7 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -13,6 +13,6 @@ mount_zfs_SOURCES = \ mount_zfs.c mount_zfs_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 0b173ed50..387cc7d8a 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -14,7 +14,7 @@ raidz_test_SOURCES = \ raidz_bench.c raidz_test_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la -raidz_test_LDADD += -lm -ldl +raidz_test_LDADD += -lm diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index 07c1d068b..68de8ea3c 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -11,5 +11,6 @@ zdb_SOURCES = \ zdb.h zdb_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index b6c89bfc3..89b4d899b 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) + SUBDIRS = zed.d sbin_PROGRAMS = zed @@ -36,12 +38,12 @@ FMA_SRC = \ zed_SOURCES = $(ZED_SRC) $(FMA_SRC) zed_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la -zed_LDADD += -lrt +zed_LDADD += -lrt $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread EXTRA_DIST = agents/README.md diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index c824bf61e..1ce721a8b 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -11,10 +11,10 @@ zfs_SOURCES = \ zfs_projectutil.h zfs_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la if BUILD_FREEBSD zfs_LDADD += -L/usr/local/lib -lintl -lgeom -ljail diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index ac4b6aadb..3f6ef1215 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -6,5 +6,6 @@ zhack_SOURCES = \ zhack.c zhack_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index b056a6db5..7c4a5fdbb 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -8,6 +8,6 @@ zinject_SOURCES = \ zinject.h zinject_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 1dcb98520..04bdbffcd 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) + DEFAULT_INCLUDES += -I$(srcdir) sbin_PROGRAMS = zpool @@ -20,15 +22,15 @@ zpool_SOURCES += os/linux/zpool_vdev_os.c endif zpool_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la if BUILD_FREEBSD zpool_LDADD += -L/usr/local/lib -lintl -lgeom endif -zpool_LDADD += -lm $(LIBBLKID) +zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d diff --git a/cmd/zstream/Makefile.am b/cmd/zstream/Makefile.am index ebc07d2ea..a3b678d0a 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -9,6 +9,6 @@ zstream_SOURCES = \ zstream_redup.c zstream_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index db9a104c0..4790e62ca 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -15,8 +15,9 @@ ztest_SOURCES = \ ztest.c ztest_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la ztest_LDADD += -lm ztest_LDFLAGS = -pthread diff --git a/config/find_system_library.m4 b/config/find_system_library.m4 index 9d22bcfab..3f2f7b709 100644 --- a/config/find_system_library.m4 +++ b/config/find_system_library.m4 @@ -11,7 +11,9 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [ _library_found= - PKG_CHECK_MODULES([$1], [$2], [_library_found=1], [ + AS_IF([test -n "$2"], [PKG_CHECK_MODULES([$1], [$2], [_library_found=1], [:])]) + + AS_IF([test -z "$_library_found"], [ AS_IF([test -f /usr/include/[$3]], [ AC_SUBST([$1][_CFLAGS], []) AC_SUBST([$1][_LIBS], ["-l[$5]]") @@ -21,6 +23,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [ AC_SUBST([$1][_LIBS], ["-L/usr/local -l[$5]]") _library_found=1 ],[dnl ELSE + : m4_foreach([prefix], [$4], [ AS_IF([test "x$_library_found" != "x1"], [ AS_IF([test -f [/usr/include/]prefix[/][$3]], [ @@ -37,7 +40,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [ ])]) AS_IF([test -z "$_library_found"], [ - AC_MSG_WARN([cannot find [$2] via pkg-config or in the standard locations]) + AC_MSG_WARN([cannot find [$5] via pkg-config or in the standard locations]) ]) ]) @@ -51,7 +54,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [ LDFLAGS="$LDFLAGS $[$1][_LIBS]" AC_CHECK_HEADER([$3], [], [ - AC_MSG_WARN([header [$3] for library [$2] is not usable]) + AC_MSG_WARN([header [$3] for library [$5] is not usable]) _library_found= ]) @@ -66,6 +69,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [ ]) AS_IF([test -n "$_library_found"], [ + AC_DEFINE([HAVE_][$1], [1], [Define if you have [$5]]) :;$7 ],[dnl ELSE :;$8 diff --git a/config/user-clock_gettime.m4 b/config/user-clock_gettime.m4 new file mode 100644 index 000000000..c96024da7 --- /dev/null +++ b/config/user-clock_gettime.m4 @@ -0,0 +1,12 @@ +dnl # +dnl # Check if librt is required for clock_gettime. +dnl # clock_gettime is generally available in libc on modern systems. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_CLOCK_GETTIME], [ + AC_CHECK_FUNC([clock_gettime], [], [ + AC_CHECK_LIB([rt], [clock_gettime], [ + AC_SUBST([LIBCLOCK_GETTIME], [-lrt])], [ + AC_MSG_FAILURE([*** clock_gettime is missing in libc and librt]) + ]) + ]) +]) diff --git a/config/user-libaio.m4 b/config/user-libaio.m4 index d7a7cb508..0a58876fe 100644 --- a/config/user-libaio.m4 +++ b/config/user-libaio.m4 @@ -2,13 +2,5 @@ dnl # dnl # Check for libaio - only used for libaiot test cases. dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [ - LIBAIO= - - AC_CHECK_HEADER([libaio.h], [ - user_libaio=yes - AC_SUBST([LIBAIO], ["-laio"]) - AC_DEFINE([HAVE_LIBAIO], 1, [Define if you have libaio]) - ], [ - user_libaio=no - ]) + FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no]) ]) diff --git a/config/user-libblkid.m4 b/config/user-libblkid.m4 index 88e6f990b..427c4f172 100644 --- a/config/user-libblkid.m4 +++ b/config/user-libblkid.m4 @@ -3,11 +3,7 @@ dnl # Check for libblkid. Basic support for detecting ZFS pools dnl # has existing in blkid since 2008. dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [ - LIBBLKID= - - AC_CHECK_HEADER([blkid/blkid.h], [], [AC_MSG_FAILURE([ - *** blkid.h missing, libblkid-devel package required])]) - - AC_SUBST([LIBBLKID], ["-lblkid"]) - AC_DEFINE([HAVE_LIBBLKID], 1, [Define if you have libblkid]) + FIND_SYSTEM_LIBRARY(LIBBLKID, [blkid], [blkid/blkid.h], [], [blkid], [], [], [ + AC_MSG_FAILURE([ + *** blkid.h missing, libblkid-devel package required])]) ]) diff --git a/config/user-libcrypto.m4 b/config/user-libcrypto.m4 new file mode 100644 index 000000000..432b84838 --- /dev/null +++ b/config/user-libcrypto.m4 @@ -0,0 +1,8 @@ +dnl # +dnl # Check for libcrypto. Used for userspace password derivation via PBKDF2. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_LIBCRYPTO], [ + FIND_SYSTEM_LIBRARY(LIBCRYPTO, [libcrypto], [openssl/evp.h], [], [crypto], [PKCS5_PBKDF2_HMAC_SHA1], [], [ + AC_MSG_FAILURE([ + *** evp.h missing, libssl-devel package required])]) +]) diff --git a/config/user-libssl.m4 b/config/user-libssl.m4 deleted file mode 100644 index f6824510f..000000000 --- a/config/user-libssl.m4 +++ /dev/null @@ -1,12 +0,0 @@ -dnl # -dnl # Check for libssl. Used for userspace password derivation via PBKDF2. -dnl # -AC_DEFUN([ZFS_AC_CONFIG_USER_LIBSSL], [ - LIBSSL= - - AC_CHECK_HEADER([openssl/evp.h], [], [AC_MSG_FAILURE([ - *** evp.h missing, libssl-devel package required])]) - - AC_SUBST([LIBSSL], ["-lssl -lcrypto"]) - AC_DEFINE([HAVE_LIBSSL], 1, [Define if you have libssl]) -]) diff --git a/config/user-libudev.m4 b/config/user-libudev.m4 index 9b7454927..5164d17cd 100644 --- a/config/user-libudev.m4 +++ b/config/user-libudev.m4 @@ -2,18 +2,18 @@ dnl # dnl # Check for libudev - needed for vdev auto-online and auto-replace dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUDEV], [ - LIBUDEV= + FIND_SYSTEM_LIBRARY(LIBUDEV, [libudev], [libudev.h], [], [udev], [], [user_libudev=yes], [user_libudev=no]) - AC_CHECK_HEADER([libudev.h], [ - user_libudev=yes - AC_SUBST([LIBUDEV], ["-ludev"]) - AC_DEFINE([HAVE_LIBUDEV], 1, [Define if you have libudev]) - ], [ - user_libudev=no - ]) + AS_IF([test "x$user_libudev" = xyes], [ + AX_SAVE_FLAGS + + CFLAGS="$CFLAGS $LIBUDEV_CFLAGS" + LDFLAGS="$LDFLAGS $LIBUDEV_LIBS" - AC_SEARCH_LIBS([udev_device_get_is_initialized], [udev], [ - AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1, [ - Define if udev_device_get_is_initialized is available])], []) + AC_CHECK_LIB([udev], [udev_device_get_is_initialized], [ + AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1, [ + Define if udev_device_get_is_initialized is available])], []) + AX_RESTORE_FLAGS + ]) ]) diff --git a/config/user-libuuid.m4 b/config/user-libuuid.m4 index f0da671a3..c4012f30a 100644 --- a/config/user-libuuid.m4 +++ b/config/user-libuuid.m4 @@ -2,17 +2,7 @@ dnl # dnl # Check for libuuid dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUUID], [ - LIBUUID= - - AC_CHECK_HEADER([uuid/uuid.h], [], [AC_MSG_FAILURE([ - *** uuid/uuid.h missing, libuuid-devel package required])]) - - AC_SEARCH_LIBS([uuid_generate], [uuid], [], [AC_MSG_FAILURE([ - *** uuid_generate() missing, libuuid-devel package required])]) - - AC_SEARCH_LIBS([uuid_is_null], [uuid], [], [AC_MSG_FAILURE([ - *** uuid_is_null() missing, libuuid-devel package required])]) - - AC_SUBST([LIBUUID], ["-luuid"]) - AC_DEFINE([HAVE_LIBUUID], 1, [Define if you have libuuid]) + FIND_SYSTEM_LIBRARY(LIBUUID, [uuid], [uuid/uuid.h], [], [uuid], [uuid_generate, uuid_is_null], [], [ + AC_MSG_FAILURE([*** libuuid-devel package required]) + ]) ]) diff --git a/config/user-zlib.m4 b/config/user-zlib.m4 index 82c0962e4..d30fde288 100644 --- a/config/user-zlib.m4 +++ b/config/user-zlib.m4 @@ -2,20 +2,7 @@ dnl # dnl # Check for zlib dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_ZLIB], [ - ZLIB= - - AC_CHECK_HEADER([zlib.h], [], [AC_MSG_FAILURE([ - *** zlib.h missing, zlib-devel package required])]) - - AC_SEARCH_LIBS([compress2], [z], [], [AC_MSG_FAILURE([ - *** compress2() missing, zlib-devel package required])]) - - AC_SEARCH_LIBS([uncompress], [z], [], [AC_MSG_FAILURE([ - *** uncompress() missing, zlib-devel package required])]) - - AC_SEARCH_LIBS([crc32], [z], [], [AC_MSG_FAILURE([ - *** crc32() missing, zlib-devel package required])]) - - AC_SUBST([ZLIB], ["-lz"]) - AC_DEFINE([HAVE_ZLIB], 1, [Define if you have zlib]) + FIND_SYSTEM_LIBRARY(ZLIB, [zlib], [zlib.h], [], [z], [compress2, uncompress, crc32], [], [ + AC_MSG_FAILURE([*** zlib-devel package required]) + ]) ]) diff --git a/config/user.m4 b/config/user.m4 index c09705bde..c22067551 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -6,6 +6,10 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [ ZFS_AC_CONFIG_USER_MOUNT_HELPER ZFS_AC_CONFIG_USER_SYSVINIT ZFS_AC_CONFIG_USER_DRACUT + AM_COND_IF([BUILD_FREEBSD], [ + PKG_INSTALLDIR(['${prefix}/libdata/pkgconfig'])], [ + PKG_INSTALLDIR + ]) ZFS_AC_CONFIG_USER_ZLIB AM_COND_IF([BUILD_LINUX], [ ZFS_AC_CONFIG_USER_UDEV @@ -15,8 +19,9 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [ ]) ZFS_AC_CONFIG_USER_LIBTIRPC ZFS_AC_CONFIG_USER_LIBUDEV - ZFS_AC_CONFIG_USER_LIBSSL + ZFS_AC_CONFIG_USER_LIBCRYPTO ZFS_AC_CONFIG_USER_LIBAIO + ZFS_AC_CONFIG_USER_CLOCK_GETTIME ZFS_AC_CONFIG_USER_PAM ZFS_AC_CONFIG_USER_RUNSTATEDIR ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS diff --git a/configure.ac b/configure.ac index c7f813d19..0c3a5b660 100644 --- a/configure.ac +++ b/configure.ac @@ -160,8 +160,8 @@ AC_CONFIG_FILES([ lib/libuutil/Makefile lib/libzfs/Makefile lib/libzfs/libzfs.pc - lib/libzfs/libzfs_core.pc lib/libzfs_core/Makefile + lib/libzfs_core/libzfs_core.pc lib/libzpool/Makefile lib/libzutil/Makefile man/Makefile diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index 7feabcdcb..a67153dda 100644 --- a/contrib/pam_zfs_key/Makefile.am +++ b/contrib/pam_zfs_key/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBCRYPTO_CFLAGS) + pammodule_LTLIBRARIES=pam_zfs_key.la pam_zfs_key_la_SOURCES = pam_zfs_key.c @@ -12,6 +14,6 @@ pam_zfs_key_la_LIBADD = \ pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared -pam_zfs_key_la_LIBADD += -lpam $(LIBSSL) +pam_zfs_key_la_LIBADD += -lpam $(LIBCRYPTO_LIBS) dist_pamconfigs_DATA = zfs_key diff --git a/lib/Makefile.am b/lib/Makefile.am index 4f59aa359..02e7f7b5f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,5 @@ # NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries -# These six libraries are intermediary build components. +# These eight libraries are intermediary build components. SUBDIRS = libavl libicp libshare libspl libtpool if BUILD_LINUX @@ -9,6 +9,6 @@ endif # libzutil depends on libefi if present SUBDIRS += libzutil libunicode -# These four libraries, which are installed as the final build product, -# incorporate the six convenience libraries given above. -SUBDIRS += libuutil libnvpair libzpool libzfs_core libzfs +# These five libraries, which are installed as the final build product, +# incorporate the eight convenience libraries given above. +SUBDIRS += libuutil libnvpair libzfs_core libzfs libzpool diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index 0ca04df46..fab6c8d47 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) + noinst_LTLIBRARIES = libefi.la USER_C = \ @@ -7,4 +9,4 @@ USER_C = \ libefi_la_SOURCES = $(USER_C) -libefi_la_LIBADD = $(LIBUUID) +libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS) diff --git a/lib/libicp/Makefile.am b/lib/libicp/Makefile.am index fad91e13c..6d3c65ea3 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -71,5 +71,3 @@ KERNEL_ASM = $(ASM_SOURCES_AS) nodist_libicp_la_SOURCES = \ $(KERNEL_C) \ $(KERNEL_ASM) - -libicp_la_LIBADD = -lrt diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index af99c84b7..c29714342 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -26,10 +26,15 @@ dist_libnvpair_la_SOURCES = \ nodist_libnvpair_la_SOURCES = \ $(KERNEL_C) +libnvpair_la_LIBADD = \ + $(top_builddir)/lib/libspl/libspl_assert.la + +libnvpair_la_LIBADD += \ + $(LIBTIRPC_LIBS) + if BUILD_FREEBSD -libnvpair_la_LIBADD = $(LIBTIRPC_LIBS) -L/usr/local/lib -lintl +libnvpair_la_LIBADD += -L/usr/local/lib -lintl libnvpair_la_LDFLAGS = -version-info 3:0:0 else -libnvpair_la_LIBADD = $(LIBTIRPC_LIBS) libnvpair_la_LDFLAGS = -version-info 1:1:0 endif diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am index ad34c3588..f576d6924 100644 --- a/lib/libspl/Makefile.am +++ b/lib/libspl/Makefile.am @@ -12,8 +12,6 @@ endif SUBDIRS = include -AM_CFLAGS += $(LIBTIRPC_CFLAGS) - AM_CCASFLAGS = \ $(CFLAGS) @@ -55,4 +53,4 @@ libspl_la_SOURCES = \ libspl_la_LIBADD = \ libspl_assert.la -libspl_la_LIBADD += -lrt $(LIBTIRPC_LIBS) +libspl_la_LIBADD += $(LIBCLOCK_GETTIME) diff --git a/lib/libtpool/Makefile.am b/lib/libtpool/Makefile.am index 818f49ce4..22bfa4b23 100644 --- a/lib/libtpool/Makefile.am +++ b/lib/libtpool/Makefile.am @@ -7,8 +7,3 @@ USER_C = \ thread_pool_impl.h libtpool_la_SOURCES = $(USER_C) - -libtpool_la_LIBADD = \ - $(top_builddir)/lib/libspl/libspl.la - -libtpool_la_LDFLAGS = -pthread diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index 37f2eb65b..2d8eab681 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -19,8 +19,10 @@ libuutil_la_LIBADD = \ $(top_builddir)/lib/libavl/libavl.la \ $(top_builddir)/lib/libspl/libspl.la +libuutil_la_LDFLAGS = -pthread + if BUILD_FREEBSD -libuutil_la_LDFLAGS = -pthread -version-info 3:0:0 +libuutil_la_LDFLAGS += -version-info 3:0:0 else -libuutil_la_LDFLAGS = -pthread -version-info 1:1:0 +libuutil_la_LDFLAGS += -version-info 1:1:0 endif diff --git a/lib/libzfs/.gitignore b/lib/libzfs/.gitignore index d719bc1ad..9336a5c00 100644 --- a/lib/libzfs/.gitignore +++ b/lib/libzfs/.gitignore @@ -1,2 +1 @@ /libzfs.pc -/libzfs_core.pc diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index efdac5ea1..836669e2a 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -7,9 +7,9 @@ VPATH = \ # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) +AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) -libzfs_pcdir = $(datarootdir)/pkgconfig -libzfs_pc_DATA = libzfs.pc libzfs_core.pc +pkgconfig_DATA = libzfs.pc lib_LTLIBRARIES = libzfs.la @@ -69,25 +69,28 @@ dist_libzfs_la_SOURCES = \ nodist_libzfs_la_SOURCES = \ $(KERNEL_C) -libzfs_la_LIBADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzutil/libzutil.la +libzfs_la_LIBADD = if BUILD_LINUX libzfs_la_LIBADD += \ $(top_builddir)/lib/libshare/libshare.la endif +libzfs_la_LIBADD += \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la + +libzfs_la_LIBADD += -lm $(LIBCRYPTO_LIBS) $(ZLIB_LIBS) + +libzfs_la_LDFLAGS = -pthread + if BUILD_FREEBSD libzfs_la_LIBADD += -lutil -lgeom -libzfs_la_LDFLAGS = -version-info 4:0:0 +libzfs_la_LDFLAGS += -version-info 4:0:0 else -libzfs_la_LDFLAGS = -version-info 2:0:0 +libzfs_la_LDFLAGS += -version-info 2:0:0 endif -libzfs_la_LIBADD += -lm $(LIBSSL) - # Licensing data EXTRA_DIST = THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip diff --git a/lib/libzfs/libzfs.pc.in b/lib/libzfs/libzfs.pc.in index d09e19fb0..6caf49d22 100644 --- a/lib/libzfs/libzfs.pc.in +++ b/lib/libzfs/libzfs.pc.in @@ -8,5 +8,7 @@ Description: LibZFS library Version: @VERSION@ URL: https://zfsonlinux.org Requires: libzfs_core +Requires.private: libcrypto zlib Cflags: -I${includedir}/libzfs -I${includedir}/libspl Libs: -L${libdir} -lzfs -lnvpair +Libs.private: -luutil -lm -pthread diff --git a/lib/libzfs_core/.gitignore b/lib/libzfs_core/.gitignore new file mode 100644 index 000000000..c428d6369 --- /dev/null +++ b/lib/libzfs_core/.gitignore @@ -0,0 +1 @@ +/libzfs_core.pc diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index 69ddabd88..44940e915 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/config/Rules.am +pkgconfig_DATA = libzfs_core.pc + lib_LTLIBRARIES = libzfs_core.la USER_C = \ @@ -8,13 +10,14 @@ USER_C = \ libzfs_core_la_SOURCES = $(USER_C) libzfs_core_la_LIBADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzutil/libzutil.la + $(top_builddir)/lib/libzutil/libzutil.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la + +libzfs_core_la_LDFLAGS = -pthread if BUILD_FREEBSD -libzfs_core_la_LDFLAGS = -version-info 3:0:0 libzfs_core_la_LIBADD += -lutil -lgeom +libzfs_core_la_LDFLAGS += -version-info 3:0:0 else -libzfs_core_la_LDFLAGS = -version-info 1:0:0 +libzfs_core_la_LDFLAGS += -version-info 1:0:0 endif diff --git a/lib/libzfs/libzfs_core.pc.in b/lib/libzfs_core/libzfs_core.pc.in index 9f5c6462d..e14d42d11 100644 --- a/lib/libzfs/libzfs_core.pc.in +++ b/lib/libzfs_core/libzfs_core.pc.in @@ -7,5 +7,7 @@ Name: libzfs_core Description: LibZFS core library Version: @VERSION@ URL: https://zfsonlinux.org +Requires.private: blkid uuid libtirpc zlib Cflags: -I${includedir}/libzfs -I${includedir}/libspl -Libs: -L${libdir} -lzfs_core +Libs: -L${libdir} -lzfs_core -lnvpair +Libs.private: @LIBCLOCK_GETTIME@ @LIBUDEV_LIBS@ -lm -pthread diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 06b89fe0a..bce45acc2 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -13,6 +13,8 @@ AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) # Includes kernel code generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) +AM_CFLAGS += $(ZLIB_CFLAGS) + AM_CFLAGS += -DLIB_ZPOOL_BUILD lib_LTLIBRARIES = libzpool.la @@ -199,16 +201,19 @@ nodist_libzpool_la_SOURCES = \ libzpool_la_LIBADD = \ $(top_builddir)/lib/libicp/libicp.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libunicode/libunicode.la \ - $(top_builddir)/lib/libzutil/libzutil.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la + +libzpool_la_LIBADD += $(LIBCLOCK_GETTIME) $(ZLIB_LIBS) -ldl + +libzpool_la_LDFLAGS = -pthread if BUILD_FREEBSD -libzpool_la_LIBADD += $(ZLIB) -ldl -lgeom -libzpool_la_LDFLAGS = -pthread -version-info 4:0:0 +libzpool_la_LIBADD += -lgeom +libzpool_la_LDFLAGS += -version-info 4:0:0 else -libzpool_la_LIBADD += $(ZLIB) -ldl -libzpool_la_LDFLAGS = -pthread -version-info 2:0:0 +libzpool_la_LDFLAGS += -version-info 2:0:0 endif if TARGET_CPU_POWERPC diff --git a/lib/libzutil/Makefile.am b/lib/libzutil/Makefile.am index c11da9e9d..af1911760 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/config/Rules.am # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) +AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) DEFAULT_INCLUDES += -I$(srcdir) @@ -32,11 +33,12 @@ libzutil_la_SOURCES = $(USER_C) libzutil_la_LIBADD = \ $(top_builddir)/lib/libavl/libavl.la \ - $(top_builddir)/lib/libtpool/libtpool.la + $(top_builddir)/lib/libtpool/libtpool.la \ + $(top_builddir)/lib/libspl/libspl.la if BUILD_LINUX libzutil_la_LIBADD += \ $(top_builddir)/lib/libefi/libefi.la endif -libzutil_la_LIBADD += -lm $(LIBBLKID) $(LIBUDEV) +libzutil_la_LIBADD += -lm $(LIBBLKID_LIBS) $(LIBUDEV_LIBS) diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index e972a10ee..e0bed4cc4 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -48,6 +48,10 @@ %global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators %endif +%if %{undefined _pkgconfigdir} +%global _pkgconfigdir %{_prefix}/%{_lib}/pkgconfig +%endif + %bcond_with debug %bcond_with debuginfo %bcond_with asan @@ -345,6 +349,7 @@ image which is ZFS aware. --with-udevruledir=%{_udevruledir} \ --with-dracutdir=%{_dracutdir} \ --with-python=%{__python} \ + --with-pkgconfigdir=%{_pkgconfigdir} \ --disable-static \ %{debug} \ %{debuginfo} \ @@ -483,8 +488,8 @@ systemctl --system daemon-reload >/dev/null || true %{_libdir}/libzfs*.so.* %files -n libzfs2-devel -%{_datarootdir}/pkgconfig/libzfs.pc -%{_datarootdir}/pkgconfig/libzfs_core.pc +%{_pkgconfigdir}/libzfs.pc +%{_pkgconfigdir}/libzfs_core.pc %{_libdir}/*.so %{_includedir}/* %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md diff --git a/tests/zfs-tests/cmd/btree_test/Makefile.am b/tests/zfs-tests/cmd/btree_test/Makefile.am index bf09cdb82..55c40e3f5 100644 --- a/tests/zfs-tests/cmd/btree_test/Makefile.am +++ b/tests/zfs-tests/cmd/btree_test/Makefile.am @@ -28,6 +28,5 @@ pkgexec_PROGRAMS = btree_test btree_test_SOURCES = btree_test.c btree_test_LDADD = \ - $(top_builddir)/lib/libavl/libavl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la diff --git a/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am b/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am index 32cc46561..67fa98886 100644 --- a/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am +++ b/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am @@ -6,6 +6,5 @@ pkgexec_PROGRAMS = libzfs_input_check libzfs_input_check_SOURCES = libzfs_input_check.c libzfs_input_check_LDADD = \ - $(top_builddir)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/tests/zfs-tests/cmd/mmap_libaio/Makefile.am b/tests/zfs-tests/cmd/mmap_libaio/Makefile.am index 67d0f0ece..25f9dda2b 100644 --- a/tests/zfs-tests/cmd/mmap_libaio/Makefile.am +++ b/tests/zfs-tests/cmd/mmap_libaio/Makefile.am @@ -5,5 +5,6 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin if WANT_MMAP_LIBAIO pkgexec_PROGRAMS = mmap_libaio mmap_libaio_SOURCES = mmap_libaio.c -mmap_libaio_LDADD = $(LIBAIO) +mmap_libaio_CFLAGS = $(AM_CFLAGS) $(LIBAIO_CFLAGS) +mmap_libaio_LDADD = $(LIBAIO_LIBS) endif diff --git a/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am b/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am index 7d60c2482..c98e032e1 100644 --- a/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am +++ b/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am @@ -6,5 +6,5 @@ pkgexec_PROGRAMS = nvlist_to_lua nvlist_to_lua_SOURCES = nvlist_to_lua.c nvlist_to_lua_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/tests/zfs-tests/tests/functional/checksum/Makefile.am b/tests/zfs-tests/tests/functional/checksum/Makefile.am index 7cd15324e..265a4b16e 100644 --- a/tests/zfs-tests/tests/functional/checksum/Makefile.am +++ b/tests/zfs-tests/tests/functional/checksum/Makefile.am @@ -1,12 +1,9 @@ include $(top_srcdir)/config/Rules.am -AM_CPPFLAGS += -I$(top_srcdir)/include LDADD = \ $(top_builddir)/lib/libicp/libicp.la \ $(top_builddir)/lib/libspl/libspl_assert.la -AUTOMAKE_OPTIONS = subdir-objects - pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum dist_pkgdata_SCRIPTS = \ diff --git a/tests/zfs-tests/tests/functional/hkdf/Makefile.am b/tests/zfs-tests/tests/functional/hkdf/Makefile.am index 378bcf531..be65f8c0e 100644 --- a/tests/zfs-tests/tests/functional/hkdf/Makefile.am +++ b/tests/zfs-tests/tests/functional/hkdf/Makefile.am @@ -1,11 +1,5 @@ include $(top_srcdir)/config/Rules.am -LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la - -AUTOMAKE_OPTIONS = subdir-objects - pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf dist_pkgdata_SCRIPTS = \ @@ -19,3 +13,5 @@ pkgexec_PROGRAMS = \ hkdf_test hkdf_test_SOURCES = hkdf_test.c +hkdf_test_LDADD = \ + $(top_builddir)/lib/libzpool/libzpool.la diff --git a/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/tests/zfs-tests/tests/functional/libzfs/Makefile.am index 545af77e7..e9a703f49 100644 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/libzfs/Makefile.am @@ -10,8 +10,6 @@ dist_pkgdata_SCRIPTS = \ libzfs_input.ksh many_fds_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la \ $(top_builddir)/lib/libzfs/libzfs.la pkgexec_PROGRAMS = many_fds |