From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] toolchain package: set version as 'virtual' instead of 'undefined'
Date: Thu, 08 May 2014 10:31:43 +0200 [thread overview]
Message-ID: <536B40EF.7060700@mind.be> (raw)
In-Reply-To: <CAAXf6LX19u3q95iMO5sUReKPdHwiuAnup0mXFJN2_-14mqnOMw@mail.gmail.com>
On 08/05/14 09:04, Thomas De Schampheleire wrote:
> Hi,
>
> On Wed, May 7, 2014 at 9:37 PM, Thomas De Schampheleire
> <patrickdepinguin@gmail.com> wrote:
> [..]
>
>>>> I tried using virtual-package in toolchain/toolchain/toolchain.mk, but TOOLCHAIN_VERSION becomes empty, while HOST_TOOLCHAIN_VERSION is virtual.
>
> [..]
>
> Some more feedback: I stepped away from toolchain and added a simple
> test package 'mytest' as below.
> I added a debug target 'bar' and some variable assignment in pkg-generic.mk.
>
>
> diff --git a/package/mytest/mytest.mk b/package/mytest/mytest.mk
> new file mode 100644
> --- /dev/null
> +++ b/package/mytest/mytest.mk
> @@ -0,0 +1,10 @@
> +
> +$(eval $(virtual-package))
> +
> +bar:
> + @echo MYTEST_VERSION = $(MYTEST_VERSION)
> + @echo HOST_MYTEST_VERSION = $(HOST_MYTEST_VERSION)
> + @echo MYTEST_X = $(MYTEST_X)
> + @echo MYTEST_Y = $(MYTEST_Y)
> + @echo HOST_MYTEST_X = $(HOST_MYTEST_X)
> + @echo HOST_MYTEST_Y = $(HOST_MYTEST_Y)
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -262,6 +262,12 @@ define inner-generic-package
> # sanitize the package version that is used in paths, directory and file names.
> # Forward slashes may appear in the package's version when pointing to a
> # version control system branch or tag, for example remotes/origin/1_10_stable.
> +
> +ifdef $(2)_VERSION
> + $(2)_X := $(subst /,_,$($(2)_VERSION))
> + $(2)_Y := $(subst /,_,$$($(2)_VERSION))
> +endif
> +
> ifndef $(2)_VERSION
> ifdef $(3)_VERSION
> $(2)_DL_VERSION = $($(3)_VERSION)
>
>
> In pkg-generic.mk, the _VERSION variables are defined, and there is a
> subst() statement to replace / with _.
> My conclusion is that the line with the subst statement does not work
> when _VERSION is set like in virtual-package.
>
> The output of 'make bar' is:
> MYTEST_VERSION =
> HOST_MYTEST_VERSION = virtual
> MYTEST_X =
> MYTEST_Y = virtual
> HOST_MYTEST_X =
> HOST_MYTEST_Y =
>
> X is using the standard subst line as pkg-generic is using, while Y
> adds an extra dollar sign.
> When the version is set directly, as in MYTEST_VERSION = bla, then X
> seems to be correct. This is the way buildroot works today. However,
> when the version is set indirectly from an inner-xxx-package, like
> $(3)_VERSION, then X no longer works but Y does. However, adding an
> extra dollar by default doesn't work for the normal packages.
>
> So how to proceed? Any experts in the inner-xxx-package and make internals?
> Arnout, ThomasP, Yann?
Let me see if I can analyse it.
$(eval $(virtual-package))
recursively expands to:
$(eval
...
MYTEST_VERSION = virtual
HOST_MYTEST_VERSION = virtual
...
# expansion of inner-generic-package
# ** At this point MYTEST_VERSION is not set yet! **
ifdef MYTEST_VERSION
MYTEST_X :=
MYTEST_Y := $$(MYTEST_VERSION)
endif
ifndef MYTEST_VERSION
ifdef MYTEST_VERSION
MYTEST_DL_VERSION =
MYTEST_VERSION =
else
MYTEST_VERSION = undefined
MYTEST_DL_VERSION = undefined
endif
else
MYTEST_DL_VERSION =
MYTEST_VERSION =
endif
...
) #eval
I repeat my earlier statement: within a function that is supposed to be
eval'ed, *everything* should be $$'ed except the function arguments and except
some very specific cases.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
next prev parent reply other threads:[~2014-05-08 8:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 10:51 [Buildroot] [PATCH] toolchain package: set version as 'virtual' instead of 'undefined' Thomas De Schampheleire
2014-05-06 12:07 ` Thomas Petazzoni
2014-05-06 12:26 ` Thomas De Schampheleire
2014-05-06 12:38 ` Thomas Petazzoni
2014-05-06 12:46 ` Thomas De Schampheleire
2014-05-08 6:59 ` Arnout Vandecappelle
2014-05-06 20:05 ` Thomas De Schampheleire
2014-05-07 19:26 ` Thomas De Schampheleire
2014-05-07 19:37 ` Thomas De Schampheleire
2014-05-08 7:04 ` Thomas De Schampheleire
2014-05-08 8:31 ` Arnout Vandecappelle [this message]
2014-05-08 9:28 ` Thomas De Schampheleire
2014-05-08 9:52 ` Arnout Vandecappelle
2014-05-08 11:37 ` Thomas De Schampheleire
2014-05-08 13:00 ` Arnout Vandecappelle
2014-05-08 20:03 ` Thomas De Schampheleire
2014-05-08 22:18 ` Arnout Vandecappelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=536B40EF.7060700@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.