From 8e13e5b2fa7979f306b146dd6086e2ef6ef24a20 Mon Sep 17 00:00:00 2001 From: trsnaqe Date: Thu, 4 Jul 2024 02:02:06 +0300 Subject: [PATCH] added compile schema step post installation for meson.build --- makezip.sh | 6 +++++- meson.build | 7 +++++++ scripts/compile-schema.sh | 13 +++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 scripts/compile-schema.sh diff --git a/makezip.sh b/makezip.sh index 3175a88..27ac80e 100755 --- a/makezip.sh +++ b/makezip.sh @@ -15,7 +15,7 @@ zipname='gamemodeshellextension@trsnaqe.com.shell-extension.zip' # Function to build and package the extension build_and_package() { # Meson setup and install - meson setup --prefix="$installdir" "$srcdir" "$builddir" + meson setup --prefix=$installdir $srcdir $builddir meson install -C "$builddir" # Prepare for packaging @@ -59,6 +59,9 @@ install_extension() { echo "Extension installed to ${targetdir}" + # Compile the schema within the extension directory + glib-compile-schemas "${targetdir}/schemas" + # Check if the schema is installed if is_schema_installed; then echo "Schema is installed." @@ -73,6 +76,7 @@ install_extension() { echo "Extension enabled." } + # Function to remove build files remove_build_files() { rm -rf "$builddir" diff --git a/meson.build b/meson.build index 08b54e7..b025f8e 100644 --- a/meson.build +++ b/meson.build @@ -13,6 +13,7 @@ gnome = import('gnome') # Directories datadir = get_option('datadir') +prefix = get_option('prefix') extensiondir = join_paths(datadir, 'gnome-shell', 'extensions', uuid) schemadir = join_paths(datadir, 'glib-2.0', 'schemas') @@ -40,5 +41,11 @@ install_data( install_dir: schemadir ) +# Compile schema +meson.add_install_script( + 'scripts/compile-schema.sh', + join_paths(prefix, schemadir) +) + # Build completion message message('Project version: @0@'.format(meson.project_version())) diff --git a/scripts/compile-schema.sh b/scripts/compile-schema.sh new file mode 100644 index 0000000..85663a9 --- /dev/null +++ b/scripts/compile-schema.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +SCHEMADIR="${1:-/usr/share/glib-2.0/schemas}" + +if [ -z "$DESTDIR" ]; then + TARGETDIR="${SCHEMADIR}" +else + TARGETDIR="${DESTDIR}/${SCHEMADIR}" +fi + +glib-compile-schemas "${TARGETDIR}" +ls -l "${TARGETDIR}/gschemas.compiled" +echo "Compiled schema."