HomeFreeBSD

Clean up lib dependencies

Description

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

Details

Provenance
Arvind Sankar <nivedita@alum.mit.edu>Authored on Jun 30 2020, 5:10 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jul 10 2020, 9:26 PM
Parents
rGb6437ea41c76: Move libspl_assertf into .c file
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG4d61ade1a317: Clean up lib dependencies (authored by Arvind Sankar <nivedita@alum.mit.edu>).Jul 10 2020, 9:26 PM