Skip to content

Commit

Permalink
build: Add option for compiling gnome-shell theme into gresource
Browse files Browse the repository at this point in the history
Intended to help users who want to add Arc styling to GDM by
replacing the default gnome-shell-theme.gresource. Compiled
gresources are simply installed alongside the shell themes, and
it is up to users to make any use of them.
  • Loading branch information
jnsh committed Mar 31, 2021
1 parent 2c3c741 commit b0bebda
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Option | Default value | Description
`cinnamon_version` | - | Build Cinnamon theme for specific version
`gnome_shell_version` | - | Build GNOME Shell theme for specific version
`gtk3_version` | - | Build GTK 3 theme for specific version
`gnome_shell_gresource` | `false` | Compile GNOME Shell theme into a gresource file

#### Uninstallation

Expand Down
49 changes: 48 additions & 1 deletion common/gnome-shell/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# supported versions
gnome_shell_versions = ['3.18', '3.20', '3.22', '3.24', '3.26', '3.28', '3.30', '3.32', '3.34', '3.36', '3.38', '40']

# glib-compile-resources dependency
if get_option('gnome_shell_gresource')
glib_compile_resources = find_program('glib-compile-resources')
endif

# gnome-shell version
gnome_shell = find_program('gnome-shell', required : false)

Expand Down Expand Up @@ -33,7 +38,7 @@ if gnome_shell_ver not in gnome_shell_versions
endif
endif

# compile and install
# dependency files

sass_depend_files = run_command(
'find', '-L',
Expand All @@ -42,6 +47,26 @@ sass_depend_files = run_command(
check : true
).stdout().split()

if get_option('gnome_shell_gresource')
gresource_depend_files = []

gresource_depend_files += [
meson.current_source_dir() / gnome_shell_ver / 'pad-osd.css'
]

gresource_depend_files += run_command(
'find', '-L',
meson.current_source_dir() / gnome_shell_ver / 'icons',
meson.current_source_dir() / gnome_shell_ver / 'common-assets',
meson.current_source_dir() / gnome_shell_ver / 'light-assets',
meson.current_source_dir() / gnome_shell_ver / 'dark-assets',
meson.current_source_dir() / gnome_shell_ver / 'lighter-assets',
check : true
).stdout().split()
endif

# compile and install

foreach variant : get_option('variants')
if variant != 'darker'
if not (variant == 'lighter' and gnome_shell_ver.version_compare('<=3.30'))
Expand All @@ -63,6 +88,28 @@ foreach variant : get_option('variants')
depend_files : sass_depend_files
)

if get_option('gnome_shell_gresource')
gresource_name = (variant == 'light' ? 'gnome-shell-theme' : 'gnome-shell-theme-' + variant)

gnome_shell_gresource = custom_target(
gresource_name + '-gresource',
input : meson.current_source_dir() / gnome_shell_ver / 'gresource' / gresource_name + '.gresource.xml',
output : gresource_name + '.gresource',
command : [
glib_compile_resources,
'--sourcedir=' + meson.current_source_dir() / gnome_shell_ver,
'--sourcedir=' + meson.current_build_dir(),
'--target=@OUTPUT@',
'@INPUT@'
],
build_by_default : true,
install : true,
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gnome-shell'),
depends : gnome_shell_css,
depend_files: gresource_depend_files
)
endif

meson.add_install_script(
'sh', '-c',
'install -DT' + ' ' +
Expand Down
7 changes: 7 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ option(
type: 'string',
description: 'Build GTK 3 theme for specific version',
)

option(
'gnome_shell_gresource',
type: 'boolean',
value: false,
description: 'Compile GNOME Shell theme into a gresource file',
)

0 comments on commit b0bebda

Please sign in to comment.