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 <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10538
This commit is contained in:
Arvind Sankar 2020-06-30 13:10:41 -04:00 committed by Brian Behlendorf
parent b6437ea41c
commit 4d61ade1a3
45 changed files with 171 additions and 168 deletions

View File

@ -13,6 +13,6 @@ mount_zfs_SOURCES = \
mount_zfs.c mount_zfs.c
mount_zfs_LDADD = \ 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_core/libzfs_core.la \
$(top_builddir)/lib/libzfs/libzfs.la $(top_builddir)/lib/libnvpair/libnvpair.la

View File

@ -14,7 +14,7 @@ raidz_test_SOURCES = \
raidz_bench.c raidz_bench.c
raidz_test_LDADD = \ 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

View File

@ -11,5 +11,6 @@ zdb_SOURCES = \
zdb.h zdb.h
zdb_LDADD = \ 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

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS)
SUBDIRS = zed.d SUBDIRS = zed.d
sbin_PROGRAMS = zed sbin_PROGRAMS = zed
@ -36,12 +38,12 @@ FMA_SRC = \
zed_SOURCES = $(ZED_SRC) $(FMA_SRC) zed_SOURCES = $(ZED_SRC) $(FMA_SRC)
zed_LDADD = \ zed_LDADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.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 zed_LDFLAGS = -pthread
EXTRA_DIST = agents/README.md EXTRA_DIST = agents/README.md

View File

@ -11,10 +11,10 @@ zfs_SOURCES = \
zfs_projectutil.h zfs_projectutil.h
zfs_LDADD = \ zfs_LDADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzfs/libzfs.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 if BUILD_FREEBSD
zfs_LDADD += -L/usr/local/lib -lintl -lgeom -ljail zfs_LDADD += -L/usr/local/lib -lintl -lgeom -ljail

View File

@ -6,5 +6,6 @@ zhack_SOURCES = \
zhack.c zhack.c
zhack_LDADD = \ 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

View File

@ -8,6 +8,6 @@ zinject_SOURCES = \
zinject.h zinject.h
zinject_LDADD = \ 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_core/libzfs_core.la \
$(top_builddir)/lib/libzfs/libzfs.la $(top_builddir)/lib/libnvpair/libnvpair.la

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS)
DEFAULT_INCLUDES += -I$(srcdir) DEFAULT_INCLUDES += -I$(srcdir)
sbin_PROGRAMS = zpool sbin_PROGRAMS = zpool
@ -20,15 +22,15 @@ zpool_SOURCES += os/linux/zpool_vdev_os.c
endif endif
zpool_LDADD = \ zpool_LDADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.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 if BUILD_FREEBSD
zpool_LDADD += -L/usr/local/lib -lintl -lgeom zpool_LDADD += -L/usr/local/lib -lintl -lgeom
endif endif
zpool_LDADD += -lm $(LIBBLKID) zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS)
zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolconfdir = $(sysconfdir)/zfs/zpool.d
zpoolexecdir = $(zfsexecdir)/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d

View File

@ -9,6 +9,6 @@ zstream_SOURCES = \
zstream_redup.c zstream_redup.c
zstream_LDADD = \ 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_core/libzfs_core.la \
$(top_builddir)/lib/libzfs/libzfs.la $(top_builddir)/lib/libnvpair/libnvpair.la

View File

@ -15,8 +15,9 @@ ztest_SOURCES = \
ztest.c ztest.c
ztest_LDADD = \ 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_LDADD += -lm
ztest_LDFLAGS = -pthread ztest_LDFLAGS = -pthread

View File

@ -11,7 +11,9 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
_library_found= _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]], [ AS_IF([test -f /usr/include/[$3]], [
AC_SUBST([$1][_CFLAGS], []) AC_SUBST([$1][_CFLAGS], [])
AC_SUBST([$1][_LIBS], ["-l[$5]]") AC_SUBST([$1][_LIBS], ["-l[$5]]")
@ -21,6 +23,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
AC_SUBST([$1][_LIBS], ["-L/usr/local -l[$5]]") AC_SUBST([$1][_LIBS], ["-L/usr/local -l[$5]]")
_library_found=1 _library_found=1
],[dnl ELSE ],[dnl ELSE
:
m4_foreach([prefix], [$4], [ m4_foreach([prefix], [$4], [
AS_IF([test "x$_library_found" != "x1"], [ AS_IF([test "x$_library_found" != "x1"], [
AS_IF([test -f [/usr/include/]prefix[/][$3]], [ AS_IF([test -f [/usr/include/]prefix[/][$3]], [
@ -37,7 +40,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
])]) ])])
AS_IF([test -z "$_library_found"], [ 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]" LDFLAGS="$LDFLAGS $[$1][_LIBS]"
AC_CHECK_HEADER([$3], [], [ 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= _library_found=
]) ])
@ -66,6 +69,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
]) ])
AS_IF([test -n "$_library_found"], [ AS_IF([test -n "$_library_found"], [
AC_DEFINE([HAVE_][$1], [1], [Define if you have [$5]])
:;$7 :;$7
],[dnl ELSE ],[dnl ELSE
:;$8 :;$8

View File

@ -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])
])
])
])

View File

@ -2,13 +2,5 @@ dnl #
dnl # Check for libaio - only used for libaiot test cases. dnl # Check for libaio - only used for libaiot test cases.
dnl # dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [
LIBAIO= FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no])
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
])
]) ])

View File

@ -3,11 +3,7 @@ dnl # Check for libblkid. Basic support for detecting ZFS pools
dnl # has existing in blkid since 2008. dnl # has existing in blkid since 2008.
dnl # dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [
LIBBLKID= FIND_SYSTEM_LIBRARY(LIBBLKID, [blkid], [blkid/blkid.h], [], [blkid], [], [], [
AC_MSG_FAILURE([
AC_CHECK_HEADER([blkid/blkid.h], [], [AC_MSG_FAILURE([ *** blkid.h missing, libblkid-devel package required])])
*** blkid.h missing, libblkid-devel package required])])
AC_SUBST([LIBBLKID], ["-lblkid"])
AC_DEFINE([HAVE_LIBBLKID], 1, [Define if you have libblkid])
]) ])

8
config/user-libcrypto.m4 Normal file
View File

@ -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])])
])

View File

@ -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])
])

View File

@ -2,18 +2,18 @@ dnl #
dnl # Check for libudev - needed for vdev auto-online and auto-replace dnl # Check for libudev - needed for vdev auto-online and auto-replace
dnl # dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUDEV], [ 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], [ AS_IF([test "x$user_libudev" = xyes], [
user_libudev=yes AX_SAVE_FLAGS
AC_SUBST([LIBUDEV], ["-ludev"])
AC_DEFINE([HAVE_LIBUDEV], 1, [Define if you have libudev]) CFLAGS="$CFLAGS $LIBUDEV_CFLAGS"
], [ LDFLAGS="$LDFLAGS $LIBUDEV_LIBS"
user_libudev=no
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
]) ])
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])], [])
]) ])

View File

@ -2,17 +2,7 @@ dnl #
dnl # Check for libuuid dnl # Check for libuuid
dnl # dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUUID], [ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUUID], [
LIBUUID= FIND_SYSTEM_LIBRARY(LIBUUID, [uuid], [uuid/uuid.h], [], [uuid], [uuid_generate, uuid_is_null], [], [
AC_MSG_FAILURE([*** libuuid-devel package required])
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])
]) ])

View File

@ -2,20 +2,7 @@ dnl #
dnl # Check for zlib dnl # Check for zlib
dnl # dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_ZLIB], [ AC_DEFUN([ZFS_AC_CONFIG_USER_ZLIB], [
ZLIB= FIND_SYSTEM_LIBRARY(ZLIB, [zlib], [zlib.h], [], [z], [compress2, uncompress, crc32], [], [
AC_MSG_FAILURE([*** zlib-devel package required])
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])
]) ])

View File

@ -6,6 +6,10 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_MOUNT_HELPER ZFS_AC_CONFIG_USER_MOUNT_HELPER
ZFS_AC_CONFIG_USER_SYSVINIT ZFS_AC_CONFIG_USER_SYSVINIT
ZFS_AC_CONFIG_USER_DRACUT ZFS_AC_CONFIG_USER_DRACUT
AM_COND_IF([BUILD_FREEBSD], [
PKG_INSTALLDIR(['${prefix}/libdata/pkgconfig'])], [
PKG_INSTALLDIR
])
ZFS_AC_CONFIG_USER_ZLIB ZFS_AC_CONFIG_USER_ZLIB
AM_COND_IF([BUILD_LINUX], [ AM_COND_IF([BUILD_LINUX], [
ZFS_AC_CONFIG_USER_UDEV ZFS_AC_CONFIG_USER_UDEV
@ -15,8 +19,9 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
]) ])
ZFS_AC_CONFIG_USER_LIBTIRPC ZFS_AC_CONFIG_USER_LIBTIRPC
ZFS_AC_CONFIG_USER_LIBUDEV ZFS_AC_CONFIG_USER_LIBUDEV
ZFS_AC_CONFIG_USER_LIBSSL ZFS_AC_CONFIG_USER_LIBCRYPTO
ZFS_AC_CONFIG_USER_LIBAIO ZFS_AC_CONFIG_USER_LIBAIO
ZFS_AC_CONFIG_USER_CLOCK_GETTIME
ZFS_AC_CONFIG_USER_PAM ZFS_AC_CONFIG_USER_PAM
ZFS_AC_CONFIG_USER_RUNSTATEDIR ZFS_AC_CONFIG_USER_RUNSTATEDIR
ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS

View File

@ -160,8 +160,8 @@ AC_CONFIG_FILES([
lib/libuutil/Makefile lib/libuutil/Makefile
lib/libzfs/Makefile lib/libzfs/Makefile
lib/libzfs/libzfs.pc lib/libzfs/libzfs.pc
lib/libzfs/libzfs_core.pc
lib/libzfs_core/Makefile lib/libzfs_core/Makefile
lib/libzfs_core/libzfs_core.pc
lib/libzpool/Makefile lib/libzpool/Makefile
lib/libzutil/Makefile lib/libzutil/Makefile
man/Makefile man/Makefile

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(LIBCRYPTO_CFLAGS)
pammodule_LTLIBRARIES=pam_zfs_key.la pammodule_LTLIBRARIES=pam_zfs_key.la
pam_zfs_key_la_SOURCES = pam_zfs_key.c 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_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 dist_pamconfigs_DATA = zfs_key

View File

@ -1,5 +1,5 @@
# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries # 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 SUBDIRS = libavl libicp libshare libspl libtpool
if BUILD_LINUX if BUILD_LINUX
@ -9,6 +9,6 @@ endif
# libzutil depends on libefi if present # libzutil depends on libefi if present
SUBDIRS += libzutil libunicode SUBDIRS += libzutil libunicode
# These four libraries, which are installed as the final build product, # These five libraries, which are installed as the final build product,
# incorporate the six convenience libraries given above. # incorporate the eight convenience libraries given above.
SUBDIRS += libuutil libnvpair libzpool libzfs_core libzfs SUBDIRS += libuutil libnvpair libzfs_core libzfs libzpool

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS)
noinst_LTLIBRARIES = libefi.la noinst_LTLIBRARIES = libefi.la
USER_C = \ USER_C = \
@ -7,4 +9,4 @@ USER_C = \
libefi_la_SOURCES = $(USER_C) libefi_la_SOURCES = $(USER_C)
libefi_la_LIBADD = $(LIBUUID) libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS)

View File

@ -71,5 +71,3 @@ KERNEL_ASM = $(ASM_SOURCES_AS)
nodist_libicp_la_SOURCES = \ nodist_libicp_la_SOURCES = \
$(KERNEL_C) \ $(KERNEL_C) \
$(KERNEL_ASM) $(KERNEL_ASM)
libicp_la_LIBADD = -lrt

View File

@ -26,10 +26,15 @@ dist_libnvpair_la_SOURCES = \
nodist_libnvpair_la_SOURCES = \ nodist_libnvpair_la_SOURCES = \
$(KERNEL_C) $(KERNEL_C)
libnvpair_la_LIBADD = \
$(top_builddir)/lib/libspl/libspl_assert.la
libnvpair_la_LIBADD += \
$(LIBTIRPC_LIBS)
if BUILD_FREEBSD 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 libnvpair_la_LDFLAGS = -version-info 3:0:0
else else
libnvpair_la_LIBADD = $(LIBTIRPC_LIBS)
libnvpair_la_LDFLAGS = -version-info 1:1:0 libnvpair_la_LDFLAGS = -version-info 1:1:0
endif endif

View File

@ -12,8 +12,6 @@ endif
SUBDIRS = include SUBDIRS = include
AM_CFLAGS += $(LIBTIRPC_CFLAGS)
AM_CCASFLAGS = \ AM_CCASFLAGS = \
$(CFLAGS) $(CFLAGS)
@ -55,4 +53,4 @@ libspl_la_SOURCES = \
libspl_la_LIBADD = \ libspl_la_LIBADD = \
libspl_assert.la libspl_assert.la
libspl_la_LIBADD += -lrt $(LIBTIRPC_LIBS) libspl_la_LIBADD += $(LIBCLOCK_GETTIME)

View File

@ -7,8 +7,3 @@ USER_C = \
thread_pool_impl.h thread_pool_impl.h
libtpool_la_SOURCES = $(USER_C) libtpool_la_SOURCES = $(USER_C)
libtpool_la_LIBADD = \
$(top_builddir)/lib/libspl/libspl.la
libtpool_la_LDFLAGS = -pthread

View File

@ -19,8 +19,10 @@ libuutil_la_LIBADD = \
$(top_builddir)/lib/libavl/libavl.la \ $(top_builddir)/lib/libavl/libavl.la \
$(top_builddir)/lib/libspl/libspl.la $(top_builddir)/lib/libspl/libspl.la
libuutil_la_LDFLAGS = -pthread
if BUILD_FREEBSD if BUILD_FREEBSD
libuutil_la_LDFLAGS = -pthread -version-info 3:0:0 libuutil_la_LDFLAGS += -version-info 3:0:0
else else
libuutil_la_LDFLAGS = -pthread -version-info 1:1:0 libuutil_la_LDFLAGS += -version-info 1:1:0
endif endif

View File

@ -1,2 +1 @@
/libzfs.pc /libzfs.pc
/libzfs_core.pc

View File

@ -7,9 +7,9 @@ VPATH = \
# Suppress unused but set variable warnings often due to ASSERTs # Suppress unused but set variable warnings often due to ASSERTs
AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS)
libzfs_pcdir = $(datarootdir)/pkgconfig pkgconfig_DATA = libzfs.pc
libzfs_pc_DATA = libzfs.pc libzfs_core.pc
lib_LTLIBRARIES = libzfs.la lib_LTLIBRARIES = libzfs.la
@ -69,25 +69,28 @@ dist_libzfs_la_SOURCES = \
nodist_libzfs_la_SOURCES = \ nodist_libzfs_la_SOURCES = \
$(KERNEL_C) $(KERNEL_C)
libzfs_la_LIBADD = \ 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
if BUILD_LINUX if BUILD_LINUX
libzfs_la_LIBADD += \ libzfs_la_LIBADD += \
$(top_builddir)/lib/libshare/libshare.la $(top_builddir)/lib/libshare/libshare.la
endif 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 if BUILD_FREEBSD
libzfs_la_LIBADD += -lutil -lgeom libzfs_la_LIBADD += -lutil -lgeom
libzfs_la_LDFLAGS = -version-info 4:0:0 libzfs_la_LDFLAGS += -version-info 4:0:0
else else
libzfs_la_LDFLAGS = -version-info 2:0:0 libzfs_la_LDFLAGS += -version-info 2:0:0
endif endif
libzfs_la_LIBADD += -lm $(LIBSSL)
# Licensing data # Licensing data
EXTRA_DIST = THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip EXTRA_DIST = THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip

View File

@ -8,5 +8,7 @@ Description: LibZFS library
Version: @VERSION@ Version: @VERSION@
URL: https://zfsonlinux.org URL: https://zfsonlinux.org
Requires: libzfs_core Requires: libzfs_core
Requires.private: libcrypto zlib
Cflags: -I${includedir}/libzfs -I${includedir}/libspl Cflags: -I${includedir}/libzfs -I${includedir}/libspl
Libs: -L${libdir} -lzfs -lnvpair Libs: -L${libdir} -lzfs -lnvpair
Libs.private: -luutil -lm -pthread

1
lib/libzfs_core/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/libzfs_core.pc

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Rules.am
pkgconfig_DATA = libzfs_core.pc
lib_LTLIBRARIES = libzfs_core.la lib_LTLIBRARIES = libzfs_core.la
USER_C = \ USER_C = \
@ -8,13 +10,14 @@ USER_C = \
libzfs_core_la_SOURCES = $(USER_C) libzfs_core_la_SOURCES = $(USER_C)
libzfs_core_la_LIBADD = \ libzfs_core_la_LIBADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libzutil/libzutil.la \
$(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libnvpair/libnvpair.la
$(top_builddir)/lib/libzutil/libzutil.la
libzfs_core_la_LDFLAGS = -pthread
if BUILD_FREEBSD if BUILD_FREEBSD
libzfs_core_la_LDFLAGS = -version-info 3:0:0
libzfs_core_la_LIBADD += -lutil -lgeom libzfs_core_la_LIBADD += -lutil -lgeom
libzfs_core_la_LDFLAGS += -version-info 3:0:0
else else
libzfs_core_la_LDFLAGS = -version-info 1:0:0 libzfs_core_la_LDFLAGS += -version-info 1:0:0
endif endif

View File

@ -7,5 +7,7 @@ Name: libzfs_core
Description: LibZFS core library Description: LibZFS core library
Version: @VERSION@ Version: @VERSION@
URL: https://zfsonlinux.org URL: https://zfsonlinux.org
Requires.private: blkid uuid libtirpc zlib
Cflags: -I${includedir}/libzfs -I${includedir}/libspl 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

View File

@ -13,6 +13,8 @@ AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
# Includes kernel code generate warnings for large stack frames # Includes kernel code generate warnings for large stack frames
AM_CFLAGS += $(FRAME_LARGER_THAN) AM_CFLAGS += $(FRAME_LARGER_THAN)
AM_CFLAGS += $(ZLIB_CFLAGS)
AM_CFLAGS += -DLIB_ZPOOL_BUILD AM_CFLAGS += -DLIB_ZPOOL_BUILD
lib_LTLIBRARIES = libzpool.la lib_LTLIBRARIES = libzpool.la
@ -199,16 +201,19 @@ nodist_libzpool_la_SOURCES = \
libzpool_la_LIBADD = \ libzpool_la_LIBADD = \
$(top_builddir)/lib/libicp/libicp.la \ $(top_builddir)/lib/libicp/libicp.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libunicode/libunicode.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 if BUILD_FREEBSD
libzpool_la_LIBADD += $(ZLIB) -ldl -lgeom libzpool_la_LIBADD += -lgeom
libzpool_la_LDFLAGS = -pthread -version-info 4:0:0 libzpool_la_LDFLAGS += -version-info 4:0:0
else else
libzpool_la_LIBADD += $(ZLIB) -ldl libzpool_la_LDFLAGS += -version-info 2:0:0
libzpool_la_LDFLAGS = -pthread -version-info 2:0:0
endif endif
if TARGET_CPU_POWERPC if TARGET_CPU_POWERPC

View File

@ -2,6 +2,7 @@ include $(top_srcdir)/config/Rules.am
# Suppress unused but set variable warnings often due to ASSERTs # Suppress unused but set variable warnings often due to ASSERTs
AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS)
DEFAULT_INCLUDES += -I$(srcdir) DEFAULT_INCLUDES += -I$(srcdir)
@ -32,11 +33,12 @@ libzutil_la_SOURCES = $(USER_C)
libzutil_la_LIBADD = \ libzutil_la_LIBADD = \
$(top_builddir)/lib/libavl/libavl.la \ $(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 if BUILD_LINUX
libzutil_la_LIBADD += \ libzutil_la_LIBADD += \
$(top_builddir)/lib/libefi/libefi.la $(top_builddir)/lib/libefi/libefi.la
endif endif
libzutil_la_LIBADD += -lm $(LIBBLKID) $(LIBUDEV) libzutil_la_LIBADD += -lm $(LIBBLKID_LIBS) $(LIBUDEV_LIBS)

View File

@ -48,6 +48,10 @@
%global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators %global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators
%endif %endif
%if %{undefined _pkgconfigdir}
%global _pkgconfigdir %{_prefix}/%{_lib}/pkgconfig
%endif
%bcond_with debug %bcond_with debug
%bcond_with debuginfo %bcond_with debuginfo
%bcond_with asan %bcond_with asan
@ -345,6 +349,7 @@ image which is ZFS aware.
--with-udevruledir=%{_udevruledir} \ --with-udevruledir=%{_udevruledir} \
--with-dracutdir=%{_dracutdir} \ --with-dracutdir=%{_dracutdir} \
--with-python=%{__python} \ --with-python=%{__python} \
--with-pkgconfigdir=%{_pkgconfigdir} \
--disable-static \ --disable-static \
%{debug} \ %{debug} \
%{debuginfo} \ %{debuginfo} \
@ -483,8 +488,8 @@ systemctl --system daemon-reload >/dev/null || true
%{_libdir}/libzfs*.so.* %{_libdir}/libzfs*.so.*
%files -n libzfs2-devel %files -n libzfs2-devel
%{_datarootdir}/pkgconfig/libzfs.pc %{_pkgconfigdir}/libzfs.pc
%{_datarootdir}/pkgconfig/libzfs_core.pc %{_pkgconfigdir}/libzfs_core.pc
%{_libdir}/*.so %{_libdir}/*.so
%{_includedir}/* %{_includedir}/*
%doc AUTHORS COPYRIGHT LICENSE NOTICE README.md %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md

View File

@ -28,6 +28,5 @@ pkgexec_PROGRAMS = btree_test
btree_test_SOURCES = btree_test.c btree_test_SOURCES = btree_test.c
btree_test_LDADD = \ btree_test_LDADD = \
$(top_builddir)/lib/libavl/libavl.la \ $(top_builddir)/lib/libzpool/libzpool.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la
$(top_builddir)/lib/libzpool/libzpool.la

View File

@ -6,6 +6,5 @@ pkgexec_PROGRAMS = libzfs_input_check
libzfs_input_check_SOURCES = libzfs_input_check.c libzfs_input_check_SOURCES = libzfs_input_check.c
libzfs_input_check_LDADD = \ libzfs_input_check_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libnvpair/libnvpair.la
$(top_builddir)/lib/libzfs_core/libzfs_core.la

View File

@ -5,5 +5,6 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
if WANT_MMAP_LIBAIO if WANT_MMAP_LIBAIO
pkgexec_PROGRAMS = mmap_libaio pkgexec_PROGRAMS = mmap_libaio
mmap_libaio_SOURCES = mmap_libaio.c mmap_libaio_SOURCES = mmap_libaio.c
mmap_libaio_LDADD = $(LIBAIO) mmap_libaio_CFLAGS = $(AM_CFLAGS) $(LIBAIO_CFLAGS)
mmap_libaio_LDADD = $(LIBAIO_LIBS)
endif endif

View File

@ -6,5 +6,5 @@ pkgexec_PROGRAMS = nvlist_to_lua
nvlist_to_lua_SOURCES = nvlist_to_lua.c nvlist_to_lua_SOURCES = nvlist_to_lua.c
nvlist_to_lua_LDADD = \ 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

View File

@ -1,12 +1,9 @@
include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Rules.am
AM_CPPFLAGS += -I$(top_srcdir)/include
LDADD = \ LDADD = \
$(top_builddir)/lib/libicp/libicp.la \ $(top_builddir)/lib/libicp/libicp.la \
$(top_builddir)/lib/libspl/libspl_assert.la $(top_builddir)/lib/libspl/libspl_assert.la
AUTOMAKE_OPTIONS = subdir-objects
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum
dist_pkgdata_SCRIPTS = \ dist_pkgdata_SCRIPTS = \

View File

@ -1,11 +1,5 @@
include $(top_srcdir)/config/Rules.am 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 pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf
dist_pkgdata_SCRIPTS = \ dist_pkgdata_SCRIPTS = \
@ -19,3 +13,5 @@ pkgexec_PROGRAMS = \
hkdf_test hkdf_test
hkdf_test_SOURCES = hkdf_test.c hkdf_test_SOURCES = hkdf_test.c
hkdf_test_LDADD = \
$(top_builddir)/lib/libzpool/libzpool.la

View File

@ -10,8 +10,6 @@ dist_pkgdata_SCRIPTS = \
libzfs_input.ksh libzfs_input.ksh
many_fds_LDADD = \ many_fds_LDADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la \
$(top_builddir)/lib/libzfs/libzfs.la $(top_builddir)/lib/libzfs/libzfs.la
pkgexec_PROGRAMS = many_fds pkgexec_PROGRAMS = many_fds