[Buildroot] [PATCH 1/3] vala: add vala/valac wrapper

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sun Feb 21 21:28:16 UTC 2016


Gustavo,

On Tue,  2 Feb 2016 13:01:46 -0300, Gustavo Zacarias wrote:

> +# We wrap vala & valac to point to the proper gir and vapi data dirs
> +# Otherwise we'll get host directory data which isn't enough
> +define HOST_VALA_INSTALL_WRAPPER
> +	$(INSTALL) -D -m 0755 package/vala/vala-wrapper \
> +		$(HOST_DIR)/usr/bin/vala
> +	$(INSTALL) -D -m 0755 package/vala/vala-wrapper \
> +		$(HOST_DIR)/usr/bin/valac
> +	$(SED) 's, at VALA_VERSION@,$(VALA_VERSION_MAJOR),' \
> +		$(HOST_DIR)/usr/bin/vala
> +	$(SED) 's, at STAGING_DIR@,$(STAGING_DIR),g' \
> +		$(HOST_DIR)/usr/bin/vala
> +	$(SED) 's, at VALA_VERSION@,$(VALA_VERSION_MAJOR),' \
> +		$(HOST_DIR)/usr/bin/valac
> +	$(SED) 's, at STAGING_DIR@,$(STAGING_DIR),g' \
> +		$(HOST_DIR)/usr/bin/valac
> +endef
> +HOST_VALA_POST_INSTALL_HOOKS += HOST_VALA_INSTALL_WRAPPER

So if I understand correctly, the idea is to replace the vala ->
vala-3.0 and valac -> valac-3.0 symbolic links by wrappers.

So I did a test, first without your patch, with a stupid vala hello
world program:

thomas at skate:~/projets/buildroot (next)$ cat > pouet.vala
class Demo.HelloWorld : GLib.Object {

    public static int main(string[] args) {

        stdout.printf("Hello, World\n");

        return 0;
    }
}
thomas at skate:~/projets/buildroot (next)$ ./output/host/usr/bin/vala pouet.vala 
Hello, World
thomas at skate:~/projets/buildroot (next)$ ./output/host/usr/bin/valac pouet.vala 
thomas at skate:~/projets/buildroot (next)$ file pouet
pouet: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d13ab11a4b8d24623f8ead3e8e3c1c9e73d16df0, not stripped

So, the program runs fine on the host with "vala", and compiles to a
x86-64 executable. Not really surprising since it's a host-vala
installation not tuned for cross-compilation.

Then, I apply your patch, rebuild host-vala, and do the same test:

thomas at skate:~/projets/buildroot (next)$ ./output/host/usr/bin/vala pouet.vala 
error: --girdir=/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/share/gir-1.0 not found

What package is supposed to install gir-1.0 in staging ?

thomas at skate:~/projets/buildroot (next)$ ./output/host/usr/bin/valac pouet.vala 
thomas at skate:~/projets/buildroot (next)$ file pouet
pouet: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d13ab11a4b8d24623f8ead3e8e3c1c9e73d16df0, not stripped

But it still compiles to a host binary. Am I missing something ?

Could you improve the commit log with more explanations for people
(like me) who don't know vala, and don't understand what your patch is
fixing exactly ?

Thanks!

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


More information about the buildroot mailing list