Skip to content

Commit

Permalink
Add a pkgconfig file to aid compilations against the libzfs library (…
Browse files Browse the repository at this point in the history
…depends

on libzfs_core).

Use with: pkg-config --cflags --libs libzfs

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Closes: openzfs#585
  • Loading branch information
FransUrbo committed Aug 18, 2014
1 parent 2fe5011 commit 618b563
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Expand Up @@ -90,6 +90,8 @@ AC_CONFIG_FILES([
lib/libunicode/Makefile
lib/libuutil/Makefile
lib/libzpool/Makefile
lib/libzfs/libzfs.pc
lib/libzfs/libzfs_core.pc

This comment has been minimized.

Copy link
@behlendorf

behlendorf Aug 20, 2014

This patch is missing the libzfs_core.pc.in file. It caused the reported build failures.

This comment has been minimized.

Copy link
@FransUrbo

FransUrbo Aug 20, 2014

Author Owner

Oups! Repushing with it included...

lib/libzfs/Makefile
lib/libzfs_core/Makefile
lib/libshare/Makefile
Expand Down
4 changes: 4 additions & 0 deletions lib/libzfs/Makefile.am
@@ -1,5 +1,9 @@
include $(top_srcdir)/config/Rules.am

libzfs_pcdir = $(prefix)/lib/pkgconfig

This comment has been minimized.

Copy link
@behlendorf

behlendorf Aug 20, 2014

This should be $(libdir)/pkgconfig. That should expand properly on all platforms.

libzfs_pc_DATA = $(top_srcdir)/lib/libzfs/libzfs.pc $(top_srcdir)/lib/libzfs/libzfs_core.pc
EXTRA_DIST = $(top_srcdir)/lib/libzfs/libzfs.pc $(top_srcdir)/lib/libzfs/libzfs_core.pc

DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
Expand Down
13 changes: 13 additions & 0 deletions lib/libzfs/libzfs.pc.in
@@ -0,0 +1,13 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: libzfs
Description: LibZFS library
Version: @VERSION@
URL: http://zfsonlinux.org
Requires: libzfs_core
#Conflicts:
Cflags: -I${includedir}
Libs: -L${libdir} -lzfs
1 change: 1 addition & 0 deletions rpm/generic/zfs.spec.in
Expand Up @@ -280,6 +280,7 @@ exit 0
%{_libdir}/libzfs*.so.*

%files -n libzfs2-devel
/usr/lib/pkgconfig/libzfs.pc

This comment has been minimized.

Copy link
@behlendorf

behlendorf Aug 20, 2014

This should be %{_libdir}/pkgconfig/*.pc to ensure we pick up both libzfs.pc and libzfs_core.pc.

This comment has been minimized.

Copy link
@FransUrbo

FransUrbo Aug 20, 2014

Author Owner

Again, that won't work on Debian GNU/Linux builds (when building debs). Does it work on anything but Fedora 20?

This comment has been minimized.

Copy link
@behlendorf

behlendorf Aug 20, 2014

Yes, I see what you're saying. It works under Fedora by only because lib64 is a symlink to /usr/lib64. Then this probably needs to be %{_prefix}%{_libdir}/pkgconfig/*.pc to work everywhere. It can't just be /usr/lib/ because on the Fedora and EPEL systems it must be installed in /usr/lib64/.

This comment has been minimized.

Copy link
@FransUrbo

FransUrbo Aug 20, 2014

Author Owner

Won't work on Debian GNU/Linux either. That would expand to /usr/lib64/pkgconfig...

From the manpage:

pkg-config  retrieves information about packages from special metadata files.
These files are named after the package, and has a .pc extension. On most
systems, pkg-config looks in /usr/lib/pkgconfig,  /usr/share/pkgconfig,
/usr/local/lib/pkgconfig and /usr/local/share/pkgconfig for these files. It will
additionally look in the colon-separated (on Windows, semicolon-separated)
list of directories specified by the PKG_CONFIG_PATH environment variable.

Would any of those work on Fedora 20?

This comment has been minimized.

Copy link
@behlendorf

behlendorf Aug 25, 2014

It looks like /usr/share/pkgconfig/ will work. Both udev and systemd installed their .pc files there.

%{_libdir}/*.so
%{_includedir}/*
%doc AUTHORS COPYRIGHT DISCLAIMER
Expand Down

0 comments on commit 618b563

Please sign in to comment.