All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
	Aarushi Mehta <mehta.aaru20@gmail.com>,
	Julia Suvorova <jusual@mail.ru>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH liburing 1/2] pkgconfig: install a liburing.pc file
Date: Sat, 25 May 2019 09:58:29 +0100	[thread overview]
Message-ID: <20190525085830.31577-2-stefanha@redhat.com> (raw)
In-Reply-To: <20190525085830.31577-1-stefanha@redhat.com>

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>
---
 Makefile       | 13 +++++++++++--
 .gitignore     |  2 ++
 liburing.pc.in | 12 ++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 liburing.pc.in

diff --git a/Makefile b/Makefile
index d42dd45..6755713 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/.gitignore b/.gitignore
index e292825..08ba0e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@
 config-host.h
 config-host.mak
 config.log
+
+liburing.pc
diff --git a/liburing.pc.in b/liburing.pc.in
new file mode 100644
index 0000000..e621939
--- /dev/null
+++ b/liburing.pc.in
@@ -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}
-- 
2.21.0


  reply	other threads:[~2019-05-25  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25  8:58 [PATCH liburing 0/2] pkg-config support Stefan Hajnoczi
2019-05-25  8:58 ` Stefan Hajnoczi [this message]
2019-05-25  8:58 ` [PATCH liburing 2/2] configure: move directory options to ./configure Stefan Hajnoczi
2019-05-25 12:37 ` [PATCH liburing 0/2] pkg-config support Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190525085830.31577-2-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=jusual@mail.ru \
    --cc=linux-block@vger.kernel.org \
    --cc=mehta.aaru20@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.