summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTurbo Fredriksson <[email protected]>2014-06-07 01:23:22 +0200
committerBrian Behlendorf <[email protected]>2014-08-28 07:59:43 -0700
commitc3f8dc2a48e0c310abb7b58019fbcf944fa2697c (patch)
tree9d332d1de22b619473a1ed35133a88b370082fcf
parent9ad656b2d025a23ba27a4bc482638e753e62d947 (diff)
Add a pkgconfig file
Providing a pkg-config file makes is easy for 3rd party applications to link against the libzfs libraries. It also allows the libzfs developers to modify the list of required libraries and cflags without breaking existing applications. The following example illustrates how pkg-config can be used: cc `pkg-config --cflags --libs libzfs` -o myapp myapp.c /* * myapp.c */ void main() { libzfs_handle_t *hdl; hdl = libzfs_init(); if (hdl) libzfs_fini(hdl); } Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes: #585
-rw-r--r--configure.ac2
-rw-r--r--lib/libzfs/.gitignore2
-rw-r--r--lib/libzfs/Makefile.am4
-rw-r--r--lib/libzfs/libzfs.pc.in12
-rw-r--r--lib/libzfs/libzfs_core.pc.in11
-rw-r--r--rpm/generic/zfs.spec.in2
6 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ffa01194a..bad15bd16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
lib/libzfs/Makefile
lib/libzfs_core/Makefile
lib/libshare/Makefile
diff --git a/lib/libzfs/.gitignore b/lib/libzfs/.gitignore
new file mode 100644
index 000000000..d719bc1ad
--- /dev/null
+++ b/lib/libzfs/.gitignore
@@ -0,0 +1,2 @@
+/libzfs.pc
+/libzfs_core.pc
diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am
index 8b1f51782..c66285e24 100644
--- a/lib/libzfs/Makefile.am
+++ b/lib/libzfs/Makefile.am
@@ -1,5 +1,9 @@
include $(top_srcdir)/config/Rules.am
+libzfs_pcdir = $(datarootdir)/pkgconfig
+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
diff --git a/lib/libzfs/libzfs.pc.in b/lib/libzfs/libzfs.pc.in
new file mode 100644
index 000000000..0e83f7a64
--- /dev/null
+++ b/lib/libzfs/libzfs.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libzfs
+Description: LibZFS library
+Version: @VERSION@
+URL: http://zfsonlinux.org
+Requires: libzfs_core
+Cflags: -I${includedir}/libzfs -I${includedir}/libspl
+Libs: -L${libdir} -lzfs
diff --git a/lib/libzfs/libzfs_core.pc.in b/lib/libzfs/libzfs_core.pc.in
new file mode 100644
index 000000000..2b6a86bfa
--- /dev/null
+++ b/lib/libzfs/libzfs_core.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libzfs_core
+Description: LibZFS core library
+Version: @VERSION@
+URL: http://zfsonlinux.org
+Cflags: -I${includedir}/libzfs -I${includedir}/libspl
+Libs: -L${libdir} -lzfs_core
diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
index b0917176d..c173b2c6e 100644
--- a/rpm/generic/zfs.spec.in
+++ b/rpm/generic/zfs.spec.in
@@ -280,6 +280,8 @@ exit 0
%{_libdir}/libzfs*.so.*
%files -n libzfs2-devel
+%{_datadir}/pkgconfig/libzfs.pc
+%{_datadir}/pkgconfig/libzfs_core.pc
%{_libdir}/*.so
%{_includedir}/*
%doc AUTHORS COPYRIGHT DISCLAIMER