[msitools: 15/16] build-sys: convert to meson



commit 9f501204359d5d93d500abb6c1c26560f16007a0
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Sun Mar 29 00:59:56 2020 +0100

    build-sys: convert to meson
    
    Signed-off-by: Félix Piédallu <felix piedallu me>
    [ rework Félix initial port ]
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 .gitlab-ci.yml               |  21 ++-
 Makefile.am                  | 224 ------------------------
 atlocal.in                   |  31 ----
 autogen.sh                   |  10 --
 build-aux/meson-dist         |  16 ++
 build-aux/move-if-change     |  17 --
 completion/meson.build       |   3 +
 config.vapi                  |   3 +-
 configure.ac                 | 110 ------------
 data/Makefile.am             | 105 ------------
 data/meson.build             | 109 ++++++++++++
 git.mk                       | 400 -------------------------------------------
 include/Makefile.am          |  19 --
 include/meson.build          |  17 ++
 libmsi/Makefile.am           | 107 ------------
 libmsi/libmsi-summary-info.c |   6 +
 libmsi/meson.build           | 108 ++++++++++++
 m4/.gitignore                |   5 -
 m4/manywarnings.m4           | 245 --------------------------
 m4/warnings.m4               |  61 -------
 meson.build                  |  46 +++++
 meson_options.txt            |  11 ++
 po/Makevars                  |  76 --------
 po/meson.build               |   5 +
 tests/Makefile.am            |  20 ---
 tests/meson.build            |  39 +++++
 tests/package.m4.in          |   8 -
 tests/testdatabase.c         |  70 ++++----
 tests/testrecord.c           |   4 +-
 tests/testsuite.at           | 234 -------------------------
 tests/testsuminfo.c          |   2 +-
 tests/wixl.at                | 177 -------------------
 tools/meson.build            |  55 ++++++
 tools/msiinfo.c              |   2 +-
 tools/wixl/meson.build       |  71 ++++++++
 tools/wixl/wixl.vala         |   2 +-
 36 files changed, 537 insertions(+), 1902 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e9fb97a..026849a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,12 +1,11 @@
 image: fedora:rawhide
 
 variables:
-  DEPENDENCIES: dnf-command(builddep) intltool
+  DEPENDENCIES: dnf-command(builddep) meson git vala
+                bison bison-devel bison-runtime
                 glib2-devel gobject-introspection-devel
-                libuuid-devel vala libgsf-devel
-                libgcab1-devel git libtool make
+                libgsf-devel libgcab1-devel
                 redhat-rpm-config
-                bison bison-devel bison-runtime
                 perl-XML-XPath
                 diffutils
                 mingw32-adwaita-icon-theme
@@ -174,13 +173,13 @@ build_stable:
     - dnf update -y --nogpgcheck
     - dnf install -y --nogpgcheck $DEPENDENCIES
     - dnf builddep -y --nogpgcheck msitools
+    - git submodule update --init --recursive
   script:
-    - ./autogen.sh
-    - make
-    - make check
-    - make -C data check-wxi
+    - meson _build -Dvalidate-wxi=true
+    - ninja -C _build
+    - ninja -C _build test
   artifacts:
     paths:
-      - testsuite.log
-      - testsuite.dir/
-    when: on_failure
+      - _build/meson-logs/*.txt
+    when: always
+    expire_in: 1 week
diff --git a/build-aux/meson-dist b/build-aux/meson-dist
new file mode 100755
index 0000000..80d534f
--- /dev/null
+++ b/build-aux/meson-dist
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+if test "$1" = ""; then
+    echo "Version not provided" >&2
+    exit 1
+fi
+if ! test -d "$2"; then
+    echo "Source directory not provided" >&2
+    exit 1
+fi
+
+# generate tarball version
+echo "$1" > "$MESON_DIST_ROOT/.tarball-version"
diff --git a/completion/meson.build b/completion/meson.build
new file mode 100644
index 0000000..01744e0
--- /dev/null
+++ b/completion/meson.build
@@ -0,0 +1,3 @@
+install_data('msitools',
+  install_dir: get_option('datadir') / 'bash-completion' / 'completions',
+)
diff --git a/config.vapi b/config.vapi
index 6bceffc..2bf225e 100644
--- a/config.vapi
+++ b/config.vapi
@@ -7,6 +7,5 @@ namespace Config
        public const string GETTEXT_PACKAGE;
 
        public const string LOCALEDIR;
-       public const string PKGDATADIR;
-       public const string PKGLIBDIR;
+       public const string DATADIR;
 }
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..a9bbcae
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,109 @@
+wxi_data = files(
+  'wixl/OpenEXR.wxi',
+  'wixl/SDL.wxi',
+  'wixl/adwaita-icon-theme.wxi',
+  'wixl/atk.wxi',
+  'wixl/brotli.wxi',
+  'wixl/bzip2.wxi',
+  'wixl/cairo.wxi',
+  'wixl/celt051.wxi',
+  'wixl/curl.wxi',
+  'wixl/dlfcn.wxi',
+  'wixl/expat.wxi',
+  'wixl/fontconfig.wxi',
+  'wixl/freetype.wxi',
+  'wixl/fribidi.wxi',
+  'wixl/gcc-c++.wxi',
+  'wixl/gcc.wxi',
+  'wixl/gdk-pixbuf.wxi',
+  'wixl/gettext.wxi',
+  'wixl/glib-networking.wxi',
+  'wixl/glib2.wxi',
+  'wixl/gmp.wxi',
+  'wixl/gnutls.wxi',
+  'wixl/gsm.wxi',
+  'wixl/gstreamer-plugins-bad-free.wxi',
+  'wixl/gstreamer-plugins-base.wxi',
+  'wixl/gstreamer-plugins-good.wxi',
+  'wixl/gstreamer.wxi',
+  'wixl/gstreamer1-plugins-bad-free.wxi',
+  'wixl/gstreamer1-plugins-base.wxi',
+  'wixl/gstreamer1-plugins-good.wxi',
+  'wixl/gstreamer1.wxi',
+  'wixl/gtk-vnc2.wxi',
+  'wixl/gtk2.wxi',
+  'wixl/gtk3.wxi',
+  'wixl/gvnc.wxi',
+  'wixl/harfbuzz.wxi',
+  'wixl/hicolor-icon-theme.wxi',
+  'wixl/icu.wxi',
+  'wixl/ilmbase.wxi',
+  'wixl/jasper.wxi',
+  'wixl/json-glib.wxi',
+  'wixl/libcacard.wxi',
+  'wixl/libepoxy.wxi',
+  'wixl/libffi.wxi',
+  'wixl/libgcrypt.wxi',
+  'wixl/libgovirt.wxi',
+  'wixl/libgpg-error.wxi',
+  'wixl/libidn2.wxi',
+  'wixl/libjpeg-turbo.wxi',
+  'wixl/libogg.wxi',
+  'wixl/libpng.wxi',
+  'wixl/libpsl.wxi',
+  'wixl/libsoup.wxi',
+  'wixl/libssh2.wxi',
+  'wixl/libtasn1.wxi',
+  'wixl/libtheora.wxi',
+  'wixl/libtiff.wxi',
+  'wixl/libunistring.wxi',
+  'wixl/libusbx.wxi',
+  'wixl/libvirt-glib.wxi',
+  'wixl/libvirt.wxi',
+  'wixl/libvorbis.wxi',
+  'wixl/libxml2.wxi',
+  'wixl/nettle.wxi',
+  'wixl/openssl.wxi',
+  'wixl/opus.wxi',
+  'wixl/orc.wxi',
+  'wixl/p11-kit.wxi',
+  'wixl/pango.wxi',
+  'wixl/pcre.wxi',
+  'wixl/pixman.wxi',
+  'wixl/portablexdr.wxi',
+  'wixl/pthreads.wxi',
+  'wixl/readline.wxi',
+  'wixl/rest.wxi',
+  'wixl/speex.wxi',
+  'wixl/spice-glib.wxi',
+  'wixl/spice-gtk3.wxi',
+  'wixl/sqlite.wxi',
+  'wixl/termcap.wxi',
+  'wixl/usbredir.wxi',
+  'wixl/wavpack.wxi',
+  'wixl/win-iconv.wxi',
+  'wixl/winpthreads.wxi',
+  'wixl/zlib.wxi',
+)
+
+install_data(wxi_data,
+  install_dir: get_option('datadir') / 'wixl-' + meson.project_version() / 'include'
+)
+
+if get_option('validate-wxi')
+  wxi_validate = find_program('wxi-validate.pl')
+  foreach file: wxi_data
+    filename = ('@0@'.format(file)).split('/')[-1].split('.wxi')[0]
+    testname = 'wxi-@0@'.format(filename)
+
+    r = run_command('rpm', '-q', 'mingw32-' + filename, 'mingw64-' + filename)
+    if r.returncode() == 0
+      test(testname,
+        wxi_validate,
+        args: file,
+      )
+    else
+      warning('Skip validating ' + filename + '.wxi')
+    endif
+  endforeach
+endif
diff --git a/include/meson.build b/include/meson.build
new file mode 100644
index 0000000..6af5cb7
--- /dev/null
+++ b/include/meson.build
@@ -0,0 +1,17 @@
+libmsi_types_h = files('libmsi-types.h')
+
+libmsi_enums_h = gnome.mkenums('libmsi-enums',
+  h_template: 'libmsi-enums.h.etemplate',
+  sources: libmsi_types_h,
+)
+
+introspectable_headers = files(
+  'libmsi-database.h',
+  'libmsi-query.h',
+  'libmsi-record.h',
+  'libmsi-summary-info.h',
+  'libmsi-types.h',
+  'libmsi.h',
+) + [
+  libmsi_enums_h,
+]
diff --git a/libmsi/libmsi-summary-info.c b/libmsi/libmsi-summary-info.c
index 0e22ed6..27b1e2e 100644
--- a/libmsi/libmsi-summary-info.c
+++ b/libmsi/libmsi-summary-info.c
@@ -27,6 +27,12 @@
 #include "debug.h"
 #include "libmsi.h"
 #include "msipriv.h"
+#include "config.h"
+
+#ifdef USE_GMTIME_S
+#   define gmtime_r(timep, result) gmtime_s(result, timep)
+#endif
+
 
 
 enum
diff --git a/libmsi/meson.build b/libmsi/meson.build
new file mode 100644
index 0000000..65bae85
--- /dev/null
+++ b/libmsi/meson.build
@@ -0,0 +1,108 @@
+libmsi_sources = files(
+  'alter.c',
+  'create.c',
+  'debug.c',
+  'debug.h',
+  'delete.c',
+  'distinct.c',
+  'drop.c',
+  'insert.c',
+  'libmsi-database.c',
+  'libmsi-istream.c',
+  'libmsi-istream.h',
+  'libmsi-query.c',
+  'libmsi-record.c',
+  'libmsi-summary-info.c',
+  'list.h',
+  'msipriv.h',
+  'query.h',
+  'select.c',
+  'storages.c',
+  'streams.c',
+  'string.c',
+  'table.c',
+  'tokenize.c',
+  'update.c',
+  'where.c',
+)
+
+libmsi_enums_c = gnome.mkenums('libmsi-enums',
+  c_template: 'libmsi-enums.c.etemplate',
+  sources: libmsi_types_h,
+)
+
+libmsi_sources += [
+  libmsi_enums_h,
+  libmsi_enums_c,
+]
+
+libmsi_sources += custom_target('sql-parser',
+  input: 'sql-parser.y',
+  output: ['sql-parser.c', 'sql-parser.h'],
+  command: [
+    bison, '@INPUT@', '-y', '-Wno-yacc', '--defines', '-o', '@OUTPUT0@',
+  ],
+)
+
+libmsi_deps = [
+  glib,
+  gio,
+  gobject,
+  libgsf,
+]
+
+libmsi = shared_library('msi',
+  libmsi_sources,
+  include_directories: inc_dirs,
+  dependencies: libmsi_deps,
+)
+
+pc = import('pkgconfig')
+pc.generate(
+  libraries: libmsi,
+  requires: [ 'gio-2.0' ],
+  subdirs: 'libmsi-1.0',
+  version: meson.project_version(),
+  name: 'libmsi-1.0',
+  filebase: 'libmsi-1.0',
+  description: 'MSI manipulation library',
+)
+
+if get_option('introspection')
+  libmsi_gir = gnome.generate_gir(libmsi,
+    namespace: 'Libmsi',
+    nsversion: '1.0',
+    export_packages: 'libmsi-1.0',
+    sources: [
+      introspectable_headers,
+      libmsi_enums_c,
+      'libmsi-database.c',
+      'libmsi-query.c',
+      'libmsi-record.c',
+      'libmsi-summary-info.c',
+    ],
+    includes: [
+      'GLib-2.0',
+      'GObject-2.0',
+      'Gio-2.0',
+    ],
+    extra_args: [
+      '--c-include=libmsi.h',
+    ],
+    install: true,
+  )
+
+  libmsi_vapi = gnome.generate_vapi('libmsi-1.0',
+    sources: libmsi_gir[0],
+    vapi_dirs: meson.current_source_dir(),
+    metadata_dirs: meson.current_source_dir(),
+    packages: 'gio-2.0',
+    install: true,
+  )
+endif
+
+libmsi = declare_dependency(
+  link_with: libmsi,
+  include_directories: inc_dirs,
+  dependencies: libmsi_deps,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..fde7580
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,46 @@
+project('msitools',
+  'c', 'vala',
+  version: run_command('build-aux/git-version-gen', '@0@/.tarball-version'.format(meson.source_root()), 
check: true).stdout().strip(),
+  license: 'LGPL-2+',
+  meson_version: '>= 0.52',
+)
+meson.add_dist_script('build-aux/meson-dist', meson.project_version(), meson.source_root())
+
+gnome = import('gnome')
+
+perl = find_program('perl')
+bison = find_program('bison')
+bats = find_program('subprojects/bats-core/bin/bats')
+glib = dependency('glib-2.0', version: '>= 2.12')
+gobject = dependency('gobject-2.0', version: '>= 0.9.4')
+gio = dependency('gio-2.0', version: '>= 2.14')
+libgsf = dependency('libgsf-1')
+libgcab = dependency('libgcab-1.0', version: '>= 0.1.10')
+libxml = dependency('libxml-2.0', version: '>= 2.7')
+
+config = configuration_data()
+config.set_quoted('PACKAGE_NAME', meson.project_name())
+config.set_quoted('PACKAGE_VERSION', meson.project_version())
+config.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
+config.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+config.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/msitools/issues')
+config.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
+config.set_quoted('DATADIR', get_option('prefix') / get_option('datadir'))
+
+config_h = configure_file(
+  output: 'config.h',
+  configuration: config,
+)
+
+inc_dirs = include_directories('.', 'include')
+
+subdir('completion')
+subdir('data')
+subdir('po')
+subdir('include')
+subdir('libmsi')
+subdir('tools')
+
+if host_machine.system() != 'windows' #FIXME
+  subdir('tests')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..b89ef38
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('validate-wxi',
+  type: 'boolean',
+  value: false,
+  description: 'Check WXI against mingw RPM packages',
+)
+
+option('introspection',
+  type: 'boolean',
+  value: true,
+  description: 'generate GObject Introspection data',
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..8406313
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,5 @@
+i18n = import('i18n')
+
+i18n.gettext(meson.project_name(),
+  preset: 'glib',
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..e32eb58
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,39 @@
+c_args = ['-Wno-unused']
+
+testrecord = executable('testrecord',
+  'testrecord.c',
+  libmsi_enums_h,
+  c_args: c_args,
+  include_directories: inc_dirs,
+  dependencies: libmsi,
+)
+
+testdatabase = executable('testdatabase',
+  'testdatabase.c',
+  libmsi_enums_h,
+  c_args: c_args,
+  include_directories: inc_dirs,
+  dependencies: libmsi,
+)
+
+if host_machine.system() == 'windows'
+  testsuminfo = executable('testsuminfo',
+    'testsuminfo.c',
+    libmsi_enums_h,
+    c_args: c_args,
+    include_directories: inc_dirs,
+    dependencies: libmsi,
+  )
+endif
+
+test('Tools tests',
+  bats,
+  workdir: meson.current_build_dir(),
+  args: ['--tap', meson.current_source_dir()],
+  protocol: 'tap',
+  depends: [testrecord, testdatabase],
+  env: {
+    'SRCDIR': meson.source_root(),
+    'BUILDDIR': meson.build_root(),
+  },
+)
diff --git a/tests/testdatabase.c b/tests/testdatabase.c
index 01159cd..15d156f 100644
--- a/tests/testdatabase.c
+++ b/tests/testdatabase.c
@@ -1723,7 +1723,7 @@ static void test_suminfo_import(void)
     LibmsiSummaryInfo *hsi;
     LibmsiQuery *query = 0;
     const char *sql;
-    unsigned r, type;
+    unsigned r = 0, type;
     const char *str_value;
     int int_value;
     guint64 ft_value;
@@ -1817,7 +1817,7 @@ static void test_msiimport(void)
     LibmsiQuery *query;
     LibmsiRecord *rec;
     const char *sql;
-    unsigned r, count;
+    unsigned r = 0, count;
     signed int i;
 
     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
@@ -2031,7 +2031,7 @@ static void test_binary_import(void)
     char buf[256];
     unsigned size;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
 
     /* create files to import */
     write_file("bin_import.idt", bin_import_dat,
@@ -2075,7 +2075,7 @@ static void test_markers(void)
     LibmsiDatabase *hdb;
     LibmsiRecord *rec;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
 
     hdb = create_db();
     ok( hdb, "failed to create db\n");
@@ -2261,7 +2261,7 @@ static void test_handle_limit(void)
     int i;
     LibmsiDatabase *hdb;
     LibmsiQuery *hqueries[MY_NQUERIES];
-    unsigned r;
+    unsigned r = 0;
 
     /* create an empty db */
     hdb = create_db();
@@ -2381,7 +2381,7 @@ static void generate_transform_manual(void)
     IStorage *stg = NULL;
     IStream *stm;
     WCHAR name[0x20];
-    HRESULT r;
+    HRESULT r = 0;
     unsigned i, count;
     const unsigned mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
 
@@ -2487,7 +2487,7 @@ static void test_try_transform(void)
     LibmsiQuery *hquery;
     LibmsiRecord *hrec;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
     unsigned sz;
     char buffer[MAX_PATH];
 
@@ -2771,7 +2771,7 @@ static void test_join(void)
     LibmsiRecord *hrec;
     const char *sql;
     char buf[256];
-    unsigned r, count;
+    unsigned r = 0, count;
     unsigned size, i;
     bool data_correct;
     gchar *str;
@@ -3344,7 +3344,7 @@ static void test_temporary_table(void)
     LibmsiQuery *query = 0;
     LibmsiRecord *rec;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
     char buf[0x10];
     unsigned sz;
 
@@ -3461,7 +3461,7 @@ static void test_alter(void)
     gboolean cond;
     LibmsiDatabase *hdb = 0;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
 
     hdb = create_db();
     ok( hdb, "failed to create db\n");
@@ -3640,7 +3640,7 @@ static void test_integers(void)
     LibmsiRecord *rec = 0;
     unsigned count, i;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
 
     /* just libmsi_database_open should not create a file */
     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
@@ -3767,7 +3767,7 @@ static void test_update(void)
     char result[256];
     const char *sql;
     unsigned size;
-    unsigned r;
+    unsigned r = 0;
 
     /* just libmsi_database_open should not create a file */
     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
@@ -4044,7 +4044,7 @@ static void test_special_tables(void)
 {
     const char *sql;
     LibmsiDatabase *hdb = 0;
-    unsigned r;
+    unsigned r = 0;
 
     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
     ok(hdb, "libmsi_database_open failed\n");
@@ -4084,7 +4084,7 @@ static void test_tables_order(void)
     LibmsiQuery *hquery = 0;
     LibmsiRecord *hrec = 0;
     gchar *str;
-    unsigned r;
+    unsigned r = 0;
     char buffer[100];
     unsigned sz;
 
@@ -4191,7 +4191,7 @@ static void test_rows_order(void)
     LibmsiDatabase *hdb = 0;
     LibmsiQuery *hquery = 0;
     LibmsiRecord *hrec = 0;
-    unsigned r;
+    unsigned r = 0;
     char buffer[100];
     unsigned sz;
 
@@ -4313,7 +4313,7 @@ static void test_collation(void)
     LibmsiDatabase *hdb = 0;
     LibmsiQuery *hquery = 0;
     LibmsiRecord *hrec = 0;
-    unsigned r;
+    unsigned r = 0;
     char buffer[100];
     unsigned sz;
     gchar *str;
@@ -4428,7 +4428,7 @@ static void test_select_markers(void)
     LibmsiQuery *query;
     LibmsiRecord *res;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
     unsigned size;
     char buf[256];
 
@@ -4581,7 +4581,7 @@ static void test_stringtable(void)
     char buffer[MAX_PATH];
     WCHAR data[MAX_PATH];
     unsigned sz, read;
-    unsigned r;
+    unsigned r = 0;
 
     static const unsigned mode = STGM_DIRECT | STGM_READ | STGM_SHARE_DENY_WRITE;
     static const WCHAR stringdata[] = {0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0}; /* 
_StringData */
@@ -4852,7 +4852,7 @@ static void enum_stream_names(IStorage *stg)
 static void test_defaultdatabase(void)
 {
 #ifdef _WIN32
-    unsigned r;
+    unsigned r = 0;
     HRESULT hr;
     LibmsiDatabase *hdb;
     IStorage *stg = NULL;
@@ -4885,7 +4885,7 @@ static void test_order(void)
     LibmsiRecord *hrec;
     char buffer[256];
     const char *sql;
-    unsigned r, sz;
+    unsigned r = 0, sz;
     int val;
 
     hdb = create_db();
@@ -5138,7 +5138,7 @@ static void test_deleterow(void)
     LibmsiRecord *hrec;
     const char *sql;
     char buf[256];
-    unsigned r;
+    unsigned r = 0;
     unsigned size;
 
     unlink(msifile);
@@ -5203,7 +5203,7 @@ static void test_quotes(void)
     LibmsiRecord *hrec;
     const char *sql;
     char buf[256];
-    unsigned r;
+    unsigned r = 0;
     unsigned size;
 
     unlink(msifile);
@@ -5301,7 +5301,7 @@ static void test_carriagereturn(void)
     LibmsiRecord *hrec;
     const char *sql;
     char buf[256];
-    unsigned r;
+    unsigned r = 0;
     unsigned size;
 
     unlink(msifile);
@@ -5476,7 +5476,7 @@ static void test_noquotes(void)
     LibmsiRecord *hrec;
     const char *sql;
     char buf[256];
-    unsigned r;
+    unsigned r = 0;
     unsigned size;
 
     unlink(msifile);
@@ -5644,7 +5644,7 @@ static void test_forcecodepage(void)
     LibmsiDatabase *hdb;
     const char *sql;
     char buffer[512];
-    unsigned r;
+    unsigned r = 0;
     int fd;
 
     unlink(msifile);
@@ -5766,7 +5766,7 @@ static void test_storages_table(void)
     const char *sql;
     HRESULT hr;
     unsigned size;
-    unsigned r;
+    unsigned r = 0;
 
     hdb = create_db();
     ok(hdb, "failed to create db\n");
@@ -5879,7 +5879,7 @@ static void test_droptable(void)
     char buf[200];
     const char *sql;
     unsigned size;
-    unsigned r;
+    unsigned r = 0;
     GError *error = NULL;
 
     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
@@ -6078,7 +6078,7 @@ static void test_dbmerge(void)
     char buf[100];
     const char *sql;
     unsigned size;
-    unsigned r;
+    unsigned r = 0;
 
     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
     ok(hdb, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
@@ -6648,7 +6648,7 @@ static void test_select_with_tablenames(void)
     LibmsiQuery *query;
     LibmsiRecord *rec;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
     int i;
 
     int vals[4][2] = {
@@ -6734,7 +6734,7 @@ static void test_insertorder(void)
     LibmsiQuery *query;
     LibmsiRecord *rec;
     const char *sql;
-    unsigned r;
+    unsigned r = 0;
     int i;
 
     hdb = create_db();
@@ -6874,7 +6874,7 @@ static void test_columnorder(void)
     char buf[100];
     const char *sql;
     unsigned sz;
-    unsigned r;
+    unsigned r = 0;
 
     hdb = create_db();
     ok(hdb, "failed to create db\n");
@@ -7160,7 +7160,7 @@ static void test_createtable(void)
     LibmsiQuery *htab = 0;
     LibmsiRecord *hrec = 0;
     const char *sql;
-    unsigned res;
+    unsigned res = 0;
     unsigned size;
     char buffer[0x20];
     gchar *str;
@@ -7257,7 +7257,7 @@ static void test_embedded_nulls(void)
         "s72\tL0\n"
         "Control\tDialog\n"
         "LicenseAgreementDlg\ttext\x11\x19text\0text";
-    unsigned r, sz;
+    unsigned r = 0, sz;
     LibmsiDatabase *hdb;
     LibmsiRecord *hrec;
     char buffer[32];
@@ -7291,7 +7291,7 @@ static void test_select_column_names(void)
     LibmsiRecord *rec2;
     LibmsiQuery *query;
     char buffer[32];
-    unsigned r, size;
+    unsigned r = 0, size;
 
     unlink(msifile);
 
@@ -7467,7 +7467,7 @@ static void test_select_column_names(void)
     g_object_unref( hdb );
 }
 
-void main()
+int main()
 {
 #if !GLIB_CHECK_VERSION(2,35,1)
     g_type_init ();
diff --git a/tests/testrecord.c b/tests/testrecord.c
index 39cc275..a2c60b3 100644
--- a/tests/testrecord.c
+++ b/tests/testrecord.c
@@ -35,7 +35,7 @@ static bool create_temp_file (char *name)
 {
     unsigned char buffer[26], i;
     int fd;
-    
+
     strcpy (name, "msitext-XXXXXX.tmp");
     fd = g_mkstemp (name);
     g_return_val_if_fail (fd != -1, FALSE);
@@ -433,7 +433,7 @@ static void test_fieldzero (void)
     unlink (msifile);
 }
 
-void main ()
+int main ()
 {
 #if !GLIB_CHECK_VERSION(2,35,1)
     g_type_init ();
diff --git a/tests/testsuminfo.c b/tests/testsuminfo.c
index f1697c0..026dd66 100644
--- a/tests/testsuminfo.c
+++ b/tests/testsuminfo.c
@@ -371,7 +371,7 @@ static void test_summary_binary(void)
     DeleteFile( msifile );
 }
 
-void main()
+int main()
 {
 #if !GLIB_CHECK_VERSION(2,35,1)
     g_type_init ();
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..3ad342f
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,55 @@
+msidiff = configure_file(
+  input: 'msidiff.in',
+  output: 'msidiff',
+  configuration: config,
+  install: true,
+  install_dir: get_option('bindir'),
+)
+
+msidump = configure_file(
+  input : 'msidump.in',
+  output: 'msidump',
+  configuration: config,
+  install: true,
+  install_dir: get_option('bindir'),
+)
+
+msibuild = executable('msibuild',
+  'msibuild.c',
+  'sqldelim.c',
+  libmsi_enums_h,
+  dependencies: libmsi,
+  install: true,
+)
+
+misiinfo = executable('msiinfo',
+  'msiinfo.c',
+  libmsi_enums_h,
+  include_directories: inc_dirs,
+  dependencies: libmsi,
+  install: true,
+)
+
+if get_option('introspection')
+  msiextract = executable('msiextract',
+    'msiextract.vala',
+    libmsi_enums_h,
+    config_h,
+    include_directories: inc_dirs,
+    vala_args: [
+      '--enable-experimental',
+      '--pkg', 'gio-unix-2.0',
+      '--pkg', 'libgcab-1.0',
+      '--pkg', 'libmsi-1.0',
+      '--pkg', 'posix',
+      '--pkg', 'config',
+      '--vapidir=@0@'.format(meson.source_root()),
+      '--vapidir=@0@'.format(meson.build_root() / 'libmsi'),
+    ],
+    c_args: ['-include', meson.build_root() / 'config.h'],
+    dependencies: [libmsi, libgcab, libmsi_vapi],
+    install: true,
+  )
+
+  subdir('wixl')
+endif
diff --git a/tools/msiinfo.c b/tools/msiinfo.c
index ac299fd..255797a 100644
--- a/tools/msiinfo.c
+++ b/tools/msiinfo.c
@@ -672,7 +672,7 @@ end:
 
 static int cmd_version(struct Command *cmd, int argc, char **argv, GError **error)
 {
-    printf("%s (%s) version %s\n", g_get_prgname (), PACKAGE, VERSION);
+    printf("%s (%s) version %s\n", g_get_prgname (), PACKAGE_NAME, PACKAGE_VERSION);
     return 0;
 }
 
diff --git a/tools/wixl/meson.build b/tools/wixl/meson.build
new file mode 100644
index 0000000..54d61d5
--- /dev/null
+++ b/tools/wixl/meson.build
@@ -0,0 +1,71 @@
+libcommon = static_library('common',
+  'util.vala',
+  vala_header: 'libcommon.h',
+  vala_vapi: 'common.vapi',
+  vala_args: [
+    '--enable-experimental',
+    '--pkg', 'gio-2.0',
+    '--pkg', 'posix',
+    '--library', 'common',
+    '--vapidir=@0@'.format(meson.source_root() / 'vapi'),
+    '--vapidir=@0@'.format(meson.current_source_dir()),
+  ],
+  dependencies: glib,
+)
+
+wixl = executable('wixl',
+  'builder.vala',
+  'msi-default.vala',
+  'msi.vala',
+  'preprocessor.vala',
+  'wix.vala',
+  'wixl.vala',
+  config_h,
+  vala_args: [
+    '-H', 'wixl.h',
+    '--use-header',
+    '--enable-experimental',
+    '--pkg', 'config',
+    '--pkg', 'libmsi-1.0',
+    '--pkg', 'posix',
+    '--vapidir=@0@'.format(meson.source_root()),
+    '--vapidir=@0@'.format(meson.build_root() / 'libmsi'),
+  ],
+  c_args: ['-include', meson.build_root() / 'config.h'],
+  include_directories: inc_dirs,
+  link_with: libcommon,
+  dependencies: [
+    libmsi,
+    libmsi_vapi,
+    glib,
+    libgcab,
+    libxml,
+  ],
+  install: true,
+)
+
+wixl_heat = executable('wixl-heat',
+  'wixl-heat.vala',
+  config_h,
+  vala_args: [
+    '-H', 'wixl.h',
+    '--use-header',
+    '--enable-experimental',
+    '--pkg', 'config',
+    '--pkg', 'libmsi-1.0',
+    '--pkg', 'posix',
+    '--vapidir=@0@'.format(meson.source_root()),
+    '--vapidir=@0@'.format(meson.build_root() / 'libmsi'),
+  ],
+  c_args: ['-include', meson.build_root() / 'config.h'],
+  include_directories: inc_dirs,
+  link_with: libcommon,
+  dependencies: [
+    libmsi,
+    libmsi_vapi,
+    glib,
+    libgcab,
+    libxml,
+  ],
+  install: true,
+)
diff --git a/tools/wixl/wixl.vala b/tools/wixl/wixl.vala
index 5ed382b..136d9a0 100644
--- a/tools/wixl/wixl.vala
+++ b/tools/wixl/wixl.vala
@@ -51,7 +51,7 @@ namespace Wixl {
         opt_context.set_help_enabled (true);
         opt_context.add_main_entries (options, null);
 
-        wxidir = Config.PKGDATADIR + "/include";
+        wxidir = Path.build_filename (Config.DATADIR, "wixl-" + Config.PACKAGE_VERSION, "include");
 
         try {
             opt_context.parse (ref args);


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