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