The Vala compiler also supports a language called Genie, which is very similar to Python but compiles down to C in the same way that Vala does. Genie files can be mixed with Vala files on the command line.
https://wiki.gnome.org/Projects/Genie Automake does not currently support files with the extension .gs - this is easily confirmed by adding one to the _SOURCE primary for a Vala project. This patch adds support for Genie files. The patch includes modifications to the existing Vala tests to ensure that it functions correctly. The patch does not appear to affect any other modules when the entire test suite is run. -- Chris Daley Pacific Northwest e: chebiza...@gmail.com w: http://chrisdaley.biz tw: chebizarro tz: PDT
diff --git a/bin/automake.in b/bin/automake.in index 3abee49..046848b 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -704,7 +704,7 @@ register_language ('name' => 'vala', 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)', 'ccer' => 'VALAC', 'compiler' => 'VALACOMPILE', - 'extensions' => ['.vala', '.vapi'], + 'extensions' => ['.vala', '.gs', '.vapi'], # Vala compilation must be handled in a special way, so # nothing to do or return here. 'output_extensions' => sub { }, @@ -5361,6 +5361,7 @@ sub lang_vala_rewrite { my ($directory, $base, $ext) = @_; $ext =~ s/vala$/c/; + $ext =~ s/gs$/c/; return $ext; } @@ -5395,7 +5396,7 @@ sub lang_vala_finish_target my $var = var "${derived}_SOURCES"; return unless $var; - my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive); + my @vala_sources = grep { /\.(vala|vapi|gs)$/ } ($var->value_as_list_recursive); # For automake bug#11229. return unless @vala_sources; @@ -5403,7 +5404,7 @@ sub lang_vala_finish_target foreach my $vala_file (@vala_sources) { my $c_file = $vala_file; - if ($c_file =~ s/(.*)\.vala$/$1.c/) + if ($c_file =~ s/(.*)\.vala$/$1.c/ or $c_file =~ s/(.*)\.gs$/$1.c/) { $c_file = "\$(srcdir)/$c_file"; $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n" diff --git a/t/vala-grepping.sh b/t/vala-grepping.sh index dc84b3c..a84ae8c 100644 --- a/t/vala-grepping.sh +++ b/t/vala-grepping.sh @@ -42,14 +42,14 @@ zardoz_SOURCES = zardoz.vala zardoz_VALAFLAGS = --debug lib_LTLIBRARIES = libzardoz.la -libzardoz_la_SOURCES = zardoz-foo.vala zardoz-bar.vala +libzardoz_la_SOURCES = zardoz-foo.vala zardoz-bar.gs END mkdir sub cat > sub/Makefile.am <<'END' bin_PROGRAMS = foo -foo_SOURCES = bar.vala baz.vala mu.c zap.cxx +foo_SOURCES = bar.vala baz.gs mu.c zap.cxx END : > ltmain.sh diff --git a/t/vala-mix.sh b/t/vala-mix.sh index 7786108..98a764d 100644 --- a/t/vala-mix.sh +++ b/t/vala-mix.sh @@ -31,7 +31,7 @@ bin_PROGRAMS = zardoz mu baz AM_CFLAGS = $(GOBJECT_CFLAGS) LDADD = $(GOBJECT_LIBS) zardoz_SOURCES = foo.vala bar.c -mu_SOURCES = 1.vala 2.c +mu_SOURCES = 1.vala 2.c 3.gs mu_VALAFLAGS = --main=run mu_CFLAGS = -DHAVE_MU $(AM_CFLAGS) baz_SOURCES = baz.c @@ -74,6 +74,12 @@ chocke me #endif END +cat > 3.gs <<'END' +[indent=4] +def stop(): void + stdout.printf ("Goodbye World!\n"); +END + # For automake bug#11229. cat > baz.c <<'END' int main (void) @@ -98,6 +104,7 @@ have_generated_files () test -f zardoz_vala.stamp test -f foo.c test -f 1.c + test -f 3.c } # Our vala-related rules must create stamp files and intermediate diff --git a/t/vala-parallel.sh b/t/vala-parallel.sh index 079bd95..7a98b9f 100644 --- a/t/vala-parallel.sh +++ b/t/vala-parallel.sh @@ -31,7 +31,7 @@ cat > Makefile.am <<'END' bin_PROGRAMS = zardoz AM_CFLAGS = $(GOBJECT_CFLAGS) LDADD = $(GOBJECT_LIBS) -zardoz_SOURCES = main.vala 1.vala 2.vala 3.vala 4.vala 5.vala 6.vala +zardoz_SOURCES = main.vala 1.vala 2.vala 3.vala 4.vala 5.vala 6.vala 7.gs END echo 'int main () {' > main.vala @@ -39,6 +39,10 @@ for i in 1 2 3 4 5 6; do echo "void foo$i () { stdout.printf (\"ok $i\\n\"); }" > $i.vala echo "foo$i ();" >> main.vala done +echo "[indent=4]" > 7.gs +echo "def foo7():void" >> 7.gs +echo " stdout.printf (\"ok 7\\n\")" >> 7.gs +echo "foo7 ();" >> main.vala echo 'return 0; }' >> main.vala cat main.vala # For debugging. @@ -51,12 +55,12 @@ $AUTOCONF $MAKE -j3 ls -l # For debugging. -for x in main 1 2 3 4 5 6; do test -f $x.c; done +for x in main 1 2 3 4 5 6 7; do test -f $x.c; done test -f zardoz_vala.stamp $MAKE maintainer-clean -j4 ls -l # For debugging. -for x in main 1 2 3 4 5 6; do test ! -e $x.c; done +for x in main 1 2 3 4 5 6 7; do test ! -e $x.c; done test ! -e zardoz_vala.stamp mkdir build @@ -64,13 +68,13 @@ cd build ../configure $MAKE -j6 ls -l . .. # For debugging. -for x in main 1 2 3 4 5 6; do test -f ../$x.c; done +for x in main 1 2 3 4 5 6 7; do test -f ../$x.c; done test -f ../zardoz_vala.stamp $MAKE distcheck -j4 $MAKE maintainer-clean -j2 -for x in main 1 2 3 4 5 6; do test ! -e ../$x.c; done +for x in main 1 2 3 4 5 6 7; do test ! -e ../$x.c; done test ! -e ../zardoz_vala.stamp : diff --git a/t/vala-vpath.sh b/t/vala-vpath.sh index fdb802f..eb59fe1 100644 --- a/t/vala-vpath.sh +++ b/t/vala-vpath.sh @@ -34,7 +34,7 @@ AM_CFLAGS = $(GOBJECT_CFLAGS) LDADD = $(GOBJECT_LIBS) foo_SOURCES = hello.vala bar_VALAFLAGS = -H zardoz.h -bar_SOURCES = goodbye.vala +bar_SOURCES = goodbye.gs END cat > hello.vala <<'END' @@ -43,7 +43,13 @@ void main () stdout.printf ("foofoofoo\n"); } END -cp hello.vala goodbye.vala + +cat > goodbye.gs <<'END' +[indent=2] +init + stdout.printf ("foofoofoo\n") + +END $ACLOCAL $AUTOCONF