summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali <zeenix@collabora.co.uk>2018-09-24 09:54:20 +0200
committerZeeshan Ali <zeenix@collabora.co.uk>2018-09-24 19:28:05 +0200
commitb5bddfaeacfc97a3f9ee0f95bb19cf26b990f3a8 (patch)
tree10feaa940c0049209eff05249887156d1cb3fb57
parent1d965f9b1e18d00feddc0fb8dae784f044b36625 (diff)
downloadgeoclue-wip/fix-autostart.tar.gz
build: Install demo agent to autostart directory toowip/fix-autostart
We were doing this already but forgot to port this from autotools to meson.
-rw-r--r--demo/install-file.py26
-rw-r--r--demo/meson.build20
2 files changed, 40 insertions, 6 deletions
diff --git a/demo/install-file.py b/demo/install-file.py
new file mode 100644
index 0000000..e06d9df
--- /dev/null
+++ b/demo/install-file.py
@@ -0,0 +1,26 @@
+#!/bin/python3
+
+# A simple script that copies a given file (first arg) to a given location
+# (second arg).
+
+import sys
+import os
+from shutil import copy
+
+if len(sys.argv) < 3:
+ print('Usage: ' + sys.argv[0] + ' SOURCE_FILE DESTINATION_DIR')
+
+ sys.exit(-1)
+
+try:
+ dest_dir = os.environ['DESTDIR'] + '/' + sys.argv[2]
+except KeyError:
+ dest_dir = sys.argv[2]
+
+try:
+ if not os.path.exists(dest_dir):
+ os.makedirs(dest_dir)
+except OSError:
+ print ('Error: Creating directory. ' + dest_dir)
+
+copy(sys.argv[1], dest_dir)
diff --git a/demo/meson.build b/demo/meson.build
index 61df493..07d4797 100644
--- a/demo/meson.build
+++ b/demo/meson.build
@@ -48,10 +48,18 @@ if get_option('demo-agent')
desktop_in = configure_file(output: 'geoclue-demo-agent.desktop.in',
input: 'geoclue-demo-agent.desktop.in.in',
configuration: desktop_conf)
- i18n.merge_file(output: 'geoclue-demo-agent.desktop',
- input: desktop_in,
- type: 'desktop',
- po_dir: '../po',
- install: true,
- install_dir: desktop_dir)
+ desktop_file = i18n.merge_file(output: 'geoclue-demo-agent.desktop',
+ input: desktop_in,
+ type: 'desktop',
+ po_dir: '../po',
+ install: true,
+ install_dir: desktop_dir)
+
+ # Also install in the autostart directory.
+ autostart_dir = join_paths(get_option('prefix'),
+ get_option('sysconfdir'),
+ 'xdg/autostart')
+ meson.add_install_script('install-file.py',
+ desktop_file.full_path(),
+ autostart_dir)
endif