Blob Blame History Raw
From 09ed933fc4153602d343047abfdb450877b431f1 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Mon, 22 Jul 2019 11:13:10 -0500
Subject: [PATCH] Don't install glade files outside build prefix

When using pkg-config variables to get installation directory locations,
we must be careful to redefine any pkgconfig variables necessary to
ensure the installation does not occur outside the build prefix. We
could do, e.g.:

module_dir = gladeui_dep.get_pkgconfig_variable(
    'moduledir',
    define_variable: ['libdir', libdir)])

Except in the particular case of glade, this is not possible because the
pkg-config file uses absolute paths (i.e. the moduledir variable is not
relative to libdir, and not even relative to prefix!) so there's no way
to override it. This means we can't use the pkg-config directories at
all.

If bored, fixing glade might be fun to do. In the meantime, we'll need
to install these manually. This fixes the files being installed under
/usr instead of /app when building a Fedora flatpak.
---
 glade/meson.build | 4 ++--
 meson.build       | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/glade/meson.build b/glade/meson.build
index 5351d7b..76a6552 100644
--- a/glade/meson.build
+++ b/glade/meson.build
@@ -1,9 +1,9 @@
 if glade_catalog
 
 glade_xml = 'libhandy.xml'
-module_dir = gladeui_dep.get_pkgconfig_variable('moduledir')
+module_dir = join_paths(libdir, 'glade', 'modules')
 dtd = join_paths(meson.current_source_dir(), 'glade-catalog.dtd')
-glade_catalogdir = gladeui_dep.get_pkgconfig_variable('catalogdir')
+glade_catalogdir = join_paths(datadir, 'glade', 'catalogs')
 
 libglade_hdy_sources = [
   'glade-hdy-header-group.c',
diff --git a/meson.build b/meson.build
index 655ff9c..fe4c80b 100644
--- a/meson.build
+++ b/meson.build
@@ -109,6 +109,7 @@ add_project_arguments(
 
 # Setup various paths that subdirectory meson.build files need
 package_subdir = get_option('package_subdir') # When used as subproject
+datadir = join_paths(get_option('datadir'), package_subdir)
 libdir = join_paths(get_option('libdir'), package_subdir)
 girdir = join_paths(get_option('datadir'), package_subdir, 'gir-1.0')
 typelibdir = join_paths(get_option('libdir'), package_subdir, 'girepository-1.0')
-- 
2.21.0