Blame SOURCES/0485-add-dracut.pc-pkg-config-file.patch

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