+2009-04-05 Jürg Billeter <j@bitron.ch>
+
+ Improve Vala support.
+ * automake.in: Update to Vala 0.7.0 semantics, recover from removal
+ of built sources, support silent-rules, drop _PKGNAME variables
+ * doc/automake.texi, NEWS: Update.
+ * lib/am/vala.am: Bump copyright years.
+ * m4/vala.m4: Likewise.
+ * tests/vala.test: Remove obsolete grep tests.
+ * tests/vala1.test: Likewise.
+ * tests/vala2.test: Test full build, distcheck, and distclean.
+ * tests/vala3.test: Likewise, also test with subdir-objects.
+ * tests/vala4.test: Bump copyright years.
+ * tests/vala5.test: New test for per-target flags, expected to fail.
+ * tests/Makefile.am: Update.
+ * THANKS: Update.
+
2008-10-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Minor fixups for Vala support.
* Languages changes:
- - Vala source files are recognized now.
+ - Vala 0.7.0 and later is supported now.
* Miscellaneous Changes:
Juergen Keil jk@tools.de
Juergen Leising juergen.leising@gmx.de
Julien Sopena julien.sopena@lip6.fr
+Jürg Billeter j@bitron.ch
Karl Berry kb@cs.umb.edu
Karl Heuer kwzh@gnu.org
Kelley Cook kcook@gcc.gnu.org
Martin Waitz tali@admingilde.org
Mathias Doreille doreille@smr.ch
Mathias Froehlich M.Froehlich@science-computing.de
+Mathias Hasselmann mathias.hasselmann@gmx.de
Matt Leach mleach@cygnus.com
Matthew D. Langston langston@SLAC.Stanford.EDU
Matthias Andree matthias.andree@gmx.de
'config_vars' => ['VALAC'],
'flags' => ['VALAFLAGS'],
'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
+ 'ccer' => 'VALAC',
'compiler' => 'VALACOMPILE',
'extensions' => ['.vala'],
- 'output_extensions' => sub { (my $ext1 = $_[0]) =~ s/vala$/c/;
- (my $ext2 = $_[0]) =~ s/vala$/h/;
- return ($ext1, $ext2) },
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
+ return ($ext,) },
'rule_file' => 'vala',
'_finish' => \&lang_vala_finish,
'_target_hook' => \&lang_vala_target_hook,
}
}
-sub lang_vala_finish_target ($$$)
+sub lang_vala_finish_target ($$)
{
- my ($self, $name, $pkgname) = @_;
+ my ($self, $name) = @_;
my $derived = canonicalize ($name);
my $varname = $derived . '_SOURCES';
{
foreach my $file ($var->value_as_list_recursive)
{
- $output_rules .= "$file: ${derived}_vala.stamp\n"
- if ($file =~ s/(.*)\.vala$/$1.c $1.h/);
+ $output_rules .= "$file: ${derived}_vala.stamp\n".
+ "\t\@if test -f \$@; then :; else \\\n".
+ "\t rm -f ${derived}_vala.stamp; \\\n".
+ "\t \$(MAKE) \$(AM_MAKEFLAGS) ${derived}_vala.stamp; \\\n".
+ "\tfi\n"
+ if $file =~ s/(.*)\.vala$/$1.c/;
}
}
my $compile = $self->compile;
- if (defined ($pkgname))
- {
- $varname = $derived . '_PKGNAME';
- $var = var ($varname);
-
- $pkgname = $var->variable_value if $var;
- $compile =~s/\$\(AM_VALAFLAGS\)/--library=$pkgname $&/;
- }
-
# Rewrite each occurrence of `AM_$flag' in the compile
# rule into `${derived}_$flag' if it exists.
for my $flag (@{$self->flags})
my $dirname = dirname ($name);
- $compile .= " -d $dirname" if $dirname ne '.';
+ # Only generate C code, do not run C compiler
+ $compile .= " -C";
+
+ my $verbose = verbose_flag ('VALAC');
+ my $silent = silent_flag ();
$output_rules .=
"${derived}_vala.stamp: \$(${derived}_SOURCES)\n".
- "\t${compile} \$^ && touch \$@\n";
+ "\t${verbose}${compile} \$(${derived}_SOURCES)\n".
+ "\t${silent}touch \$@\n";
+
+ push_dist_common ("${derived}_vala.stamp");
+
+ $clean_files{"${derived}_vala.stamp"} = MAINTAINER_CLEAN;
}
-# This is a vala helper which is called after all source file
-# processing is done.
+# Add output ruless to invoke valac and create stamp file as a witness
+# to handle multiple outputs. This function is called after all source
+# file processing is done.
sub lang_vala_finish
{
my ($self) = @_;
foreach my $prog (keys %known_programs)
{
- lang_vala_finish_target ($self, $prog, 0);
+ lang_vala_finish_target ($self, $prog);
}
- while (my ($name, $pkgname) = each %known_libraries)
+ while (my ($name) = each %known_libraries)
{
- lang_vala_finish_target ($self, $name, $pkgname);
+ lang_vala_finish_target ($self, $name);
}
}
-# This is a vala helper which is called whenever we have decided to
-# compile a vala file.
+# The built .c files should be cleaned only on maintainer-clean
+# as the .c files are distributed. This function is called for each
+# .vala source file.
sub lang_vala_target_hook
{
my ($self, $aggregate, $output, $input, %transform) = @_;
- (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//;
- my $header = $output_base . '.h';
-
- &push_dist_common ($header);
-
- $clean_files{$header} = MAINTAINER_CLEAN;
$clean_files{$output} = MAINTAINER_CLEAN;
}
@cindex Vala Support
@cindex Support for Vala
-Automake provides support for Vala compilation
-(@uref{http://live.gnome.org/@/Vala}).
+Automake provides support for Vala (@uref{http://www.vala-project.org/}).
+This requires valac version 0.7.0 or later.
@example
foo_SOURCES = foo.vala bar.vala zardoc.c
@end example
Any @file{.vala} file listed in a @code{_SOURCE} variable will be
-compiled into C code by the Vala compiler.
+compiled into C code by the Vala compiler. The generated @file{.c} files are
+distributed. The end user does not need to have a Vala compiler installed.
Automake ships with an Autoconf macro called @code{AM_PROG_VALAC}
that will locate the Vala compiler and optionally check its version
can be requested:
@example
-AM_PROG_VALAC([0.1.3])
+AM_PROG_VALAC([0.7.0])
@end example
@end defmac
@item AM_VALAFLAGS
The maintainer's variant of @code{VALAFLAGS}.
-@item PKGNAME
-The pkg-config
-(@uref{http://www.freedesktop.org/@/software/@/pkgconfig/}) and VAPI
-(Vala API definition file) name to use when building Vala based library.
-
@example
lib_LTLIBRARIES = libfoo.la
-libfoo_la_PKGNAME = foo-2.0
libfoo_la_SOURCES = foo.vala
@end example
@end vtable
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2008 Free Software Foundation, Inc.
+## Copyright (C) 2008, 2009 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
# Autoconf support for the Vala compiler
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
all.test \
auxdir2.test \
cond17.test \
-txinfo5.test
+txinfo5.test \
+vala5.test
include $(srcdir)/parallel-tests.am
vala2.test \
vala3.test \
vala4.test \
+vala5.test \
vars.test \
vars3.test \
vartar.test \
all.test \
auxdir2.test \
cond17.test \
-txinfo5.test
+txinfo5.test \
+vala5.test
parallel_tests = \
check-p.test \
vala2.test \
vala3.test \
vala4.test \
+vala5.test \
vars.test \
vars3.test \
vartar.test \
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
+# Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
grep 'am_libzardoz_la_OBJECTS' Makefile.in
grep 'zardoz_vala.stamp' Makefile.in
grep 'libzardoz_la_vala.stamp' Makefile.in
-grep ' --library=libzardoz' Makefile.in
grep 'zardoz\.c' Makefile.in
-grep 'zardoz\.h' Makefile.in
grep 'zardoz-foo\.c' Makefile.in
-grep 'zardoz-foo\.h' Makefile.in
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
+# Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
grep 'src_libzardoz_la_OBJECTS' Makefile.in
grep 'src_zardoz_vala.stamp' Makefile.in
grep 'src_libzardoz_la_vala.stamp' Makefile.in
-grep ' --library=libzardoz' Makefile.in
grep 'zardoz\.c' Makefile.in
-grep 'zardoz\.h' Makefile.in
grep 'src/zardoz-foo\.c' Makefile.in
-grep 'src/zardoz-foo\.h' Makefile.in
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
+# Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-# Test to make foo_PKGNAME variables are considered.
+# Test to make sure compiling Vala code really works with recursive make.
-required="libtool"
+required="libtool libtoolize pkg-config valac gcc"
. ./defs || Exit 1
set -e
+mkdir src
+
cat >> 'configure.in' << 'END'
AC_PROG_CC
+AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AM_PROG_VALAC
+PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= 2.10])
+AC_CONFIG_FILES([src/Makefile])
AC_OUTPUT
END
cat > 'Makefile.am' <<'END'
-lib_LTLIBRARIES = src/libzardoz.la
-src_libzardoz_la_SOURCES = src/zardoz-foo.vala src/zardoz-bar.vala
-src_libzardoz_la_PKGNAME = zardoz+-3.0
+SUBDIRS = src
+END
+
+cat > 'src/Makefile.am' <<'END'
+bin_PROGRAMS = zardoz
+zardoz_CFLAGS = $(GOBJECT_CFLAGS)
+zardoz_LDADD = $(GOBJECT_LIBS)
+zardoz_SOURCES = zardoz.vala
END
-: > ltmain.sh
-: > config.sub
-: > config.guess
+cat > 'src/zardoz.vala' <<'END'
+using GLib;
+
+public class Zardoz {
+ public static void main () {
+ stdout.printf ("Zardoz!\n");
+ }
+}
+END
+
+libtoolize
$ACLOCAL
+$AUTOCONF
$AUTOMAKE -a
-grep 'VALAC' Makefile.in
-grep 'src_libzardoz_la_OBJECTS' Makefile.in
-grep 'src_libzardoz_la_vala.stamp' Makefile.in
-grep ' --library=zardoz+-3.0' Makefile.in
-grep 'src/zardoz-foo\.c' Makefile.in
-grep 'src/zardoz-foo\.h' Makefile.in
+./configure
+$MAKE
+$MAKE distcheck
+$MAKE distclean
+mkdir build
+cd build
+../configure
+$MAKE
+$MAKE distcheck
+
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
+# Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-# Test to make sure compiling Vala code really works.
+# Test to make sure compiling Vala code really works with non-recursive make.
required="libtool libtoolize pkg-config valac gcc"
. ./defs || Exit 1
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
-AM_PROG_VALAC
-PKG_CHECK_MODULES(GOBJECT,gobject-2.0 >= 2.10)
+AM_PROG_VALAC([0.7.0])
+PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= 2.10])
AC_OUTPUT
END
-cat > 'Makefile.am' <<'END'
-bin_PROGRAMS = src/zardoz
-src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
-src_zardoz_LDADD = $(GOBJECT_LIBS)
-src_zardoz_SOURCES = src/zardoz.vala
-END
-
cat > 'src/zardoz.vala' <<'END'
using GLib;
}
END
+cat > 'Makefile.am' <<'END'
+bin_PROGRAMS = src/zardoz
+src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
+src_zardoz_LDADD = $(GOBJECT_LIBS)
+src_zardoz_SOURCES = src/zardoz.vala
+END
+
libtoolize
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
-./configure
+./configure || Exit 77
$MAKE
+$MAKE distcheck
+$MAKE distclean
+mkdir build
+cd build
+../configure
+$MAKE
+$MAKE distcheck
+
+cd ..
+rm -rf build
+
+# Try again with subdir-objects.
+
+cat > 'Makefile.am' <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+
+bin_PROGRAMS = src/zardoz
+src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
+src_zardoz_LDADD = $(GOBJECT_LIBS)
+src_zardoz_SOURCES = src/zardoz.vala
+END
+
+libtoolize
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure || Exit 77
+$MAKE
+$MAKE distcheck
+$MAKE distclean
+mkdir build
+cd build
+../configure
+$MAKE
+$MAKE distcheck
+
#! /bin/sh
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
--- /dev/null
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test per-target flags, expected to fail.
+
+required="libtool libtoolize pkg-config valac gcc"
+. ./defs || Exit 1
+
+set -e
+
+mkdir src
+
+cat >> 'configure.in' << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+AM_PROG_VALAC
+PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= 2.10])
+AC_CONFIG_FILES([src/Makefile])
+AC_OUTPUT
+END
+
+cat > 'Makefile.am' <<'END'
+SUBDIRS = src
+END
+
+cat > 'src/Makefile.am' <<'END'
+bin_PROGRAMS = foo bar
+foo_CFLAGS = $(GOBJECT_CFLAGS)
+foo_LDADD = $(GOBJECT_LIBS)
+foo_SOURCES = baz.vala
+bar_SOURCES = baz.vala
+bar_VALAFLAGS = -D BAR
+bar_CFLAGS = $(GOBJECT_CFLAGS)
+bar_LDADD = $(GOBJECT_LIBS)
+END
+
+cat > 'src/baz.vala' <<'END'
+void main () {
+#if BAR
+ stdout.printf ("bar\n");
+#else
+ stdout.printf ("foo\n");
+#endif
+}
+END
+
+libtoolize
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+