Gentoo Archives: gentoo-dev

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