* [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function
@ 2014-02-23 12:57 Maxime Hadjinlian
2014-02-23 12:57 ` [Buildroot] [PATCH 2/2] classpath: Use generic check for host program Maxime Hadjinlian
2014-02-23 14:04 ` [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Maxime Hadjinlian @ 2014-02-23 12:57 UTC (permalink / raw)
To: buildroot
Avoid copy/pasting the same block of code to check if a program is
available on the host machine.
Also, introduce, BR2_NEEDS_HOST_JAVAC and BR2_NEEDS_HOST_JAR.
In a following patch, we will remove the specific check done for
classpath, and the classpath package will use these generic variant.
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
Config.in | 10 ++++++++++
support/dependencies/dependencies.sh | 24 +++++++++++++++++++-----
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/Config.in b/Config.in
index 55f5fd8..a24421f 100644
--- a/Config.in
+++ b/Config.in
@@ -23,6 +23,16 @@ config BR2_EXTERNAL
config BR2_NEEDS_HOST_JAVA
bool
+# Hidden boolean selected by packages in need of javac in order to build
+# (example: classpath)
+config BR2_NEEDS_HOST_JAVAC
+ bool
+
+# Hidden boolean selected by packages in need of jar in order to build
+# (example: classpath)
+config BR2_NEEDS_HOST_JAR
+ bool
+
# Hidden boolean selected by pre-built packages for x86, when they
# need to run on x86-64 machines (example: pre-built external
# toolchains, binary tools like SAM-BA, etc.).
diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index a8261b3..e5a6e36 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -64,6 +64,16 @@ if ! which sed > /dev/null ; then
exit 1
fi
+check_prog_host()
+{
+ prog="$1"
+ if ! which $prog > /dev/null ; then
+ echo >&2
+ echo "You must install '$prog' on your build machine" >&2
+ exit 1
+ fi
+}
+
# Check make
MAKE=$(which make 2> /dev/null)
if [ -z "$MAKE" ] ; then
@@ -192,11 +202,15 @@ if grep -q ^BR2_PACKAGE_CLASSPATH=y $BR2_CONFIG ; then
fi
if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
- if ! which java > /dev/null ; then
- echo >&2
- echo "You must install 'java' on your build machine" >&2
- exit 1
- fi
+ check_prog_host "java"
+fi
+
+if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
+ check_prog_host "javac"
+fi
+
+if grep -q ^BR2_NEEDS_HOST_JAR=y $BR2_CONFIG ; then
+ check_prog_host "jar"
fi
if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
--
1.8.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 2/2] classpath: Use generic check for host program
2014-02-23 12:57 [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
@ 2014-02-23 12:57 ` Maxime Hadjinlian
2014-02-23 14:04 ` [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Thomas Petazzoni
1 sibling, 0 replies; 4+ messages in thread
From: Maxime Hadjinlian @ 2014-02-23 12:57 UTC (permalink / raw)
To: buildroot
Remove the specific check that was done in dependencies.sh to use the
generic one that were introduced by the previous patch.
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
package/classpath/Config.in | 2 ++
support/dependencies/dependencies.sh | 10 ----------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/package/classpath/Config.in b/package/classpath/Config.in
index 0153bca..6eabacd 100644
--- a/package/classpath/Config.in
+++ b/package/classpath/Config.in
@@ -1,5 +1,7 @@
config BR2_PACKAGE_CLASSPATH
bool "classpath"
+ select BR2_HOST_NEEDS_JAVAC
+ select BR2_HOST_NEEDS_JAR
depends on BR2_PACKAGE_JAMVM
depends on BR2_INET_IPV6
help
diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index e5a6e36..e9d2613 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -191,16 +191,6 @@ if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \
fi
fi
-if grep -q ^BR2_PACKAGE_CLASSPATH=y $BR2_CONFIG ; then
- for prog in javac jar; do
- if ! which $prog > /dev/null ; then
- echo >&2
- echo "You must install '$prog' on your build machine" >&2
- exit 1
- fi
- done
-fi
-
if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
check_prog_host "java"
fi
--
1.8.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function
2014-02-23 12:57 [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
2014-02-23 12:57 ` [Buildroot] [PATCH 2/2] classpath: Use generic check for host program Maxime Hadjinlian
@ 2014-02-23 14:04 ` Thomas Petazzoni
2014-02-23 16:06 ` Maxime Hadjinlian
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2014-02-23 14:04 UTC (permalink / raw)
To: buildroot
Dear Maxime Hadjinlian,
On Sun, 23 Feb 2014 13:57:20 +0100, Maxime Hadjinlian wrote:
> diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
> index a8261b3..e5a6e36 100755
> --- a/support/dependencies/dependencies.sh
> +++ b/support/dependencies/dependencies.sh
> @@ -64,6 +64,16 @@ if ! which sed > /dev/null ; then
> exit 1
> fi
>
> +check_prog_host()
> +{
> + prog="$1"
> + if ! which $prog > /dev/null ; then
> + echo >&2
> + echo "You must install '$prog' on your build machine" >&2
> + exit 1
> + fi
> +}
This seems like a good direction. However:
1/ It would be nice if we could use it for the other similar cases in
dependencies.sh. You will maybe have to extend the function with a
second argument that would be the name of the package to install on
typical distributions, since for some programs, we suggest the user
which package should be installed, when it is not obvious from
looking at the name of the missing program.
2/ We should rework dependencies.sh so that it does *all* its checks,
and only at the end abort the build if some error was detected.
It's quite annoying to start the build, see that a program is
missing, install it, restart the build, see that another program is
missing and so on.
1/ is I believe a natural extension of what you're proposing here, and
could be included in your patch set.
2/ involves much more work, and we can certainly consider it as a
separate work, to be done as a separate patch set.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function
2014-02-23 14:04 ` [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Thomas Petazzoni
@ 2014-02-23 16:06 ` Maxime Hadjinlian
0 siblings, 0 replies; 4+ messages in thread
From: Maxime Hadjinlian @ 2014-02-23 16:06 UTC (permalink / raw)
To: buildroot
Hi Thomas, all
On Sun, Feb 23, 2014 at 3:04 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Maxime Hadjinlian,
>
> On Sun, 23 Feb 2014 13:57:20 +0100, Maxime Hadjinlian wrote:
>
>> diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
>> index a8261b3..e5a6e36 100755
>> --- a/support/dependencies/dependencies.sh
>> +++ b/support/dependencies/dependencies.sh
>> @@ -64,6 +64,16 @@ if ! which sed > /dev/null ; then
>> exit 1
>> fi
>>
>> +check_prog_host()
>> +{
>> + prog="$1"
>> + if ! which $prog > /dev/null ; then
>> + echo >&2
>> + echo "You must install '$prog' on your build machine" >&2
>> + exit 1
>> + fi
>> +}
>
> This seems like a good direction. However:
>
> 1/ It would be nice if we could use it for the other similar cases in
> dependencies.sh. You will maybe have to extend the function with a
> second argument that would be the name of the package to install on
> typical distributions, since for some programs, we suggest the user
> which package should be installed, when it is not obvious from
> looking at the name of the missing program.
>
> 2/ We should rework dependencies.sh so that it does *all* its checks,
> and only at the end abort the build if some error was detected.
> It's quite annoying to start the build, see that a program is
> missing, install it, restart the build, see that another program is
> missing and so on.
>
> 1/ is I believe a natural extension of what you're proposing here, and
> could be included in your patch set.
You are right, I can also uses check_prog_host for which and sed.
That's what I have modified for the v2 of this patch.
The other check (for the host compiler, locale, various tools, ...)
have different kind of smarts to do, which would need a rework like
what you have in mind for 2/. So I let them alone for the time being.
>
> 2/ involves much more work, and we can certainly consider it as a
> separate work, to be done as a separate patch set.
Agreed, this will be another patch.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-23 16:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-23 12:57 [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
2014-02-23 12:57 ` [Buildroot] [PATCH 2/2] classpath: Use generic check for host program Maxime Hadjinlian
2014-02-23 14:04 ` [Buildroot] [PATCH 1/2] infra: Add generic check_prog_host function Thomas Petazzoni
2014-02-23 16:06 ` Maxime Hadjinlian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox