automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updated Vala support for automake


From: Ralf Wildenhues
Subject: Re: Updated Vala support for automake
Date: Fri, 10 Oct 2008 07:50:34 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello people interested in Automake support for Vala,

(please indicate if you don't want to be Cc:ed.)

* Ralf Wildenhues wrote on Sat, Sep 06, 2008 at 08:53:06PM CEST:
> <http://thread.gmane.org/gmane.comp.sysutils.automake.patches/2860/focus=513>.

I've udpated Mathias' patches to incorporate the suggestions I sent
earlier, and pushed the resulting patches to a feature branch that
can be found here:
  git clone git://git.savannah.gnu.org/automake.git
  git checkout origin/mh-vala-support
  
<http://git.savannah.gnu.org/gitweb/?p=automake.git;a=shortlog;h=refs/heads/mh-vala-support>

Now, I have a couple of issues with the result still, most importantly:
it doesn't work yet.  :-)

I've installed vala support packages on my Debian Lenny (prerelease):
$ valac --version
Vala 0.3.4

The vala3.test test fails.  What happens is that valac creates not .c
source from the .vala input file, but instead creates files named:
  0.gidl  0.vapi  zardoz  zardoz.h

| + make
| /usr/bin/valac --library=0   -d src src/zardoz.vala && touch 
src_zardoz_vala.stamp
| gcc -DPACKAGE_NAME=\"vala3\" -DPACKAGE_TARNAME=\"vala3\" 
-DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"vala3\ 1.0\" 
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"vala3\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I.    
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -g -O2 -MT 
src_zardoz-zardoz.o -MD -MP -MF .deps/src_zardoz-zardoz.Tpo -c -o 
src_zardoz-zardoz.o `test -f 'src/zardoz.c' || echo './'`src/zardoz.c
| gcc: ./src/zardoz.c: Datei oder Verzeichnis nicht gefunden
| gcc: no input files
| make: *** [src_zardoz-zardoz.o] Fehler 1

Now, who is wrong, the Automake code or valac?

FWIW, below is an incremental diff over Mathias' patches; the full
patches can be seen in the git tree.

After checking out, you can try out the tree with
  ./bootstrap
  ./configure
  make
  cd tests
  set x *vala*test
  shift
  make check VERBOSE=yes TESTS="$*"

Thanks,
Ralf

diff --git a/automake.in b/automake.in
index 4693704..a014bd0 100755
--- a/automake.in
+++ b/automake.in
@@ -783,7 +783,7 @@ register_language ('name' => 'vala',
                   'Name' => 'Vala',
                   'config_vars' => ['VALAC'],
                   'flags' => ['VALAFLAGS'],
-                  'compile' => '$(VALAC) $(VALAFLAGS) $(AM_VALAFLAGS)',
+                  'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
                   'compiler' => 'VALACOMPILE',
                   'extensions' => ['.vala'],
                   'output_extensions' => sub { (my $ext1 = $_[0]) =~ 
s/vala$/c/;
diff --git a/doc/automake.texi b/doc/automake.texi
index b4fd0f4..3ea717b 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6509,50 +6509,52 @@ the @code{_LDFLAGS} variable for the program.
 @cindex Vala Support
 @cindex Support for Vala
 
-Automake provides support for Vala compilation.
+Automake provides support for Vala compilation
+(@uref{http://live.gnome.org/@/Vala}).
 
 @example
 foo_SOURCES = foo.vala bar.vala zardoc.c
 @end example
 
-Any .vala file listed in a @code{_SOURCE} variable will be compiled
-into C code by the Vala compiler.
+Any @file{.vala} file listed in a @code{_SOURCE} variable will be
+compiled into C code by the Vala compiler.
 
 Automake ships with an Autoconf macro called @code{AM_PROG_VALAC}
 that will locate the Vala compiler and optionally check its version
 number.
 
address@hidden AM_PROG_VALAC (address@hidden)
-
-Check whether the Vala compiler exists in `PATH'. If it is found the
-variable VALAC is set. Optionally a minimum release number of the compiler
-can be requested.
address@hidden AM_PROG_VALAC (@ovar{MINIMUM-VERSION})
+Try to find a Vala compiler in @env{PATH}. If it is found, the variable
address@hidden is set. Optionally a minimum release number of the compiler
+can be requested:
 
 @example
 AM_PROG_VALAC([0.1.3])
 @end example
-
 @end defmac
 
 There are a few variables that are used when compiling Vala sources:
 
 @vtable @code
-
 @item VALAC
 Path to the the Vala compiler.
 
 @item VALAFLAGS
 Additional arguments for the Vala compiler.
 
address@hidden AM_VALAFLAGS
+The maintainer's variant of @code{VALAFLAGS}.
+
 @item PKGNAME
-The pkg-config and VAPI name to use when building Vala based library.
+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
 
 
diff --git a/lib/am/vala.am b/lib/am/vala.am
index e69de29..fa2a23c 100644
--- a/lib/am/vala.am
+++ b/lib/am/vala.am
@@ -0,0 +1,17 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 2008  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
+## the Free Software Foundation; either version 3, or (at your option)
+## any later version.
+
+## This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+## There is no rule here.  :-)
diff --git a/m4/vala.m4 b/m4/vala.m4
index 57aae60..5606296 100644
--- a/m4/vala.m4
+++ b/m4/vala.m4
@@ -1,36 +1,29 @@
 # Autoconf support for the Vala compiler
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2008 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3
 
-# Check whether the Vala compiler exists in `PATH'. If it is found the
-# variable VALAC is set. Optionally a minimum release number of the compiler
-# can be requested.
-#
-# Author: Mathias Hasselmann <address@hidden>
+# Check whether the Vala compiler exists in `PATH'. If it is found, the
+# variable VALAC is set. Optionally a minimum release number of the
+# compiler can be requested.
 #
 # AM_PROG_VALAC([MINIMUM-VERSION])
-# --------------------------------------------------------------------------
-AC_DEFUN([AM_PROG_VALAC],[
-  AC_PATH_PROG([VALAC], [valac], [])
-  AC_SUBST(VALAC)
-
-  if test -z "${VALAC}"; then
-    AC_MSG_WARN([No Vala compiler found. You will not be able to recompile 
.vala source files.])
-  elif test -n "$1"; then
-    AC_REQUIRE([AC_PROG_AWK])
-    AC_MSG_CHECKING([valac is at least version $1])
-
-    if "${VALAC}" --version | "${AWK}" -v r='$1' 'function vn(s) { if (3 == 
split(s,v,".")) return (v[1]*1000+v[2])*1000+v[3]; else exit 2; } /^Vala / { 
exit vn(r) > vn($[2]) }'; then
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_RESULT([no])
-      AC_MSG_ERROR([Vala $1 not found.])
-    fi
-  fi
+# --------------------------------
+AC_DEFUN([AM_PROG_VALAC],
+[AC_PATH_PROG([VALAC], [valac], [])
+ AS_IF([test -z "$VALAC"],
+   [AC_MSG_WARN([No Vala compiler found.  You will not be able to compile 
.vala source files.])],
+   [AS_IF([test -n "$1"],
+      [AC_MSG_CHECKING([$VALAC is at least version $1])
+       am__vala_version=`$VALAC --version`
+       AS_VERSION_COMPARE([$1], ["$am__vala_version"],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])
+          AC_MSG_ERROR([Vala $1 not found.])])])])
 ])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a0bee69..4e0de85 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -631,6 +631,7 @@ vala.test \
 vala1.test \
 vala2.test \
 vala3.test \
+vala4.test \
 vars.test \
 vars3.test \
 vartar.test \
diff --git a/tests/vala.test b/tests/vala.test
index d709cb2..c9b12af 100755
--- a/tests/vala.test
+++ b/tests/vala.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008  Free Software Foundation,
+# Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -21,7 +22,7 @@
 # Test to make sure intermediate .c files are built from vala source.
 
 required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -48,14 +49,14 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 
-grep -w -- 'VALAC'                     'Makefile.in'
-grep -w -- 'am_zardoz_OBJECTS'         'Makefile.in'
-grep -w -- 'am_libzardoz_la_OBJECTS'   'Makefile.in'
-grep -w -- 'zardoz_vala.stamp'         'Makefile.in'
-grep -w -- 'libzardoz_la_vala.stamp'   'Makefile.in'
-grep -w -- '--library=libzardoz'       'Makefile.in'
-grep -w -- 'zardoz\.c'                         'Makefile.in'
-grep -w -- 'zardoz\.h'                         'Makefile.in'
-grep -w -- 'zardoz-foo\.c'             'Makefile.in'
-grep -w -- 'zardoz-foo\.h'             'Makefile.in'
+grep 'VALAC' Makefile.in
+grep 'am_zardoz_OBJECTS' Makefile.in
+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
 
diff --git a/tests/vala1.test b/tests/vala1.test
index 086b312..69edb15 100755
--- a/tests/vala1.test
+++ b/tests/vala1.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008  Free Software Foundation,
+# Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -22,7 +23,7 @@
 # in non-recursive automake mode.
 
 required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -48,14 +49,13 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 
-grep -w -- 'VALAC'                             'Makefile.in'
-grep -w -- 'src_zardoz_OBJECTS'                        'Makefile.in'
-grep -w -- 'src_libzardoz_la_OBJECTS'          'Makefile.in'
-grep -w -- 'src_zardoz_vala.stamp'             'Makefile.in'
-grep -w -- 'src_libzardoz_la_vala.stamp'       'Makefile.in'
-grep -w -- '--library=libzardoz'               'Makefile.in'
-grep -w -- 'zardoz\.c'                                 'Makefile.in'
-grep -w -- 'zardoz\.h'                                 'Makefile.in'
-grep -w -- 'src/zardoz-foo\.c'                         'Makefile.in'
-grep -w -- 'src/zardoz-foo\.h'                         'Makefile.in'
-
+grep 'VALAC' Makefile.in
+grep 'src_zardoz_OBJECTS' Makefile.in
+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
diff --git a/tests/vala2.test b/tests/vala2.test
index 03ce33c..ce568d5 100755
--- a/tests/vala2.test
+++ b/tests/vala2.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008  Free Software Foundation,
+# Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -21,7 +22,7 @@
 # Test to make foo_PKGNAME variables are considered.
 
 required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -45,10 +46,9 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 
-grep -w -- 'VALAC'                             'Makefile.in'
-grep -w -- 'src_libzardoz_la_OBJECTS'          'Makefile.in'
-grep -w -- 'src_libzardoz_la_vala.stamp'       'Makefile.in'
-grep -w -- '--library=zardoz+-3.0'             'Makefile.in'
-grep -w -- 'src/zardoz-foo\.c'                         'Makefile.in'
-grep -w -- 'src/zardoz-foo\.h'                         'Makefile.in'
-
+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
diff --git a/tests/vala3.test b/tests/vala3.test
index 70aca27..41b083d 100755
--- a/tests/vala3.test
+++ b/tests/vala3.test
@@ -21,7 +21,7 @@
 # Test to make sure compiling Vala code really works.
 
 required="libtool libtoolize pkg-config valac gcc"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -31,11 +31,8 @@ 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_OUTPUT
 END
 
@@ -63,5 +60,5 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-make
+$MAKE
 
diff --git a/tests/vala4.test b/tests/vala4.test
new file mode 100755
index 0000000..a2e8c96
--- /dev/null
+++ b/tests/vala4.test
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2008  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 AM_PROG_VALAC.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AM_PROG_VALAC([0.0.1])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+cat > valac << 'END'
+#! /bin/sh
+if test "x$1" = x--version; then
+  echo 1.2.3
+fi
+exit 0
+END
+chmod +x valac
+
+libtoolize
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+./configure "VALAC=`pwd`/valac"
+
+sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([9999.9])/' < configure.in >t
+mv -f t configure.in
+$AUTOCONF --force
+./configure "VALAC=`pwd`/valac" && Exit 1
+
+sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([1.2.3])/' < configure.in >t
+mv -f t configure.in
+$AUTOCONF --force
+./configure "VALAC=`pwd`/valac"
+:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]