summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-04-11 20:39:22 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-04-12 03:31:20 +0200
commit457124ebc3e6a13894888d45f408d2706e5e3f78 (patch)
tree3db48ae5251971f5d39e092af4883aa997154279 /tools
parent7fce6ef70cef36c600e01543664d32bfc5209c08 (diff)
downloadmsitools-457124ebc3e6a13894888d45f408d2706e5e3f78.zip
msitools-457124ebc3e6a13894888d45f408d2706e5e3f78.tar.gz
msitools-457124ebc3e6a13894888d45f408d2706e5e3f78.tar.xz
wixl: add --arch option
Diffstat (limited to 'tools')
-rw-r--r--tools/wixl/builder.vala16
-rw-r--r--tools/wixl/wixl.vala16
2 files changed, 29 insertions, 3 deletions
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<Arch> (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<string, string> variables;
List<File> includedirs;
+ Arch arch;
construct {
variables = new HashTable<string, string> (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);