History

kbuild: Allow kernel installation packaging to override pkg-config

Add HOSTPKG_CONFIG to allow tooling that builds the kernel to override what pkg-config and parameters are used.

Chun-Tse Shao committed 4 years ago

Commit d5ea4fe1 parent 9a227178 files · +37 −36Browse files

Unified · Split

8 files
  1. Makefile +2 −1
  2. certs/Makefile +2 −2
  3. scripts/Makefile +2 −2
  4. scripts/kconfig/gconf-cfg.sh +6 −6
  5. scripts/kconfig/mconf-cfg.sh +8 −8
  6. scripts/kconfig/nconf-cfg.sh +8 −8
  7. scripts/kconfig/qconf-cfg.sh +7 −7
  8. tools/objtool/Makefile +2 −2
Makefile+2−1
@@ -436,6 +436,7 @@ else · 435 unmodified lines
436HOSTCC = gcc436HOSTCC = gcc
437HOSTCXX = g++437HOSTCXX = g++
438endif438endif
439HOSTPKG_CONFIG = pkg-config
439 440
440KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \441KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
441 -O2 -fomit-frame-pointer -std=gnu11 \442 -O2 -fomit-frame-pointer -std=gnu11 \
@@ -533,7 +534,7 @@ KBUILD_LDFLAGS_MODULE := · 91 unmodified lines
533KBUILD_LDFLAGS :=534KBUILD_LDFLAGS :=
534CLANG_FLAGS :=535CLANG_FLAGS :=
535 536
536export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC537export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
537export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL538export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
538export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX539export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
539export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD540export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
certs/Makefile+2−2
@@ -74,5 +74,5 @@ targets += x509_revocation_list · 73 unmodified lines
74 74
75hostprogs := extract-cert75hostprogs := extract-cert
76 76
77HOSTCFLAGS_extract-cert.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)77HOSTCFLAGS_extract-cert.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
78HOSTLDLIBS_extract-cert = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)78HOSTLDLIBS_extract-cert = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
scripts/Makefile+2−2
@@ -14,8 +14,8 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert · 13 unmodified lines
14HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include14HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
15HOSTLDLIBS_sorttable = -lpthread15HOSTLDLIBS_sorttable = -lpthread
16HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include16HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
17HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)17HOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
18HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)18HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
19 19
20ifdef CONFIG_UNWINDER_ORC20ifdef CONFIG_UNWINDER_ORC
21ifeq ($(ARCH),x86_64)21ifeq ($(ARCH),x86_64)
scripts/kconfig/gconf-cfg.sh+6−6
@@ -3,14 +3,14 @@ · 2 unmodified lines
3 3
4PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"4PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"
5 5
6if [ -z "$(command -v pkg-config)" ]; then6if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then
7 echo >&2 "*"7 echo >&2 "*"
8 echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it."8 echo >&2 "* 'make gconfig' requires '${HOSTPKG_CONFIG}'. Please install it."
9 echo >&2 "*"9 echo >&2 "*"
10 exit 110 exit 1
11fi11fi
12 12
13if ! pkg-config --exists $PKG; then13if ! ${HOSTPKG_CONFIG} --exists $PKG; then
14 echo >&2 "*"14 echo >&2 "*"
15 echo >&2 "* Unable to find the GTK+ installation. Please make sure that"15 echo >&2 "* Unable to find the GTK+ installation. Please make sure that"
16 echo >&2 "* the GTK+ 2.0 development package is correctly installed."16 echo >&2 "* the GTK+ 2.0 development package is correctly installed."
@@ -19,12 +19,12 @@ if ! pkg-config --exists $PKG; then · 2 unmodified lines
19 exit 119 exit 1
20fi20fi
21 21
22if ! pkg-config --atleast-version=2.0.0 gtk+-2.0; then22if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then
23 echo >&2 "*"23 echo >&2 "*"
24 echo >&2 "* GTK+ is present but version >= 2.0.0 is required."24 echo >&2 "* GTK+ is present but version >= 2.0.0 is required."
25 echo >&2 "*"25 echo >&2 "*"
26 exit 126 exit 1
27fi27fi
28 28
29echo cflags=\"$(pkg-config --cflags $PKG)\"29echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
30echo libs=\"$(pkg-config --libs $PKG)\"30echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
scripts/kconfig/mconf-cfg.sh+8−8
@@ -4,16 +4,16 @@ · 3 unmodified lines
4PKG="ncursesw"4PKG="ncursesw"
5PKG2="ncurses"5PKG2="ncurses"
6 6
7if [ -n "$(command -v pkg-config)" ]; then7if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
8 if pkg-config --exists $PKG; then8 if ${HOSTPKG_CONFIG} --exists $PKG; then
9 echo cflags=\"$(pkg-config --cflags $PKG)\"9 echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
10 echo libs=\"$(pkg-config --libs $PKG)\"10 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
11 exit 011 exit 0
12 fi12 fi
13 13
14 if pkg-config --exists $PKG2; then14 if ${HOSTPKG_CONFIG} --exists $PKG2; then
15 echo cflags=\"$(pkg-config --cflags $PKG2)\"15 echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\"
16 echo libs=\"$(pkg-config --libs $PKG2)\"16 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\"
17 exit 017 exit 0
18 fi18 fi
19fi19fi
@@ -46,7 +46,7 @@ echo >&2 "* Unable to find the ncurses package." · 26 unmodified lines
46echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"46echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
47echo >&2 "* depending on your distribution)."47echo >&2 "* depending on your distribution)."
48echo >&2 "*"48echo >&2 "*"
49echo >&2 "* You may also need to install pkg-config to find the"49echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
50echo >&2 "* ncurses installed in a non-default location."50echo >&2 "* ncurses installed in a non-default location."
51echo >&2 "*"51echo >&2 "*"
52exit 152exit 1
scripts/kconfig/nconf-cfg.sh+8−8
@@ -4,16 +4,16 @@ · 3 unmodified lines
4PKG="ncursesw menuw panelw"4PKG="ncursesw menuw panelw"
5PKG2="ncurses menu panel"5PKG2="ncurses menu panel"
6 6
7if [ -n "$(command -v pkg-config)" ]; then7if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
8 if pkg-config --exists $PKG; then8 if ${HOSTPKG_CONFIG} --exists $PKG; then
9 echo cflags=\"$(pkg-config --cflags $PKG)\"9 echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
10 echo libs=\"$(pkg-config --libs $PKG)\"10 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
11 exit 011 exit 0
12 fi12 fi
13 13
14 if pkg-config --exists $PKG2; then14 if ${HOSTPKG_CONFIG} --exists $PKG2; then
15 echo cflags=\"$(pkg-config --cflags $PKG2)\"15 echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\"
16 echo libs=\"$(pkg-config --libs $PKG2)\"16 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\"
17 exit 017 exit 0
18 fi18 fi
19fi19fi
@@ -44,7 +44,7 @@ echo >&2 "* Unable to find the ncurses package." · 24 unmodified lines
44echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"44echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
45echo >&2 "* depending on your distribution)."45echo >&2 "* depending on your distribution)."
46echo >&2 "*"46echo >&2 "*"
47echo >&2 "* You may also need to install pkg-config to find the"47echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
48echo >&2 "* ncurses installed in a non-default location."48echo >&2 "* ncurses installed in a non-default location."
49echo >&2 "*"49echo >&2 "*"
50exit 150exit 1
scripts/kconfig/qconf-cfg.sh+7−7
@@ -3,22 +3,22 @@ · 2 unmodified lines
3 3
4PKG="Qt5Core Qt5Gui Qt5Widgets"4PKG="Qt5Core Qt5Gui Qt5Widgets"
5 5
6if [ -z "$(command -v pkg-config)" ]; then6if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then
7 echo >&2 "*"7 echo >&2 "*"
8 echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it."8 echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it."
9 echo >&2 "*"9 echo >&2 "*"
10 exit 110 exit 1
11fi11fi
12 12
13if pkg-config --exists $PKG; then13if ${HOSTPKG_CONFIG} --exists $PKG; then
14 echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags $PKG)\"14 echo cflags=\"-std=c++11 -fPIC $(${HOSTPKG_CONFIG} --cflags $PKG)\"
15 echo libs=\"$(pkg-config --libs $PKG)\"15 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
16 echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\"16 echo moc=\"$(${HOSTPKG_CONFIG} --variable=host_bins Qt5Core)/moc\"
17 exit 017 exit 0
18fi18fi
19 19
20echo >&2 "*"20echo >&2 "*"
21echo >&2 "* Could not find Qt5 via pkg-config."21echo >&2 "* Could not find Qt5 via ${HOSTPKG_CONFIG}."
22echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH"22echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH"
23echo >&2 "*"23echo >&2 "*"
24exit 124exit 1
tools/objtool/Makefile+2−2
@@ -19,8 +19,8 @@ LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a · 18 unmodified lines
19OBJTOOL := $(OUTPUT)objtool19OBJTOOL := $(OUTPUT)objtool
20OBJTOOL_IN := $(OBJTOOL)-in.o20OBJTOOL_IN := $(OBJTOOL)-in.o
21 21
22LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null)22LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
23LIBELF_LIBS := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)23LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
24 24
25all: $(OBJTOOL)25all: $(OBJTOOL)
26 26