Gentoo Archives: gentoo-dev

From: Mike Pagano <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v4] linux-info.eclass : Support valid Make files
Date: Fri, 03 Sep 2021 14:25:28
Message-Id: 32f1c906-861c-d58b-5484-578a3740dee5@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH v3] linux-info.eclass : Support valid Make files by Ulrich Mueller
1 Thanks to Sam, mgorny and Ulm for the review.
2
3 Incorporated all requested changes
4
5 Support the possibility that the Makefile could be
6 one of the following and should be checked in
7 the order described here:
8
9 https://www.gnu.org/software/make/manual/make.html
10
11 Order of checking and valid Makefiles names:
12 GNUMakefile, makefile, Makefile
13
14 Bug: https://bugs.gentoo.org/663368
15
16 Signed-off-by: Mike Pagano <mpagano@g.o>
17 ---
18 eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
19 1 file changed, 26 insertions(+), 4 deletions(-)
20
21 diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
22 index 0b6df1bf5..1379b6008 100644
23 --- a/eclass/linux-info.eclass
24 +++ b/eclass/linux-info.eclass
25 @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
26 # There are also a couple of variables which are set by this, and shouldn't be
27 # set by hand. These are as follows:
28
29 +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
30 +# @INTERNAL
31 +# @DESCRIPTION:
32 +# According to upstream documentation, by default, when make looks for the makefile, it tries
33 +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
34 +# proper Makefile name or the eclass will search in this order for it.
35 +# See https://www.gnu.org/software/make/manual/make.html
36 +: ${KERNEL_MAKEFILE:=""}
37 +
38 # @ECLASS-VARIABLE: KV_FULL
39 # @OUTPUT_VARIABLE
40 # @DESCRIPTION:
41 @@ -510,7 +519,9 @@ get_version() {
42 qeinfo " ${KV_DIR}"
43 fi
44
45 - if [ ! -s "${KV_DIR}/Makefile" ]
46 + kernel_get_makefile
47 +
48 + if [[ ! -s ${KERNEL_MAKEFILE} ]]
49 then
50 if [ -z "${get_version_warning_done}" ]; then
51 get_version_warning_done=1
52 @@ -526,9 +537,6 @@ get_version() {
53 # do we pass KBUILD_OUTPUT on the CLI?
54 local OUTPUT_DIR=${KBUILD_OUTPUT}
55
56 - # keep track of it
57 - KERNEL_MAKEFILE="${KV_DIR}/Makefile"
58 -
59 if [[ -z ${OUTPUT_DIR} ]]; then
60 # Decide the function used to extract makefile variables.
61 local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
62 @@ -971,3 +979,17 @@ linux-info_pkg_setup() {
63
64 [ -n "${CONFIG_CHECK}" ] && check_extra_config;
65 }
66 +
67 +# @FUNCTION: kernel_get_makefile
68 +# @DESCRIPTION:
69 +# Support the possibility that the Makefile could be one of the following and should
70 +# be checked in the order described here:
71 +# https://www.gnu.org/software/make/manual/make.html
72 +# Order of checking and valid Makefiles names: GNUMakefile, makefile, Makefile
73 +kernel_get_makefile() {
74 +
75 + [[ -s ${KV_DIR}/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile"
76 + [[ -s ${KV_DIR}/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile"
77 + [[ -s ${KV_DIR}/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile"
78 +
79 +}
80 --
81 2.32.0

Replies