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
436436 HOSTCC = gcc
437437 HOSTCXX = g++
438438 endif
439+HOSTPKG_CONFIG = pkg-config
439440
440441 KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
441442 -O2 -fomit-frame-pointer -std=gnu11 \
@@ -533,7 +534,7 @@ KBUILD_LDFLAGS_MODULE := · 91 unmodified lines
533534 KBUILD_LDFLAGS :=
534535 CLANG_FLAGS :=
535536
536−export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
537+export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
537538 export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
538539 export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
539540 export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
certs/Makefile+2−2
@@ -74,5 +74,5 @@ targets += x509_revocation_list · 73 unmodified lines
7474
7575 hostprogs := extract-cert
7676
77−HOSTCFLAGS_extract-cert.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
78−HOSTLDLIBS_extract-cert = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
77+HOSTCFLAGS_extract-cert.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
78+HOSTLDLIBS_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
1414 HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
1515 HOSTLDLIBS_sorttable = -lpthread
1616 HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
17−HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
18−HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
17+HOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
18+HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
1919
2020 ifdef CONFIG_UNWINDER_ORC
2121 ifeq ($(ARCH),x86_64)
scripts/kconfig/gconf-cfg.sh+6−6
@@ -3,14 +3,14 @@ · 2 unmodified lines
33
44 PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"
55
6−if [ -z "$(command -v pkg-config)" ]; then
6+if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then
77 echo >&2 "*"
8− echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it."
8+ echo >&2 "* 'make gconfig' requires '${HOSTPKG_CONFIG}'. Please install it."
99 echo >&2 "*"
1010 exit 1
1111 fi
1212
13−if ! pkg-config --exists $PKG; then
13+if ! ${HOSTPKG_CONFIG} --exists $PKG; then
1414 echo >&2 "*"
1515 echo >&2 "* Unable to find the GTK+ installation. Please make sure that"
1616 echo >&2 "* the GTK+ 2.0 development package is correctly installed."
@@ -19,12 +19,12 @@ if ! pkg-config --exists $PKG; then · 2 unmodified lines
1919 exit 1
2020 fi
2121
22−if ! pkg-config --atleast-version=2.0.0 gtk+-2.0; then
22+if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then
2323 echo >&2 "*"
2424 echo >&2 "* GTK+ is present but version >= 2.0.0 is required."
2525 echo >&2 "*"
2626 exit 1
2727 fi
2828
29−echo cflags=\"$(pkg-config --cflags $PKG)\"
30−echo libs=\"$(pkg-config --libs $PKG)\"
29+echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
30+echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
scripts/kconfig/mconf-cfg.sh+8−8
@@ -4,16 +4,16 @@ · 3 unmodified lines
44 PKG="ncursesw"
55 PKG2="ncurses"
66
7−if [ -n "$(command -v pkg-config)" ]; then
8− if pkg-config --exists $PKG; then
9− echo cflags=\"$(pkg-config --cflags $PKG)\"
10− echo libs=\"$(pkg-config --libs $PKG)\"
7+if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
8+ if ${HOSTPKG_CONFIG} --exists $PKG; then
9+ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
10+ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
1111 exit 0
1212 fi
1313
14− if pkg-config --exists $PKG2; then
15− echo cflags=\"$(pkg-config --cflags $PKG2)\"
16− echo libs=\"$(pkg-config --libs $PKG2)\"
14+ if ${HOSTPKG_CONFIG} --exists $PKG2; then
15+ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\"
16+ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\"
1717 exit 0
1818 fi
1919 fi
@@ -46,7 +46,7 @@ echo >&2 "* Unable to find the ncurses package." · 26 unmodified lines
4646 echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
4747 echo >&2 "* depending on your distribution)."
4848 echo >&2 "*"
49−echo >&2 "* You may also need to install pkg-config to find the"
49+echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
5050 echo >&2 "* ncurses installed in a non-default location."
5151 echo >&2 "*"
5252 exit 1
scripts/kconfig/nconf-cfg.sh+8−8
@@ -4,16 +4,16 @@ · 3 unmodified lines
44 PKG="ncursesw menuw panelw"
55 PKG2="ncurses menu panel"
66
7−if [ -n "$(command -v pkg-config)" ]; then
8− if pkg-config --exists $PKG; then
9− echo cflags=\"$(pkg-config --cflags $PKG)\"
10− echo libs=\"$(pkg-config --libs $PKG)\"
7+if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
8+ if ${HOSTPKG_CONFIG} --exists $PKG; then
9+ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
10+ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
1111 exit 0
1212 fi
1313
14− if pkg-config --exists $PKG2; then
15− echo cflags=\"$(pkg-config --cflags $PKG2)\"
16− echo libs=\"$(pkg-config --libs $PKG2)\"
14+ if ${HOSTPKG_CONFIG} --exists $PKG2; then
15+ echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\"
16+ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\"
1717 exit 0
1818 fi
1919 fi
@@ -44,7 +44,7 @@ echo >&2 "* Unable to find the ncurses package." · 24 unmodified lines
4444 echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
4545 echo >&2 "* depending on your distribution)."
4646 echo >&2 "*"
47−echo >&2 "* You may also need to install pkg-config to find the"
47+echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
4848 echo >&2 "* ncurses installed in a non-default location."
4949 echo >&2 "*"
5050 exit 1
scripts/kconfig/qconf-cfg.sh+7−7
@@ -3,22 +3,22 @@ · 2 unmodified lines
33
44 PKG="Qt5Core Qt5Gui Qt5Widgets"
55
6−if [ -z "$(command -v pkg-config)" ]; then
6+if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then
77 echo >&2 "*"
8− echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it."
8+ echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it."
99 echo >&2 "*"
1010 exit 1
1111 fi
1212
13−if pkg-config --exists $PKG; then
14− echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags $PKG)\"
15− echo libs=\"$(pkg-config --libs $PKG)\"
16− echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\"
13+if ${HOSTPKG_CONFIG} --exists $PKG; then
14+ echo cflags=\"-std=c++11 -fPIC $(${HOSTPKG_CONFIG} --cflags $PKG)\"
15+ echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
16+ echo moc=\"$(${HOSTPKG_CONFIG} --variable=host_bins Qt5Core)/moc\"
1717 exit 0
1818 fi
1919
2020 echo >&2 "*"
21−echo >&2 "* Could not find Qt5 via pkg-config."
21+echo >&2 "* Could not find Qt5 via ${HOSTPKG_CONFIG}."
2222 echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH"
2323 echo >&2 "*"
2424 exit 1
tools/objtool/Makefile+2−2
@@ -19,8 +19,8 @@ LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a · 18 unmodified lines
1919 OBJTOOL := $(OUTPUT)objtool
2020 OBJTOOL_IN := $(OBJTOOL)-in.o
2121
22−LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null)
23−LIBELF_LIBS := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
22+LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
23+LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
2424
2525 all: $(OBJTOOL)
2626