Add autovapi.sh, a script to generate a Vala VAPI for config.h
authorPhilipp Zabel <philipp.zabel@gmail.com>
Mon, 2 Nov 2009 15:19:17 +0000 (16:19 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 3 Nov 2009 13:26:09 +0000 (14:26 +0100)
and use Config.VERSION when creating the Osso context.

autogen.sh
autovapi.sh [new file with mode: 0755]
src/main.vala

index 9a74448..f8ca0e4 100755 (executable)
@@ -8,3 +8,4 @@ autoconf
 autoheader
 automake-1.10 --copy --add-missing --foreign
 ./configure --enable-maintainer-mode
+./autovapi.sh
diff --git a/autovapi.sh b/autovapi.sh
new file mode 100755 (executable)
index 0000000..05c8686
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Generate config.vapi from config.h
+#
+(
+echo '// config.vapi.  Generated from config.h by autovapi.sh.'
+echo '[CCode (cheader_filename = "config.h")]'
+echo 'namespace Config {'
+sed -ne 's/#define \(HAVE_[A-Z_]*\) \([0-9]*\)$/\t\[CCode (cname = \"\1\"\)]\n\tconst bool \1;/p' -e 's/#define \([A-Z_]*\) \([0-9]*\)$/\t\[CCode (cname = \"\1\"\)]\n\tconst int \1;/p' -e 's/#define \([A-Z_]*\) \(\".*\"\)$/\t\[CCode (cname = \"\1\"\)]\n\tconst string \1;/p' < config.h
+echo '}'
+) > vapi/config.vapi
index f243102..58d32e7 100644 (file)
@@ -74,7 +74,7 @@ public class CinaestProgram : Hildon.Program {
                Gtk.init (ref args);
                Gdk.threads_init ();
 
-               var osso_context = new Osso.Context ("org.maemo.cinaest", "0.0.1", true, null);
+               var osso_context = new Osso.Context ("org.maemo.cinaest", Config.VERSION, true, null);
                if (osso_context == null) {
                        return Osso.Status.ERROR;
                }