Browse Source

Use pkg-config for libkmod CFLAGS and LIBS

master
Harald Hoyer 8 years ago
parent
commit
607fec3e79
  1. 4
      Makefile
  2. 7
      configure
  3. 9
      dracut.spec

4
Makefile

@ -12,7 +12,7 @@ pkglibdir ?= ${libdir}/dracut @@ -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 @@ -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 $< $@

7
configure vendored

@ -50,6 +50,11 @@ while (($# > 0)); do @@ -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} @@ -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

{

9
dracut.spec

@ -39,6 +39,7 @@ Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -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 @@ -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. @@ -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}


Loading…
Cancel
Save