From 457124ebc3e6a13894888d45f408d2706e5e3f78 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 11 Apr 2013 20:39:22 +0200 Subject: wixl: add --arch option --- tools/wixl/builder.vala | 16 +++++++++++++++- tools/wixl/wixl.vala | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala index 2cf9ccd..924672b 100644 --- a/tools/wixl/builder.vala +++ b/tools/wixl/builder.vala @@ -1,17 +1,31 @@ namespace Wixl { + enum Arch { + X86 = 0, + INTEL = 0, + IA64 = 1, + INTEL64 = 1, + X64; + + public static Arch from_string(string s) throws GLib.Error { + return enum_from_string (s); + } + } + class WixBuilder: WixNodeVisitor, WixResolver { - public WixBuilder (string[] includedirs) { + public WixBuilder (string[] includedirs, Arch arch) { add_path ("."); foreach (var i in includedirs) this.includedirs.append (File.new_for_path (i)); + this.arch = arch; } WixRoot root; MsiDatabase db; HashTable variables; List includedirs; + Arch arch; construct { variables = new HashTable (str_hash, str_equal); diff --git a/tools/wixl/wixl.vala b/tools/wixl/wixl.vala index d7c6798..24dd179 100644 --- a/tools/wixl/wixl.vala +++ b/tools/wixl/wixl.vala @@ -15,12 +15,14 @@ namespace Wixl { static string[] includedirs; static string wxidir; + static Arch arch = Arch.X86; private const OptionEntry[] options = { { "version", 0, 0, OptionArg.NONE, ref version, N_("Display version number"), null }, { "verbose", 'v', 0, OptionArg.NONE, ref verbose, N_("Verbose output"), null }, { "output", 'o', 0, OptionArg.FILENAME, ref output, N_("Output file"), null }, { "define", 'D', 0, OptionArg.STRING_ARRAY, ref defines, N_("Define variable"), null }, + { "arch", 'a', 0, OptionArg.CALLBACK, (void*)parse_arch, N_("Target architecture"), null }, { "includedir", 'I', 0, OptionArg.STRING_ARRAY, ref opt_includedirs, N_("Include directory"), null }, { "wxidir", 0, 0, OptionArg.STRING, ref wxidir, N_("System include directory"), null }, { "only-preproc", 'E', 0, OptionArg.NONE, ref preproc, N_("Stop after the preprocessing stage"), null }, @@ -28,6 +30,16 @@ namespace Wixl { { null } }; + bool parse_arch (string option_name, string value, void *data) throws OptionError { + try { + arch = Arch.from_string (value); + } catch (GLib.Error e) { + throw new OptionError.BAD_VALUE (_("arch of type '%s' is not supported").printf (value)); + } + + return true; + } + int main (string[] args) { Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR); Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8"); @@ -44,7 +56,7 @@ namespace Wixl { try { opt_context.parse (ref args); } catch (OptionError.BAD_VALUE err) { - GLib.stdout.printf (opt_context.get_help (true, null)); + GLib.stderr.printf (err.message + "\n"); exit (1); } catch (OptionError error) { warning (error.message); @@ -74,7 +86,7 @@ namespace Wixl { } try { - var builder = new WixBuilder (includedirs); + var builder = new WixBuilder (includedirs, arch); foreach (var d in defines) { var def = d.split ("=", 2); -- cgit