95 lines
3.0 KiB
Diff
95 lines
3.0 KiB
Diff
|
From 607fec3e7965e3d38d764008e2b0c29757d90777 Mon Sep 17 00:00:00 2001
|
||
|
From: Harald Hoyer <harald@redhat.com>
|
||
|
Date: Wed, 13 Apr 2016 11:13:32 +0200
|
||
|
Subject: [PATCH] Use pkg-config for libkmod CFLAGS and LIBS
|
||
|
|
||
|
---
|
||
|
Makefile | 4 ++--
|
||
|
configure | 7 +++++++
|
||
|
dracut.spec | 9 ++++++---
|
||
|
3 files changed, 15 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/Makefile b/Makefile
|
||
|
index 0a1ae6c..d28e4cf 100644
|
||
|
--- a/Makefile
|
||
|
+++ b/Makefile
|
||
|
@@ -12,7 +12,7 @@ pkglibdir ?= ${libdir}/dracut
|
||
|
sysconfdir ?= ${prefix}/etc
|
||
|
bindir ?= ${prefix}/bin
|
||
|
mandir ?= ${prefix}/share/man
|
||
|
-CFLAGS ?= -O2 -g -Wall
|
||
|
+CFLAGS ?= -O2 -g -Wall $(KMOD_CFLAGS)
|
||
|
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
|
||
|
bashcompletiondir ?= ${datadir}/bash-completion/completions
|
||
|
pkgconfigdatadir ?= $(datadir)/pkgconfig
|
||
|
@@ -61,7 +61,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||
|
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
||
|
|
||
|
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||
|
- $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) -lkmod
|
||
|
+ $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
|
||
|
|
||
|
dracut-install: install/dracut-install
|
||
|
ln -fs $< $@
|
||
|
diff --git a/configure b/configure
|
||
|
index 0bd3d2d..c92cb99 100755
|
||
|
--- a/configure
|
||
|
+++ b/configure
|
||
|
@@ -50,6 +50,11 @@ while (($# > 0)); do
|
||
|
shift
|
||
|
done
|
||
|
|
||
|
+if ! pkg-config --exists --print-errors " libkmod >= 15 "; then
|
||
|
+ echo "dracut needs pkg-config and libkmod >= 15." >&2
|
||
|
+ exit 1
|
||
|
+fi
|
||
|
+
|
||
|
cat > Makefile.inc.$$ <<EOF
|
||
|
prefix ?= ${prefix}
|
||
|
libdir ?= ${libdir:-${prefix}/lib}
|
||
|
@@ -59,6 +64,8 @@ sbindir ?= ${sbindir:-${prefix}/sbin}
|
||
|
mandir ?= ${mandir:-${prefix}/share/man}
|
||
|
enable_documentation ?= ${enable_documentation:-yes}
|
||
|
bindir ?= ${bindir:-${prefix}/bin}
|
||
|
+KMOD_CFLAGS ?= $(pkg-config --cflags " libkmod >= 15 ")
|
||
|
+KMOD_LIBS ?= $(pkg-config --libs " libkmod >= 15 ")
|
||
|
EOF
|
||
|
|
||
|
{
|
||
|
diff --git a/dracut.spec b/dracut.spec
|
||
|
index 9e19fcc..7b9d675 100644
|
||
|
--- a/dracut.spec
|
||
|
+++ b/dracut.spec
|
||
|
@@ -39,6 +39,7 @@ Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||
|
|
||
|
|
||
|
BuildRequires: bash git
|
||
|
+BuildRequires: kmod-devel >= 15
|
||
|
|
||
|
%if 0%{?fedora} || 0%{?rhel}
|
||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||
|
@@ -46,7 +47,6 @@ BuildRequires: pkgconfig
|
||
|
%endif
|
||
|
%if 0%{?fedora}
|
||
|
BuildRequires: bash-completion
|
||
|
-BuildRequires: pkgconfig
|
||
|
%endif
|
||
|
|
||
|
%if 0%{?suse_version}
|
||
|
@@ -223,10 +223,13 @@ This package contains tools to assemble the local initrd and host configuration.
|
||
|
cp %{SOURCE1} .
|
||
|
|
||
|
%build
|
||
|
-%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
|
||
|
+%configure --systemdsystemunitdir=%{_unitdir} \
|
||
|
+ --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \
|
||
|
+ --libdir=%{_prefix}/lib \
|
||
|
%if %{without doc}
|
||
|
- --disable-documentation
|
||
|
+ --disable-documentation \
|
||
|
%endif
|
||
|
+ ${NULL}
|
||
|
|
||
|
make %{?_smp_mflags}
|
||
|
|