All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function
@ 2014-05-03 22:45 Maxime Hadjinlian
  2014-05-03 22:45 ` [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program Maxime Hadjinlian
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Maxime Hadjinlian @ 2014-05-03 22:45 UTC (permalink / raw)
  To: buildroot

Avoid copy/pasting the same block of code to check if a program is
available on the host machine.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
Changes v2 -> v3:
    - None
Changes v1 -> v2:
    - Remove the introduction of BR2_NEEDS_HOST_JAVAC &
      BR2_NEEDS_HOST_JAR to add them in the classpath patch. (Thomas De
      Schampheleire)
---
 support/dependencies/dependencies.sh | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index 0566814..655b4c6 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -51,18 +51,20 @@ if test -n "$PERL_MM_OPT" ; then
 	exit 1
 fi
 
-# Verify that which is installed
-if ! which which > /dev/null ; then
-	echo
-	echo "You must install 'which' on your build machine";
-	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
+}
 
-if ! which sed > /dev/null ; then
-	echo
-	echo "You must install 'sed' on your build machine"
-	exit 1
-fi
+# Verify that which is installed
+check_prog_host "which"
+# Verify that sed is installed
+check_prog_host "sed"
 
 # Check make
 MAKE=$(which make 2> /dev/null)
@@ -196,11 +198,7 @@ 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_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program
  2014-05-03 22:45 [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
@ 2014-05-03 22:45 ` Maxime Hadjinlian
  2014-06-14 17:55   ` Thomas Petazzoni
  2014-05-04 13:30 ` [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Thomas De Schampheleire
  2014-06-14 17:54 ` Thomas Petazzoni
  2 siblings, 1 reply; 5+ messages in thread
From: Maxime Hadjinlian @ 2014-05-03 22:45 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.

Also, introduce, BR2_NEEDS_HOST_JAVAC and BR2_NEEDS_HOST_JAR as it is
needed by classpath.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
Changes v2 -> v3:
    - Fix commit log
Changes v1 -> v2:
    - Add the introduction of BR2_NEEDS_HOST_JAVAC & BR2_NEEDS_HOST_JAR
      in this patch instead of the previous one.
---
 Config.in                            | 10 ++++++++++
 package/classpath/Config.in          |  2 ++
 support/dependencies/dependencies.sh | 18 ++++++++----------
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/Config.in b/Config.in
index 79a455d..0d90ecc 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/package/classpath/Config.in b/package/classpath/Config.in
index 0153bca..a11845c 100644
--- a/package/classpath/Config.in
+++ b/package/classpath/Config.in
@@ -1,5 +1,7 @@
 config BR2_PACKAGE_CLASSPATH
 	bool "classpath"
+	select BR2_NEEDS_HOST_JAR
+	select BR2_NEEDS_HOST_JAVAC
 	depends on BR2_PACKAGE_JAMVM
 	depends on BR2_INET_IPV6
 	help
diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index 655b4c6..255a07b 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -187,20 +187,18 @@ 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
 
+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
 	if test ! -f /lib/ld-linux.so.2 ; then
 		echo
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function
  2014-05-03 22:45 [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
  2014-05-03 22:45 ` [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program Maxime Hadjinlian
@ 2014-05-04 13:30 ` Thomas De Schampheleire
  2014-06-14 17:54 ` Thomas Petazzoni
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas De Schampheleire @ 2014-05-04 13:30 UTC (permalink / raw)
  To: buildroot

Maxime Hadjinlian <maxime.hadjinlian@gmail.com> schreef:
>Avoid copy/pasting the same block of code to check if a program is
>available on the host machine.
>
>Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>

Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

As mentioned in the discussion of v1, there are many more improvements possible in dependencies.sh, but these can be done in a later patch...

Best regards,
Thomas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function
  2014-05-03 22:45 [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
  2014-05-03 22:45 ` [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program Maxime Hadjinlian
  2014-05-04 13:30 ` [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Thomas De Schampheleire
@ 2014-06-14 17:54 ` Thomas Petazzoni
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2014-06-14 17:54 UTC (permalink / raw)
  To: buildroot

Dear Maxime Hadjinlian,

On Sun,  4 May 2014 00:45:43 +0200, Maxime Hadjinlian wrote:
> Avoid copy/pasting the same block of code to check if a program is
> available on the host machine.
> 
> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> ---
> Changes v2 -> v3:
>     - None
> Changes v1 -> v2:
>     - Remove the introduction of BR2_NEEDS_HOST_JAVAC &
>       BR2_NEEDS_HOST_JAR to add them in the classpath patch. (Thomas De
>       Schampheleire)

Applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program
  2014-05-03 22:45 ` [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program Maxime Hadjinlian
@ 2014-06-14 17:55   ` Thomas Petazzoni
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2014-06-14 17:55 UTC (permalink / raw)
  To: buildroot

Dear Maxime Hadjinlian,

On Sun,  4 May 2014 00:45:44 +0200, Maxime Hadjinlian wrote:
> Remove the specific check that was done in dependencies.sh to use the
> generic one that were introduced by the previous patch.
> 
> Also, introduce, BR2_NEEDS_HOST_JAVAC and BR2_NEEDS_HOST_JAR as it is
> needed by classpath.
> 
> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
> Changes v2 -> v3:
>     - Fix commit log
> Changes v1 -> v2:
>     - Add the introduction of BR2_NEEDS_HOST_JAVAC & BR2_NEEDS_HOST_JAR
>       in this patch instead of the previous one.

Applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-14 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-03 22:45 [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Maxime Hadjinlian
2014-05-03 22:45 ` [Buildroot] [PATCH v3 2/2] classpath: Use generic check for host program Maxime Hadjinlian
2014-06-14 17:55   ` Thomas Petazzoni
2014-05-04 13:30 ` [Buildroot] [PATCH v3 1/2] infra: Add generic check_prog_host function Thomas De Schampheleire
2014-06-14 17:54 ` Thomas Petazzoni

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.