712866
From d971a570d091a77c765c996a2c470a7d9fddd0b1 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Wed, 13 May 2015 11:46:05 +0200
712866
Subject: [PATCH] add dracut.pc pkg-config file
712866
712866
---
712866
 Makefile    | 15 +++++++++++++--
712866
 dracut.spec |  1 +
712866
 2 files changed, 14 insertions(+), 2 deletions(-)
712866
712866
diff --git a/Makefile b/Makefile
5c6c2a
index 97987377..2977d187 100644
712866
--- a/Makefile
712866
+++ b/Makefile
712866
@@ -15,6 +15,7 @@ mandir ?= ${prefix}/share/man
712866
 CFLAGS ?= -O2 -g -Wall
712866
 CFLAGS += -std=gnu99  -D_FILE_OFFSET_BITS=64
712866
 bashcompletiondir ?= ${datadir}/bash-completion/completions
712866
+pkgconfigdatadir ?= $(datadir)/pkgconfig
712866
 
712866
 man1pages = lsinitrd.1
712866
 
712866
@@ -40,7 +41,7 @@ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
712866
 
712866
 .PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
712866
 
712866
-all: dracut-version.sh dracut-install skipcpio/skipcpio
712866
+all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
712866
 
712866
 DRACUT_INSTALL_OBJECTS = \
712866
         install/dracut-install.o \
712866
@@ -93,7 +94,15 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
712866
 		http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
712866
 	rm -f -- dracut.xml
712866
 
712866
-install: dracut-version.sh
712866
+dracut.pc: Makefile.inc Makefile
712866
+	@echo "Name: dracut" > dracut.pc
712866
+	@echo "Description: dracut" >> dracut.pc
712866
+	@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
712866
+	@echo "dracutdir=$(pkglibdir)" >> dracut.pc
712866
+	@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
712866
+	@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
712866
+
712866
+install: all
712866
 	mkdir -p $(DESTDIR)$(pkglibdir)
712866
 	mkdir -p $(DESTDIR)$(bindir)
712866
 	mkdir -p $(DESTDIR)$(sysconfdir)
712866
@@ -153,6 +162,8 @@ endif
712866
 	mkdir -p $(DESTDIR)${bashcompletiondir}
712866
 	install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
712866
 	install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
712866
+	mkdir -p $(DESTDIR)${pkgconfigdatadir}
712866
+	install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
712866
 
712866
 dracut-version.sh:
712866
 	@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
712866
diff --git a/dracut.spec b/dracut.spec
5c6c2a
index efb50b77..bf10d08b 100644
712866
--- a/dracut.spec
712866
+++ b/dracut.spec
712866
@@ -312,6 +312,7 @@ rm -rf -- $RPM_BUILD_ROOT
712866
 %endif
712866
 %dir %{_sysconfdir}/dracut.conf.d
712866
 %dir %{dracutlibdir}/dracut.conf.d
712866
+%{_datadir}/pkgconfig/dracut.pc
712866
 %{_mandir}/man8/dracut.8*
712866
 %{_mandir}/man8/*service.8*
712866
 %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999