Skip to content

Commit

Permalink
added compile schema step post installation for meson.build
Browse files Browse the repository at this point in the history
  • Loading branch information
Trsnaqe committed Jul 3, 2024
1 parent d85aa7b commit 8e13e5b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion makezip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand All @@ -73,6 +76,7 @@ install_extension() {
echo "Extension enabled."
}


# Function to remove build files
remove_build_files() {
rm -rf "$builddir"
Expand Down
7 changes: 7 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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()))
13 changes: 13 additions & 0 deletions scripts/compile-schema.sh
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit 8e13e5b

Please sign in to comment.