Message ID | 1392680233-24585-4-git-send-email-maxime.hadjinlian@gmail.com |
---|---|
State | Accepted |
Headers | show |
Dear Maxime Hadjinlian, On Tue, 18 Feb 2014 00:37:12 +0100, Maxime Hadjinlian wrote: > XBMC needs Java on the host in order to build, because it uses a > code-generator which is build in two phases: > In the first phase SWIG is used to parse C++ header files that define the API. > SWIG outputs an XML file that contains a complete description of the structure > of the API. > In the second phase, the XML file is ingested by a Groovy (Java) program that > then creates C++ code that forms the bridge to the scripting language (Python). > > The second phase is why we need java on the host. People inventing such horrible code generation flows really have a problem. They should probably talk to M-x doctor. > +# Hidden boolean selected by packages in need of Java in order to build > +# (example: xbmc) > +config BR2_HOST_NEEDS_JAVA > + bool Do we need a kconfig bool for this? We have the same situation for classpath, and we haven't introduced a specific kconfig bool for it. Moreover, I am not sure BR2_HOST_NEEDS_JAVA is the right name. It's not really the host that needs Java, it's the compilation process that requires a host Java. So BR2_NEEDS_HOST_JAVA is probably more technically correct. Thanks, Thomas
Hi Thomas, all On Tue, Feb 18, 2014 at 5:18 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Maxime Hadjinlian, > > On Tue, 18 Feb 2014 00:37:12 +0100, Maxime Hadjinlian wrote: >> XBMC needs Java on the host in order to build, because it uses a >> code-generator which is build in two phases: >> In the first phase SWIG is used to parse C++ header files that define the API. >> SWIG outputs an XML file that contains a complete description of the structure >> of the API. >> In the second phase, the XML file is ingested by a Groovy (Java) program that >> then creates C++ code that forms the bridge to the scripting language (Python). >> >> The second phase is why we need java on the host. > > People inventing such horrible code generation flows really have a > problem. They should probably talk to M-x doctor. What can I say ? :) > >> +# Hidden boolean selected by packages in need of Java in order to build >> +# (example: xbmc) >> +config BR2_HOST_NEEDS_JAVA >> + bool > > Do we need a kconfig bool for this? We have the same situation for > classpath, and we haven't introduced a specific kconfig bool for it. Yes, I had two patches: - One to introduce kconfig bool option for JAVAC and JAR - The second to make classpath uses them and remove the specific in dependencies.sh It seems cleaner and if another package has the same needs, it's already there. > > Moreover, I am not sure BR2_HOST_NEEDS_JAVA is the right name. It's not > really the host that needs Java, it's the compilation process that > requires a host Java. So BR2_NEEDS_HOST_JAVA is probably more > technically correct. True, I'll fix that. > > Thanks, > > Thomas Thanks > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com
Dear Maxime Hadjinlian, On Tue, 18 Feb 2014 17:41:17 +0100, Maxime Hadjinlian wrote: > >> +# Hidden boolean selected by packages in need of Java in order to build > >> +# (example: xbmc) > >> +config BR2_HOST_NEEDS_JAVA > >> + bool > > > > Do we need a kconfig bool for this? We have the same situation for > > classpath, and we haven't introduced a specific kconfig bool for it. > Yes, I had two patches: > - One to introduce kconfig bool option for JAVAC and JAR > - The second to make classpath uses them and remove the specific in > dependencies.sh > > It seems cleaner and if another package has the same needs, it's already there. Right, but when it's needed for just one package, it's maybe not needed to have a generic solution. When it starts to be needed by a few packages, then it is time to refactor things and have a generic solution such as the one you propose. But oh well, since you already wrote the code, I'm fine with it. > > Moreover, I am not sure BR2_HOST_NEEDS_JAVA is the right name. It's not > > really the host that needs Java, it's the compilation process that > > requires a host Java. So BR2_NEEDS_HOST_JAVA is probably more > > technically correct. > True, I'll fix that. Cool, thanks. Thomas
>>>>> "Maxime" == Maxime Hadjinlian <maxime.hadjinlian@gmail.com> writes: > XBMC needs Java on the host in order to build, because it uses a > code-generator which is build in two phases: > In the first phase SWIG is used to parse C++ header files that define the API. > SWIG outputs an XML file that contains a complete description of the structure > of the API. > In the second phase, the XML file is ingested by a Groovy (Java) program that > then creates C++ code that forms the bridge to the scripting language (Python). > The second phase is why we need java on the host. > You can learn more at the XBMC's wiki: > http://wiki.xbmc.org/index.php?title=Codegeneration#How_it_works > In order to check that, this patch introduce this mechanism in > dependencies.sh > It also defines the variable in Config.in The commit message is wrapped kind of strange. > +++ b/support/dependencies/dependencies.sh > @@ -191,6 +191,14 @@ if grep -q ^BR2_PACKAGE_CLASSPATH=y $BR2_CONFIG ; then > done > fi > +if grep -q ^BR2_HOST_NEEDS_JAVA=y $BR2_CONFIG ; then > + if ! which java > /dev/null ; then > + echo >&2 > + echo "You must install '$prog' on your build machine" >&2 And it should use 'java' instead of '$prog' here. Committed to next with that fixed, thanks.
diff --git a/Config.in b/Config.in index bcfefc7..8afd156 100644 --- a/Config.in +++ b/Config.in @@ -18,6 +18,11 @@ config BR2_EXTERNAL string option env="BR2_EXTERNAL" +# Hidden boolean selected by packages in need of Java in order to build +# (example: xbmc) +config BR2_HOST_NEEDS_JAVA + 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 0e7e1fa..05039ea 100755 --- a/support/dependencies/dependencies.sh +++ b/support/dependencies/dependencies.sh @@ -191,6 +191,14 @@ if grep -q ^BR2_PACKAGE_CLASSPATH=y $BR2_CONFIG ; then done fi +if grep -q ^BR2_HOST_NEEDS_JAVA=y $BR2_CONFIG ; then + if ! which java > /dev/null ; then + echo >&2 + echo "You must install '$prog' on your build machine" >&2 + exit 1 + fi +fi + if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then if test ! -f /lib/ld-linux.so.2 ; then echo
XBMC needs Java on the host in order to build, because it uses a code-generator which is build in two phases: In the first phase SWIG is used to parse C++ header files that define the API. SWIG outputs an XML file that contains a complete description of the structure of the API. In the second phase, the XML file is ingested by a Groovy (Java) program that then creates C++ code that forms the bridge to the scripting language (Python). The second phase is why we need java on the host. You can learn more at the XBMC's wiki: http://wiki.xbmc.org/index.php?title=Codegeneration#How_it_works In order to check that, this patch introduce this mechanism in dependencies.sh It also defines the variable in Config.in Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> --- Changes v6 -> v7: - Fixes old use of BUILDROOT_CONFIG instead of BR2_CONFIG - Add definition of the variable to Config.in Changes v5 -> v6: - Remove useless loop (Thomas Petazzoni) - Thanks to Martin Bark idea, change this patch to have a non package specific variable. Changes v1 -> v5: - Patch non existant before --- Config.in | 5 +++++ support/dependencies/dependencies.sh | 8 ++++++++ 2 files changed, 13 insertions(+)