[phodav] build-sys: add make-msi script to do MSI with(out) meson



commit 15f9b594a4284bc402c052d6636ea4f36d9a67e1
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Tue Feb 26 16:03:53 2019 +0100

    build-sys: add make-msi script to do MSI with(out) meson
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 doc/reference/meson.build |  6 +++++-
 make-msi.sh.in            | 15 ++++++++++++++
 meson.build               | 52 +++++++++++++++++++++++++++++++++++++++--------
 meson_options.txt         |  5 +++++
 4 files changed, 69 insertions(+), 9 deletions(-)
---
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 65ed877..e53dcff 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -4,7 +4,11 @@ ent_conf.set('PACKAGE_BUGREPORT', proj_bugurl)
 ent_conf.set('PACKAGE_NAME', 'PhoDAV')
 ent_conf.set('PACKAGE_STRING', proj_name)
 ent_conf.set('PACKAGE_VERSION', meson.project_version())
-configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
+configure_file(
+  input: 'gtkdocentities.ent.in',
+  output: 'gtkdocentities.ent',
+  configuration: ent_conf
+)
 
 glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
 glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
diff --git a/make-msi.sh.in b/make-msi.sh.in
new file mode 100755
index 0000000..465e7dc
--- /dev/null
+++ b/make-msi.sh.in
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+export MANUFACTURER="The Spice Project"
+export DESTDIR=`mktemp -d`
+ninja install
+
+rpm -qa | sort | unix2dos > deps.txt
+
+for p in chezdav spice-webdavd ; do
+    wixl -D SourceDir="@prefix@" \
+         -D DESTDIR="$DESTDIR@prefix@" \
+         --arch @WIXL_ARCH@ \
+         -o $p-@WIXL_ARCH@-@VERSION@@BUILDID@.msi \
+         $p.wxs
+done
diff --git a/meson.build b/meson.build
index 6af0a22..8ca6b75 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('phodav', 'c',
+project('PhoDAV', 'c',
         version : run_command('build-aux/git-version-gen', 
'@0@/.tarball-version'.format(meson.source_root()), check : true).stdout().strip(),
         license : 'LGPLv2.1',
         meson_version : '>= 0.49')
@@ -64,17 +64,53 @@ subdir('libphodav')
 subdir('spice')
 subdir('doc')
 
-#
-# write config.h
-#
+buildid = get_option('build-id')
+version = proj_version.split('.')
+maj = version[0].to_int()
+min = version[1].split('-')[0].to_int()
+mic = 0
+if version.length() > 2
+  mic = version[2].split('-')[0].to_int()
+endif
+win_version = '@0@.@1@.@2@'.format(maj, min, mic * 256 + buildid)
+
+if buildid != 0
+  buildid = '@0@'.format(buildid)
+else
+  buildid = ''
+endif
+
+wixl_arch = 'x86'
+if build_machine.cpu_family() == 'x86_64'
+  wixl_arch = 'x64'
+endif
+
+if host_machine.system() == 'windows'
+  foreach out : [ 'chezdav.wxs', 'spice-webdavd.wxs', 'make-msi.sh' ]
+    configure_file(
+      input : '@0@.in'.format(out),
+      output : out,
+      install : false,
+      configuration : {
+        'BUILDID' : buildid,
+        'VERSION' : proj_version,
+        'WINDOWS_PRODUCTVERSION' : win_version,
+        'WIXL_ARCH' : wixl_arch,
+        'srcdir' : meson.current_source_dir(),
+        'prefix' : prefix,
+      }
+    )
+  endforeach
+endif
+
 config = {
-  'VERSION' : proj_version,
-  'PACKAGE_NAME' : proj_name,
-  'PACKAGE_VERSION' : proj_version,
   'GETTEXT_PACKAGE' : proj_gettext,
   'LOCALEDIR' : localedir,
+  'PACKAGE_BUGREPORT' : proj_bugurl,
+  'PACKAGE_NAME' : proj_name,
   'PACKAGE_STRING' : '@0@ @1@'.format(proj_name, proj_version),
-  'PACKAGE_BUGREPORT' : proj_bugurl
+  'PACKAGE_VERSION' : proj_version,
+  'VERSION' : proj_version,
 }
 foreach key, value : config
   conf.set_quoted(key, value)
diff --git a/meson_options.txt b/meson_options.txt
index cab96b2..d72a44b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,3 +9,8 @@ option('avahi',
 option('systemd',
        type : 'feature',
        description : 'Install systemd units/configuration')
+
+option('build-id',
+       type : 'integer',
+       value : 0,
+       description : 'Build ID')


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