]> granicus.if.org Git - zfs/commitdiff
Add a pkgconfig file
authorTurbo Fredriksson <turbo@bayour.com>
Fri, 6 Jun 2014 23:23:22 +0000 (01:23 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 28 Aug 2014 14:59:43 +0000 (07:59 -0700)
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 <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes: #585
configure.ac
lib/libzfs/.gitignore [new file with mode: 0644]
lib/libzfs/Makefile.am
lib/libzfs/libzfs.pc.in [new file with mode: 0644]
lib/libzfs/libzfs_core.pc.in [new file with mode: 0644]
rpm/generic/zfs.spec.in

index ffa01194a6cb10eb190e099e54befcbcf9f431f4..bad15bd16e468f89ccfc98dc46ee057cd6192c32 100644 (file)
@@ -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 (file)
index 0000000..d719bc1
--- /dev/null
@@ -0,0 +1,2 @@
+/libzfs.pc
+/libzfs_core.pc
index 8b1f51782886de61f3232c4540ab31ec63d2f381..c66285e249643e3ec6ee5f493baa3f81e9edfc50 100644 (file)
@@ -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 (file)
index 0000000..0e83f7a
--- /dev/null
@@ -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 (file)
index 0000000..2b6a86b
--- /dev/null
@@ -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
index b0917176dde21d3ad978fcac32040b8253acdaf7..c173b2c6e24a97746ace55ddebf00279cfa0a7df 100644 (file)
@@ -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