Add Meson build system
Meson is modern, fast, and smarter than the current installation script. We change the primary build system to Meson.
By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.
Meson is modern, fast, and smarter than the current installation script. We change the primary build system to Meson.
roundabout,
created on Friday, 3 April 2020, 14:58:01 (1585925881),
received on Sunday, 11 May 2025, 13:22:52 (1746969772)
Author identity: nana-4 <hnmaigo@gmail.com>
c92dfa4b57094cc3080467e4c9c56ccd627b8661
*.pem tmptmp/ build*/ src/cinnamon/cinnamon.*.scss src/gnome-shell/gnome-shell.*.scss src/gtk/gtk.*.scss src/gtk/gtk-dark.*.scss
project( 'materia-theme', version: '20200320', license: 'GPLv2+', meson_version: '>= 0.47.0', default_options: ['prefix=/usr'], ) theme_base_name = get_option('theme_name') theme_base_dir = join_paths(get_option('datadir'), 'themes', theme_base_name) sassc = find_program('sassc') sassc_opts = ['-M', '-t', 'expanded'] themes = [] foreach color: get_option('colors') foreach size: get_option('sizes') if color == 'default' color_suffix = '' scss_variant = 'light' scss_topbar = 'dark' elif color == 'light' color_suffix = '-light' scss_variant = 'light' scss_topbar = 'light' elif color == 'dark' color_suffix = '-dark' scss_variant = 'dark' scss_topbar = 'dark' endif if size == 'default' size_suffix = '' scss_compact = 'false' elif size == 'compact' size_suffix = '-compact' scss_compact = 'true' endif themes += { 'name': theme_base_name + color_suffix + size_suffix, 'dir': theme_base_dir + color_suffix + size_suffix, 'color': color_suffix, 'size': size_suffix, 'scss_variant': scss_variant, 'scss_topbar': scss_topbar, 'scss_compact': scss_compact, } endforeach endforeach foreach theme: themes install_data( 'COPYING', install_dir: theme['dir'], ) endforeach if not get_option('flatpak') subdir('src') else subdir('src/gtk') endif
option( 'theme_name', type: 'string', value: 'Materia', description: 'Set theme name', ) option( 'colors', type: 'array', choices: ['default', 'light', 'dark'], description: 'Choose color variant(s)', ) option( 'sizes', type: 'array', choices: ['default', 'compact'], description: 'Choose size variant(s)', ) option( 'gnome_shell_version', type: 'string', description: 'Manually set gnome-shell version', ) option( 'flatpak', type: 'boolean', value: false, description: 'Build theme for flatpak package', )
foreach theme: themes chrome_dir = join_paths(theme['dir'], 'chrome') if theme['color'] != '-dark' chrome_scrollbar_color = '' else chrome_scrollbar_color = '-dark' endif install_data( 'chrome-scrollbar@0@.crx'.format(chrome_scrollbar_color), rename: 'chrome-scrollbar.crx', install_dir: chrome_dir, ) install_data( 'chrome-theme@0@.crx'.format(theme['color']), rename: 'chrome-theme.crx', install_dir: chrome_dir, ) endforeach
$variant: "@variant@"; $topbar: "@topbar@"; $compact: "@compact@"; @import "../variables"; @import "../colors"; @import "../gnome-shell/sass/variables"; @import "../gnome-shell/sass/drawing"; @import "sass/over-rides"; @import "sass/extends"; @import "sass/common";
cinnamon_scss_depend_files = files([ '../_color-palette.scss', '../_colors.scss', '../_variables.scss', '../gnome-shell/sass/_drawing.scss', '../gnome-shell/sass/_variables.scss', 'sass/_common.scss', 'sass/_extends.scss', 'sass/_over-rides.scss', ]) foreach theme: themes cinnamon_dir = join_paths(theme['dir'], 'cinnamon') install_subdir( 'assets', install_dir: cinnamon_dir, ) install_data( 'thumbnail.png', install_dir: cinnamon_dir, ) # # SCSS # cinnamon_scss_conf = configuration_data() cinnamon_scss_conf.set('variant', theme['scss_variant']) cinnamon_scss_conf.set('topbar', theme['scss_topbar']) cinnamon_scss_conf.set('compact', theme['scss_compact']) # Configure SCSS file cinnamon_scss = configure_file( input: 'cinnamon.scss.in', output: 'cinnamon.@0@.scss'.format(theme['name']), configuration: cinnamon_scss_conf, ) # Copy it from build dir to source dir run_command( 'cp', cinnamon_scss, meson.current_source_dir(), ) # Generate and install CSS file custom_target( 'cinnamon.@0@.css'.format(theme['name']), input: 'cinnamon.@0@.scss'.format(theme['name']), output: 'cinnamon.@0@.css'.format(theme['name']), command: [sassc, sassc_opts, '@INPUT@', '@OUTPUT@'], depend_files: cinnamon_scss_depend_files, install: true, install_dir: cinnamon_dir, ) # Rename it to a valid name meson.add_install_script( 'mv', join_paths(get_option('prefix'), cinnamon_dir, 'cinnamon.@0@.css'.format(theme['name'])), join_paths(get_option('prefix'), cinnamon_dir, 'cinnamon.css'), ) endforeach
$variant: "@variant@"; $topbar: "@topbar@"; $compact: "@compact@"; $version: @version@; @import "../variables"; @import "../colors"; @import "sass/variables"; @import "sass/drawing"; @import "sass/components"; @import "sass/extensions";
gnome_shell = find_program('gnome-shell', required: false) if get_option('gnome_shell_version') != '' gnome_shell_version = get_option('gnome_shell_version') else if gnome_shell.found() gnome_shell_version_array = run_command([gnome_shell, '--version']).stdout().split('\n')[0].split(' ')[-1].strip().split('.') if gnome_shell_version_array[1].to_int().is_even() gnome_shell_version = '.'.join([gnome_shell_version_array[0], gnome_shell_version_array[1]]) else gnome_shell_version = '.'.join([gnome_shell_version_array[0], (gnome_shell_version_array[1].to_int() + 1).to_string()]) endif else message('gnome-shell not found, using styles for last gnome-shell version availible') gnome_shell_version = '3.36' endif endif gnome_shell_scss_depend_files = files([ '../_color-palette.scss', '../_colors.scss', '../_variables.scss', 'sass/components/dialog/_dialog.scss', 'sass/components/dialog/_network-dialog.scss', 'sass/components/gdm/_login-dialog.scss', 'sass/components/gdm/_screen-shield.scss', 'sass/components/menu/_calendar.scss', 'sass/components/menu/_candidate-popup.scss', 'sass/components/menu/_menu.scss', 'sass/components/menu/_message-list.scss', 'sass/components/misc/_a11y.scss', 'sass/components/misc/_keyboard.scss', 'sass/components/misc/_looking-glass.scss', 'sass/components/misc/_misc.scss', 'sass/components/misc/_tile-preview.scss', 'sass/components/notification/_hotplug.scss', 'sass/components/notification/_notification.scss', 'sass/components/osd/_osd.scss', 'sass/components/osd/_switcher.scss', 'sass/components/osd/_workspace-switcher.scss', 'sass/components/overview/_app-grid.scss', 'sass/components/overview/_dash.scss', 'sass/components/overview/_overview.scss', 'sass/components/overview/_search-entry.scss', 'sass/components/overview/_search-results.scss', 'sass/components/overview/_window-picker.scss', 'sass/components/overview/_workspace-switcher.scss', 'sass/components/panel/_panel.scss', 'sass/components/panel/_ripple-box.scss', 'sass/components/_base.scss', 'sass/components/_button.scss', 'sass/components/_check-box.scss', 'sass/components/_entry.scss', 'sass/components/_scrollbar.scss', 'sass/components/_slider.scss', 'sass/components/_switch.scss', 'sass/_components.scss', 'sass/_drawing.scss', 'sass/_extensions.scss', 'sass/_variables.scss', ]) foreach theme: themes gnome_shell_dir = join_paths(theme['dir'], 'gnome-shell') if theme['color'] != '-dark' gnome_shell_assets_dir = 'assets' else gnome_shell_assets_dir = 'assets-dark' endif install_subdir( gnome_shell_assets_dir, strip_directory: true, install_dir: join_paths(gnome_shell_dir, 'assets'), ) install_subdir( 'extensions', install_dir: gnome_shell_dir, ) install_subdir( 'icons', install_dir: gnome_shell_dir, ) install_data( [ 'README.md', 'gnome-shell-theme.gresource.xml', 'noise-texture.png', 'pad-osd.css', 'process-working.svg', ], install_dir: gnome_shell_dir, ) # # SCSS # gnome_shell_scss_conf = configuration_data() gnome_shell_scss_conf.set('variant', theme['scss_variant']) gnome_shell_scss_conf.set('topbar', theme['scss_topbar']) gnome_shell_scss_conf.set('compact', theme['scss_compact']) gnome_shell_scss_conf.set('version', gnome_shell_version) # Configure SCSS file gnome_shell_scss = configure_file( input: 'gnome-shell.scss.in', output: 'gnome-shell.@0@.scss'.format(theme['name']), configuration: gnome_shell_scss_conf, ) # Copy it from build dir to source dir run_command( 'cp', gnome_shell_scss, meson.current_source_dir(), ) # Generate and install CSS file custom_target( 'gnome-shell.@0@.css'.format(theme['name']), input: 'gnome-shell.@0@.scss'.format(theme['name']), output: 'gnome-shell.@0@.css'.format(theme['name']), command: [sassc, sassc_opts, '@INPUT@', '@OUTPUT@'], depend_files: gnome_shell_scss_depend_files, install: true, install_dir: gnome_shell_dir, ) # Rename it to a valid name meson.add_install_script( 'mv', join_paths(get_option('prefix'), gnome_shell_dir, 'gnome-shell.@0@.css'.format(theme['name'])), join_paths(get_option('prefix'), gnome_shell_dir, 'gnome-shell.css'), ) endforeach
foreach theme: themes gtk2_dir = join_paths(theme['dir'], 'gtk-2.0') if theme['color'] != '-dark' gtk2_assets_dir = 'assets' else gtk2_assets_dir = 'assets-dark' endif install_subdir( gtk2_assets_dir, strip_directory: true, install_dir: join_paths(gtk2_dir, 'assets'), ) install_data( 'gtkrc' + theme['color'], rename: 'gtkrc', install_dir: gtk2_dir, ) install_data( [ 'apps.rc', 'hacks.rc', 'main.rc', ], install_dir: gtk2_dir, ) endforeach
$variant: "dark"; $topbar: "dark"; $compact: "@compact@"; @import "../variables"; @import "../colors"; @import "sass/drawing-3.20"; @import "sass/common-3.20"; @import "sass/apps-3.22"; @import "sass/colors-public";
$variant: "@variant@"; $topbar: "@topbar@"; $compact: "@compact@"; @import "../variables"; @import "../colors"; @import "sass/drawing-3.20"; @import "sass/common-3.20"; @import "sass/apps-3.22"; @import "sass/colors-public";
gtk_versions = [ '3.0', ] gtk_scss_depend_files = files([ '../_color-palette.scss', '../_colors.scss', '../_variables.scss', 'sass/apps/_budgie.scss', 'sass/apps/_gnome-3.22.scss', 'sass/apps/_lightdm.scss', 'sass/apps/_mate.scss', 'sass/apps/_misc.scss', 'sass/apps/_nemo.scss', 'sass/apps/_unity.scss', 'sass/apps/_xfce.scss', 'sass/_apps-3.22.scss', 'sass/_colors-public.scss', 'sass/_common-3.20.scss', 'sass/_drawing-3.20.scss', ]) foreach theme: themes gtk_variants = [ '', ] # Only non-dark themes need a dark variant. if theme['color'] != '-dark' gtk_variants += '-dark' endif gtk_scss_conf = configuration_data() gtk_scss_conf.set('variant', theme['scss_variant']) gtk_scss_conf.set('topbar', theme['scss_topbar']) gtk_scss_conf.set('compact', theme['scss_compact']) foreach gtk_version: gtk_versions gtk_version_dir = join_paths(theme['dir'], 'gtk-@0@'.format(gtk_version)) install_subdir( 'assets', install_dir: gtk_version_dir, ) install_subdir( 'icons', install_dir: gtk_version_dir, ) # # SCSS # foreach gtk_variant: gtk_variants gtk_temp_name = 'gtk@0@.gtk-@1@.@2@'.format(gtk_variant, gtk_version, theme['name']) # Configure SCSS file gtk_scss = configure_file( input: 'gtk@0@.scss.in'.format(gtk_variant), output: '@0@.scss'.format(gtk_temp_name), configuration: gtk_scss_conf, ) # Copy it from build dir to source dir run_command( 'cp', gtk_scss, meson.current_source_dir(), ) # Generate and install CSS file custom_target( '@0@.css'.format(gtk_temp_name), input: '@0@.scss'.format(gtk_temp_name), output: '@0@.css'.format(gtk_temp_name), command: [sassc, sassc_opts, '@INPUT@', '@OUTPUT@'], depend_files: gtk_scss_depend_files, install: true, install_dir: gtk_version_dir, ) # Rename it to a valid name meson.add_install_script( 'mv', join_paths(get_option('prefix'), gtk_version_dir, '@0@.css'.format(gtk_temp_name)), join_paths(get_option('prefix'), gtk_version_dir, 'gtk@0@.css'.format(gtk_variant)), ) endforeach endforeach endforeach
[Desktop Entry] Type=X-GNOME-Metatheme Name=@theme_name@ Comment=A Material Design theme Encoding=UTF-8 [X-GNOME-Metatheme] GtkTheme=@theme_name@ MetacityTheme=@theme_name@ IconTheme=Adwaita CursorTheme=Adwaita CursorSize=24
foreach theme: themes index_theme_conf = configuration_data() index_theme_conf.set('theme_name', theme['name']) index_theme = configure_file( input: 'index.theme.in', output: 'index.@0@.theme'.format(theme['name']), configuration: index_theme_conf, ) install_data( index_theme, rename: 'index.theme', install_dir: theme['dir'], ) endforeach subdir('chrome') subdir('cinnamon') subdir('gnome-shell') subdir('gtk') subdir('gtk-2.0') subdir('metacity-1') subdir('plank') subdir('unity') subdir('xfwm4')
foreach theme: themes metacity_dir = join_paths(theme['dir'], 'metacity-1') install_subdir( 'assets', install_dir: metacity_dir, ) install_data( 'metacity-theme-2@0@.xml'.format(theme['color']), rename: 'metacity-theme-2.xml', install_dir: metacity_dir, ) install_data( 'metacity-theme-3.xml', install_dir: metacity_dir, ) endforeach
foreach theme: themes plank_dir = join_paths(theme['dir'], 'plank') install_data( 'dock.theme', install_dir: plank_dir, ) endforeach
foreach theme: themes unity_dir = join_paths(theme['dir'], 'unity') if theme['color'] != '-light' unity_window_buttons_dir = 'window-buttons' else unity_window_buttons_dir = 'window-buttons-light' endif install_subdir( unity_window_buttons_dir, strip_directory: true, install_dir: unity_dir, ) install_subdir( 'dash-buttons', strip_directory: true, install_dir: unity_dir, ) install_subdir( 'launcher', strip_directory: true, install_dir: unity_dir, ) install_data( 'dash-widgets.json', install_dir: unity_dir, ) endforeach
foreach theme: themes xfwm4_dir = join_paths(theme['dir'], 'xfwm4') install_subdir( 'xfwm4' + theme['color'], strip_directory: true, install_dir: xfwm4_dir, ) endforeach