From 37f24a9bd62f0a8f3e37eaddd33f2f0c9d3aaa0a Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Fri, 1 Apr 2022 23:12:17 -0700
Subject: [PATCH] meson: add pythoninstalldir option

In case of cross build, using host python to determine the python
site-packages directory for target is not feasible, add a new option
pythoninstalldir to fix the issue.

Upstream-Status: Submitted [https://github.com/blueman-project/blueman/pull/1699]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meson.build       | 7 ++++++-
 meson_options.txt | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index bc990cd..a37aacd 100644
--- a/meson.build
+++ b/meson.build
@@ -26,7 +26,12 @@ pkgdatadir = join_paths([prefix, get_option('datadir'), package_name])
 bindir = join_paths([prefix, get_option('bindir')])
 libexecdir = join_paths([prefix, get_option('libexecdir')])
 schemadir = join_paths([datadir, 'glib-2.0', 'schemas'])
-pythondir = join_paths([prefix, python.sysconfig_path('purelib')])
+pythoninstalldir = get_option('pythoninstalldir')
+if pythoninstalldir != ''
+    pythondir = join_paths([prefix, pythoninstalldir])
+else
+    pythondir = join_paths([prefix, python.sysconfig_path('purelib')])
+endif
 
 if get_option('policykit')
     have_polkit = 'True'
diff --git a/meson_options.txt b/meson_options.txt
index b3e939f..96acbbc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -5,5 +5,6 @@ option('pulseaudio', type: 'boolean', value: true, description: 'Enable PulseAud
 option('appindicator', type: 'boolean', value: true, description: 'Enable Libappindicator support')
 option('systemdsystemunitdir', type: 'string', description: 'Path to systemd system unit dir relative to ${prefix}')
 option('systemduserunitdir', type: 'string', description: 'Path to systemd user unit dir relative to ${prefix}')
+option('pythoninstalldir', type: 'string', description: 'Path to python site-packages dir relative to ${prefix}')
 option('sendto-plugins', type: 'array', choices: ['Caja', 'Nemo', 'Nautilus'], value: ['Caja', 'Nemo', 'Nautilus'], description: 'Install sendto plugins for various filemanagers')
 option('thunar-sendto', type: 'boolean', value: true, description: 'Install Thunar sendto plugin')
-- 
2.33.0

