[msitools: 1/11] wixl: add minimal, generic extensions
- From: Marc-André Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [msitools: 1/11] wixl: add minimal, generic extensions
- Date: Mon, 20 Sep 2021 08:48:07 +0000 (UTC)
commit 902cfecd7a912c328ea72c71ff53db96fa85c538
Author: Brendon Jones <brendon jones gmail com>
Date: Sun Sep 19 22:40:58 2021 +1200
wixl: add minimal, generic extensions
tools/wixl/builder.vala | 16 ++++++++++++++--
tools/wixl/msi.vala | 11 ++++++-----
tools/wixl/wixl.vala | 19 ++++++++++++++++++-
3 files changed, 38 insertions(+), 8 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index a40a61a..9254b72 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -12,19 +12,31 @@ namespace Wixl {
}
}
+ enum Extension {
+ UI = 0;
+
+ public static Extension from_string(string s) throws GLib.Error {
+ return enum_from_string<Extension> (s);
+ }
+ }
+
class WixBuilder: WixNodeVisitor, WixResolver {
- public WixBuilder (string[] includedirs, Arch arch) {
+ public WixBuilder (string[] includedirs, Arch arch, Extension[] extensions, string extdir) {
add_path (".");
foreach (var i in includedirs)
this.includedirs.append (File.new_for_path (i));
this.arch = arch;
+ this.extensions = extensions;
+ this.extdir = extdir;
}
WixRoot root;
MsiDatabase db;
HashTable<string, string> variables;
List<File> includedirs;
+ string extdir;
+ Extension[] extensions;
Arch arch;
construct {
@@ -264,7 +276,7 @@ namespace Wixl {
}
public MsiDatabase build () throws GLib.Error {
- db = new MsiDatabase (arch);
+ db = new MsiDatabase (arch, extensions);
foreach (var r in roots) {
root = r;
diff --git a/tools/wixl/msi.vala b/tools/wixl/msi.vala
index 0778481..df010b1 100644
--- a/tools/wixl/msi.vala
+++ b/tools/wixl/msi.vala
@@ -787,7 +787,8 @@ namespace Wixl {
}
class MsiDatabase: Object {
- public Arch arch { get; construct set; }
+ public Arch arch;
+ public Extension[] extensions;
public MsiSummaryInfo info;
public MsiTableProperty table_property;
@@ -835,7 +836,10 @@ namespace Wixl {
return "x64";
}
- construct {
+ public MsiDatabase (Arch arch, Extension[] extensions) {
+ this.arch = arch;
+ this.extensions = extensions;
+
info = new MsiSummaryInfo ();
try {
info.set_property (Libmsi.Property.TITLE, "Installation Database");
@@ -919,10 +923,7 @@ namespace Wixl {
}) {
tables.insert (t.name, t);
}
- }
- public MsiDatabase (Arch arch) {
- Object (arch: arch);
}
public void build (string filename) throws GLib.Error {
diff --git a/tools/wixl/wixl.vala b/tools/wixl/wixl.vala
index 136d9a0..993860d 100644
--- a/tools/wixl/wixl.vala
+++ b/tools/wixl/wixl.vala
@@ -12,10 +12,14 @@ namespace Wixl {
static string[] defines;
[CCode (array_length = false, array_null_terminated = true)]
static string[] opt_includedirs;
+ [CCode (array_length = false, array_null_terminated = true)]
+ static string[] opt_extensions;
static string[] includedirs;
static string wxidir;
+ static string extdir;
static Arch arch = Arch.X86;
+ static Extension[] extensions;
private const OptionEntry[] options = {
{ "version", 0, 0, OptionArg.NONE, ref version, N_("Display version number"), null },
@@ -24,8 +28,10 @@ namespace Wixl {
{ "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 },
+ { "extdir", 0, 0, OptionArg.STRING, ref extdir, N_("System extension 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 },
+ { "ext", 0, 0, OptionArg.STRING_ARRAY, ref opt_extensions, N_("Specify an extension"), null },
{ "", 0, 0, OptionArg.FILENAME_ARRAY, ref files, null, N_("INPUT_FILE1 [INPUT_FILE2]...") },
{ null }
};
@@ -52,6 +58,7 @@ namespace Wixl {
opt_context.add_main_entries (options, null);
wxidir = Path.build_filename (Config.DATADIR, "wixl-" + Config.PACKAGE_VERSION, "include");
+ extdir = Path.build_filename (Config.DATADIR, "wixl-" + Config.PACKAGE_VERSION, "ext");
try {
opt_context.parse (ref args);
@@ -85,8 +92,18 @@ namespace Wixl {
}
}
+ foreach (var i in opt_extensions) {
+ try {
+ var extension = Extension.from_string(i);
+ extensions += extension;
+ } catch (GLib.Error e) {
+ GLib.stderr.printf (_("Extension of type '%s' is not supported.\n").printf (i));
+ exit (1);
+ }
+ }
+
try {
- var builder = new WixBuilder (includedirs, arch);
+ var builder = new WixBuilder (includedirs, arch, extensions, extdir);
foreach (var d in defines) {
var def = d.split ("=", 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]