pkgconfig: install a liburing.pc file

pkg-config (https://pkgconfig.freedesktop.org/) makes it easier to build
applications that have library dependencies.  Libraries ship .pc files
containing the compiler and linker flags needed to build successfully.
This saves applications from hardcoding these details into their build
scripts, especially when these details can change between operating
systems or distributions.

To build a liburing application:

  gcc $(pkg-config --cflags --libs liburing) -o myapp myapp.c

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Stefan Hajnoczi
2019-05-25 09:58:29 +01:00
committed by Jens Axboe
parent d672969583
commit 1b049c1265
3 changed files with 25 additions and 2 deletions
+2
View File
@@ -12,3 +12,5 @@
config-host.h
config-host.mak
config.log
liburing.pc
+11 -2
View File
@@ -33,13 +33,22 @@ ifneq ($(MAKECMDGOALS),clean)
include config-host.mak
endif
install:
%.pc: %.pc.in
sed -e "s%@prefix@%$(prefix)%g" \
-e "s%@libdir@%$(libdir)%g" \
-e "s%@includedir@%$(includedir)%g" \
-e "s%@NAME@%$(NAME)%g" \
-e "s%@VERSION@%$(VERSION)%g" \
$< >$@
install: $(NAME).pc
@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
$(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdir)/pkgconfig/$(NAME).pc
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
$(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
clean:
@rm -f config-host.mak config-host.h cscope.out
@rm -f config-host.mak config-host.h cscope.out $(NAME).pc
@$(MAKE) -C src clean
@$(MAKE) -C test clean
@$(MAKE) -C examples clean
+12
View File
@@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
includedir=@includedir@
Name: @NAME@
Version: @VERSION@
Description: io_uring library
URL: http://git.kernel.dk/cgit/liburing/
Libs: -L${libdir} -luring
Cflags: -I${includedir}