Add meson build system

This commit is contained in:
Joonas Henriksson 2020-09-21 01:43:56 +03:00
parent 0cc0531e1a
commit f5b2e047b9
No known key found for this signature in database
GPG Key ID: FAEDBC4FB5AA3B17
19 changed files with 909 additions and 81 deletions

View File

@ -6,7 +6,7 @@ This theme uses libsass to process the various .scss files. Never edit any of th
* Edit the `common/*/sass/*.scss` files.
* Run `make` to generate all css files using `sassc`.
* Rebuild to generate all css files using `sassc`.
#### Editing the GTK 2 themes
@ -30,7 +30,7 @@ Because this theme is heavily based on the pixmap engine, a lot of the styling c
* Find the object you want to edit and make your changes. **Important:** Don't change the object *id*!
* Save `assets.svg` and run `make` (or `make -j$(nproc)` if you're in a hurry) from a terminal in the parent directory.
* Save `assets.svg` and rebuild.
---

118
INSTALL.autotools.md Normal file
View File

@ -0,0 +1,118 @@
## Installing Arc from the source
#### Getting the source
To get the source, either clone the git repository with:
git clone https://github.com/jnsh/arc-theme --depth 1
cd arc-theme/
Or download and extract a [snapshot](https://github.com/jnsh/arc-theme/archive/master.zip) of the master branch:
wget https://github.com/jnsh/arc-theme/archive/master.zip
unzip master.zip
cd arc-theme-master/
#### Build and install
##### Installing system wide for all users
Install to `/usr/share/themes` for all users by running the following with root permissions:
./autogen.sh --prefix=/usr
make install
##### Installing for single user
Use the following commands to install the theme to `~/.local/share/themes/` for your user only:
./autogen.sh --prefix=$HOME/.local
make install
**Note:** Some themes (at least GTK 2) aren't loaded from `~/.local/share/themes/`. You can work around this e.g. by symlinking the Arc theme directories in `~/.local/share/themes/` to `~/.themes/` with following commands:
mkdir -p ~/.themes/
for d in Arc{,-Dark,-Darker,-Lighter}{,-solid}; do
[ -d ~/.local/share/themes/$d ] && ln -s ~/.local/share/themes/$d ~/.themes/;
done
## Dependencies
#### Build dependencies
To build the theme the following packages are required:
* `autoconf`
* `automake`
* `make`
* `pkgconf`
The following packages are only required for building certain themes:
* `sassc` for GTK 3, Cinnamon, and GNOME Shell
* `inkscape` for GTK 2, GTK 3, and XFWM
* `glib2` for GTK 3 (needs `glib-compile-resources` binary, the exact package name varies between distributions)
You can avoid these dependencies by disabling support for the specific themes with build options detailed below.
##### Optional build dependencies
The following packages are optional, but used to optimize the built theme if available:
* `optipng` for optimizing PNG assets for GTK 2, GTK 3, and XFWM
#### Runtime dependencies
For the GTK 2 theme to function properly, install the following:
* `gnome-themes-extra`, or `gnome-themes-standard` before GNOME version 3.28
* The murrine GTK 2 engine. This has different names depending on the distribution:
* `gtk-engine-murrine` (Arch Linux)
* `gtk2-engines-murrine` (Debian, Ubuntu, elementary OS)
* `gtk-murrine-engine` (Fedora)
* `gtk2-engine-murrine` (openSUSE)
* `gtk-engines-murrine` (Gentoo)
## Versioned themes
The source code comes branched for different versions of GTK 3, GNOME Shell, and Cinnamon. Only one version of those themes will be installed, and using the wrong versions will result in issues of varying severity.
The theme versions that will be built can be set manually with build options. Otherwise the build system tries to determine correct versions using the following packages on the build environment:
* `gnome-shell` for detecting GNOME Shell version
* `cinnamon` for detecting Cinnamon version
* the GTK 3 package, or its development files for distributions that ship those separately (e.g. `libgtk-3-dev` for Debian based distros or `gtk3-devel` for RPM based distros), for detecting GTK 3 version
The above packages are not required if the theme versions are defined manually (see build options below).
**Note:** The build will fail, if GTK 3, Cinnamon, or GNOME Shell versions can't be determined. You can work around this by either disabling the build of a specific theme, or by specifying the versions manually with build options detailed below.
## Build options
Options to pass to `autogen.sh`:
--disable-transparency disable transparency in the theme
--disable-light disable Arc Light support
--disable-darker disable Arc Darker support
--disable-dark disable Arc Dark support
--disable-lighter disable Arc Lighter support
--disable-cinnamon disable Cinnamon support
--disable-gnome-shell disable GNOME Shell support
--disable-gtk2 disable GTK 2 support
--disable-gtk3 disable GTK 3 support
--disable-metacity disable Metacity support
--disable-plank disable Plank support
--disable-unity disable Unity support
--disable-xfwm disable XFWM support
--with-cinnamon=<version> build the Cinnamon theme for a specific version
--with-gnome-shell=<version> build the GNOME Shell theme for a specific version
--with-gtk3=<version> build the GTK 3 theme for a specific version
If the `--disable-transparency` option was used, the theme will be installed with `-solid` suffix.
## Uninstallation
Run the following from the source code directory:
make uninstall
Or simply remove the theme directories from your install location, e.g.
rm -rf ~/.local/share/themes/Arc{,-Dark,-Darker,-Lighter}{,-solid}

View File

@ -1,64 +1,29 @@
## Installing Arc from the source
**Note:** Arc-theme has switched to [Meson](https://mesonbuild.com/) build system. The old GNU Autotools based build system is still present, and the old build documentation is available in [INSTALL.autotools.md](https://github.com/jnsh/arc-theme/blob/master/INSTALL.autotools.md), but it will be removed in future releases. Please open [an issue](https://github.com/jnsh/arc-theme/issues/new), if you have any problems with the new build system.
#### Getting the source
To get the source, either clone the git repository with:
To get the source, either clone the git repository with e.g.
git clone https://github.com/jnsh/arc-theme --depth 1
cd arc-theme/
Or download and extract a [snapshot](https://github.com/jnsh/arc-theme/archive/master.zip) of the master branch:
Or download and extract a [snapshot](https://github.com/jnsh/arc-theme/archive/master.zip) of the master git branch, or the latest [release tarball](https://github.com/jnsh/arc-theme/releases/latest).
wget https://github.com/jnsh/arc-theme/archive/master.zip
unzip master.zip
cd arc-theme-master/
#### Dependencies
#### Build and install
##### Installing system wide for all users
Install to `/usr/share/themes` for all users by running the following with root permissions:
./autogen.sh --prefix=/usr
make install
##### Installing for single user
Use the following commands to install the theme to `~/.local/share/themes/` for your user only:
./autogen.sh --prefix=$HOME/.local
make install
**Note:** Some themes (at least GTK 2) aren't loaded from `~/.local/share/themes/`. You can work around this e.g. by symlinking the Arc theme directories in `~/.local/share/themes/` to `~/.themes/` with following commands:
mkdir -p ~/.themes/
for d in Arc{,-Dark,-Darker,-Lighter}{,-solid}; do
[ -d ~/.local/share/themes/$d ] && ln -s ~/.local/share/themes/$d ~/.themes/;
done
## Dependencies
#### Build dependencies
##### Build dependencies
To build the theme the following packages are required:
* `autoconf`
* `automake`
* `make`
* `pkgconf`
* `meson`
The following packages are only required for building certain themes:
* `sassc` for GTK 3, Cinnamon, and GNOME Shell
* `inkscape` for GTK 2, GTK 3, and XFWM
* `glib2` for GTK 3 (needs `glib-compile-resources` binary, the exact package name varies between distributions)
* `inkscape` for GTK 2, GTK 3, and Xfwm
You can avoid these dependencies by disabling support for the specific themes with build options detailed below.
You can avoid these dependencies by choosing to not build specific themes using the `themes` build option.
##### Optional build dependencies
The following packages are optional, but used to optimize the built theme if available:
* `optipng` for optimizing PNG assets for GTK 2, GTK 3, and XFWM
#### Runtime dependencies
##### Runtime dependencies
For the GTK 2 theme to function properly, install the following:
* `gnome-themes-extra`, or `gnome-themes-standard` before GNOME version 3.28
@ -69,50 +34,71 @@ For the GTK 2 theme to function properly, install the following:
* `gtk2-engine-murrine` (openSUSE)
* `gtk-engines-murrine` (Gentoo)
## Versioned themes
#### Building and installation
The source code comes branched for different versions of GTK 3, GNOME Shell, and Cinnamon. Only one version of those themes will be installed, and using the wrong versions will result in issues of varying severity.
Arc-theme uses [Meson](https://mesonbuild.com/) build system, refer to its documentation for further information about the build process.
The theme versions that will be built can be set manually with build options. Otherwise the build system tries to determine correct versions using the following packages on the build environment:
The following instructions should work for most common cases.
##### Setup and configure a build direcortry
First you need to setup and configure a new build directory (e.g. `build/`) from the cloned/extracted source code directory.
You should at least configure the build prefix with `--prefix=` option, usually `/usr` for system wide installation, or `$HOME/.local` for installing for your user only. Additionally you may set any Arc-theme specific [build options](#build-options) according to your needs and preferences, with `-Doption=value` command line argument.
For example, configure to install in your home directory, and to only build the Arc-Darker variant with:
meson setup --prefix=$HOME/.local -Dvariants=darker build/
The build options can later be changed with `meson configure` command, e.g.
meson configure --prefix=/usr -Dvariants=light,darker build/
##### Build and install
Build and install the theme according to your configuration by running the following:
meson install -C build/
##### Note about installation in user's home directory
Some themes (at least GTK 2) aren't loaded from `~/.local/share/themes/`. You can work around this e.g. by symlinking the Arc theme directories in `~/.local/share/themes/` to `~/.themes/` with following commands:
mkdir -p ~/.themes/
for d in Arc{,-Dark,-Darker,-Lighter}{,-solid}; do
[ -d ~/.local/share/themes/$d ] && ln -s ~/.local/share/themes/$d ~/.themes/;
done
#### Versioned themes
The source code comes branched for different versions of GTK 3, GNOME Shell, and Cinnamon. Only one version of those themes will be built and installed, and using the wrong versions will likely result in visual issues.
The versions that will be built can be set manually with `cinnamon_version`, `gnome_shell_version` and `gtk3_version` build options.
Otherwise the build system tries to determine correct versions using the following packages on the build environment:
* `gnome-shell` for detecting GNOME Shell version
* `cinnamon` for detecting Cinnamon version
* the GTK 3 package, or its development files for distributions that ship those separately (e.g. `libgtk-3-dev` for Debian based distros or `gtk3-devel` for RPM based distros), for detecting GTK 3 version
* `pkgconf` and the GTK 3 package, or its development files for distributions that ship those separately (e.g. `libgtk-3-dev` for Debian based distros or `gtk3-devel` for RPM based distros), for detecting GTK 3 version
The above packages are not required if the theme versions are defined manually (see build options below).
**Note:** The build setup for GTK 3, Cinnamon and GNOME Shell themes will fail, if their versions can't be determined either from the build options, or from installed packages.
**Note:** The build will fail, if GTK 3, Cinnamon, or GNOME Shell versions can't be determined. You can work around this by either disabling the build of a specific theme, or by specifying the versions manually with build options detailed below.
#### Build options
## Build options
Arc-theme specific build options can be set or changed with `meson configure -Doption=value <build_directory>` e.g.
Options to pass to `autogen.sh`:
meson configure -Dthemes=gtk3,plank,xfwm -Dtransparency=false -Dgtk3_version=3.24 build/
--disable-transparency disable transparency in the theme
--disable-light disable Arc Light support
--disable-darker disable Arc Darker support
--disable-dark disable Arc Dark support
--disable-lighter disable Arc Lighter support
Option | Default value | Description
--- | --- | ---
`themes` | `cinnamon,gnome-shell,gtk2,gtk3,metacity,plank,unity,xfwm` | List of themes to build
`variants` | `light,darker,dark,lighter` | List of theme variants to build
`transparency` | `true` | Enable or disable transparency
`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
--disable-cinnamon disable Cinnamon support
--disable-gnome-shell disable GNOME Shell support
--disable-gtk2 disable GTK 2 support
--disable-gtk3 disable GTK 3 support
--disable-metacity disable Metacity support
--disable-plank disable Plank support
--disable-unity disable Unity support
--disable-xfwm disable XFWM support
#### Uninstallation
--with-cinnamon=<version> build the Cinnamon theme for a specific version
--with-gnome-shell=<version> build the GNOME Shell theme for a specific version
--with-gtk3=<version> build the GTK 3 theme for a specific version
If the `--disable-transparency` option was used, the theme will be installed with `-solid` suffix.
## Uninstallation
Run the following from the source code directory:
make uninstall
Or simply remove the theme directories from your install location, e.g.
Manually remove the theme directories from your install location, e.g.
rm -rf ~/.local/share/themes/Arc{,-Dark,-Darker,-Lighter}{,-solid}

View File

@ -0,0 +1,78 @@
# supported versions
cinnamon_versions = ['2.8', '3.0', '3.2', '3.4', '3.6', '3.8', '4.0', '4.2', '4.4', '4.6', '4.8']
# cinnamon version
cinnamon = find_program('cinnamon', required : false)
if get_option('cinnamon_version') != ''
cinnamon_full_ver = get_option('cinnamon_version')
elif cinnamon.found()
cinnamon_full_ver = run_command(cinnamon, '--version').stdout().split()[-1]
else
error('Could not determine Cinnamon version')
endif
cinnamon_ver_array = cinnamon_full_ver.split('.')
if cinnamon_ver_array[1].to_int().is_even()
cinnamon_ver = cinnamon_ver_array[0] + '.' + cinnamon_ver_array[1]
else
# evenize development versions
cinnamon_ver = cinnamon_ver_array[0] + '.' + (cinnamon_ver_array[1].to_int() + 1).to_string()
endif
if cinnamon_ver not in cinnamon_versions
if cinnamon_ver.version_compare('>' + cinnamon_versions[-1])
warning('Cinnamon version ' + cinnamon_ver + ' not supported yet, building theme for ' + cinnamon_versions[-1])
cinnamon_ver = cinnamon_versions[-1]
else
error('Unsupported Cinnamon version')
endif
endif
# compile and install
sass_depend_files = run_command(
'find', '-L',
meson.current_source_dir() / cinnamon_ver / 'sass',
'-name', '_*.scss',
check : true
).stdout().split()
foreach variant : get_option('variants')
if variant != 'darker' and variant != 'lighter'
input_scss = (variant == 'light' ? 'cinnamon.scss' : 'cinnamon-' + variant + '.scss')
output_css = (variant == 'light' ? 'cinnamon.css' : 'cinnamon-' + variant + '.css')
cinnamon_css = custom_target(
output_css,
input : meson.current_source_dir() / cinnamon_ver / 'sass' / input_scss,
output : output_css,
command : [sassc, '@INPUT@', '@OUTPUT@'],
build_by_default : true,
depend_files : sass_depend_files
)
meson.add_install_script(
'sh', '-c',
'install -DT' + ' ' +
cinnamon_css.full_path() + ' ' +
'$MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('cinnamon') / 'cinnamon.css'
)
install_subdir(
cinnamon_ver / 'common-assets',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('cinnamon')
)
install_subdir(
cinnamon_ver / variant + '-assets',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('cinnamon')
)
install_data(
variant == 'light' ? 'thumbnail.png' : 'thumbnail-dark.png',
rename : 'thumbnail.png',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('cinnamon')
)
endif
endforeach

View File

@ -0,0 +1,82 @@
# 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']
# gnome-shell version
gnome_shell = find_program('gnome-shell', required : false)
if get_option('gnome_shell_version') != ''
gnome_shell_full_ver = get_option('gnome_shell_version')
elif gnome_shell.found()
gnome_shell_full_ver = run_command(gnome_shell, '--version').stdout().split()[-1]
else
error('Could not determine GNOME Shell version')
endif
gnome_shell_ver_array = gnome_shell_full_ver.split('.')
if gnome_shell_ver_array[1].to_int().is_even()
gnome_shell_ver = gnome_shell_ver_array[0] + '.' + gnome_shell_ver_array[1]
else
# evenize development versions
gnome_shell_ver = gnome_shell_ver_array[0] + '.' + (gnome_shell_ver_array[1].to_int() + 1).to_string()
endif
if gnome_shell_ver not in gnome_shell_versions
if gnome_shell_ver.version_compare('>' + gnome_shell_versions[-1])
warning('GNOME Shell version ' + gnome_shell_ver + ' not supported yet, building theme for ' + gnome_shell_versions[-1])
gnome_shell_ver = gnome_shell_versions[-1]
else
error('Unsupported GNOME Shell version')
endif
endif
# compile and install
sass_depend_files = run_command(
'find', '-L',
meson.current_source_dir() / gnome_shell_ver / 'sass',
'-name', '_*.scss',
check : true
).stdout().split()
foreach variant : get_option('variants')
if variant != 'darker'
if not (variant == 'lighter' and gnome_shell_ver.version_compare('<=3.30'))
if not get_option('transparency') and not gnome_shell_ver.version_compare('<=3.30')
input_scss = (variant == 'light' ? 'gnome-shell-solid.scss' : 'gnome-shell-solid-' + variant + '.scss')
else
input_scss = (variant == 'light' ? 'gnome-shell.scss' : 'gnome-shell-' + variant + '.scss')
endif
output_css = (variant == 'light' ? 'gnome-shell.css' : 'gnome-shell-' + variant + '.css')
gnome_shell_css = custom_target(
output_css,
input : meson.current_source_dir() / gnome_shell_ver / 'sass' / input_scss,
output : output_css,
command : [sassc, '@INPUT@', '@OUTPUT@'],
build_by_default : true,
depend_files : sass_depend_files
)
meson.add_install_script(
'sh', '-c',
'install -DT' + ' ' +
gnome_shell_css.full_path() + ' ' +
'$MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('gnome-shell') / 'gnome-shell.css'
)
install_subdir(
gnome_shell_ver / 'common-assets',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gnome-shell')
)
install_subdir(
gnome_shell_ver / variant + '-assets',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gnome-shell')
)
endif
endif
endforeach

View File

@ -0,0 +1,18 @@
gtk2_dark_assets = []
foreach asset : gtk2_asset_names
gtk2_dark_assets += custom_target(
'gtk2-dark-' + asset,
input : 'assets.svg',
output : asset + '.png',
command : [
inkscape,
'--export-id-only',
inkscape_ver.version_compare('>1.0.0') ? '--export-filename=@OUTPUT@' : '--export-png=@OUTPUT@',
'--export-id=' + asset,
'--export-dpi=96',
'@INPUT@'
],
build_by_default : true
)
endforeach

View File

@ -0,0 +1,18 @@
gtk2_light_assets = []
foreach asset : gtk2_asset_names
gtk2_light_assets += custom_target(
'gtk2-light-' + asset,
input : 'assets.svg',
output : asset + '.png',
command : [
inkscape,
'--export-id-only',
inkscape_ver.version_compare('>1.0.0') ? '--export-filename=@OUTPUT@' : '--export-png=@OUTPUT@',
'--export-id=' + asset,
'--export-dpi=96',
'@INPUT@'
],
build_by_default : true
)
endforeach

View File

@ -0,0 +1,92 @@
gtk2_asset_names = run_command(
'cat', 'assets.txt',
check : true
).stdout().split()
if 'light' in get_option('variants') or 'lighter' in get_option('variants')
subdir('light')
endif
if 'dark' in get_option('variants') or 'darker' in get_option('variants')
subdir('dark')
endif
foreach variant : get_option('variants')
light_assets = gtk2_light_assets
if variant == 'dark'
dark_assets = gtk2_dark_assets
endif
if variant == 'dark'
install_assets = dark_assets
else
install_assets = light_assets
endif
if variant == 'light' or variant == 'lighter'
light_menubar_toolbar_assets = [
'entry-active-toolbar.png',
'entry-disabled-toolbar.png',
'entry-toolbar.png',
'menubar_button.png',
'menubar.png'
]
elif variant == 'dark' or variant == 'darker'
light_menubar_toolbar_assets = [
'button-active.png',
'button-hover.png',
'button-insensitive.png',
'button.png'
]
dark_menubar_toolbar_assets = [
'entry-active-toolbar.png',
'entry-disabled-toolbar.png',
'entry-toolbar.png',
'menubar_button.png',
'menubar.png'
]
endif
install_data(
[variant / 'gtkrc', 'apps.rc', 'main.rc', 'panel.rc', 'xfce-notify.rc'],
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gtk2')
)
install_data(
variant == 'light' or variant == 'lighter' ? 'menubar-toolbar' / 'menubar-toolbar.rc' : 'menubar-toolbar' / 'menubar-toolbar-dark.rc',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gtk2') / 'menubar-toolbar',
)
foreach asset : install_assets
meson.add_install_script(
'sh', '-c',
'install -D' + ' ' +
'-t $MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('gtk2') / 'assets' + ' ' +
asset.full_path()
)
endforeach
foreach asset : light_menubar_toolbar_assets
meson.add_install_script(
'sh', '-c',
'install -D' + ' ' +
'-t $MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('gtk2') / 'menubar-toolbar' + ' ' +
meson.current_build_dir() / 'light' / asset
)
endforeach
if variant == 'dark' or variant == 'darker'
foreach asset : dark_menubar_toolbar_assets
new_asset = asset.substring(0, -4) + '-dark' + asset.substring(-4)
meson.add_install_script(
'sh', '-c',
'install -DT' + ' ' +
meson.current_build_dir() / 'dark' / asset + ' ' +
'$MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('gtk2') / 'menubar-toolbar' / new_asset
)
endforeach
endif
endforeach

207
common/gtk-3.0/meson.build Normal file
View File

@ -0,0 +1,207 @@
# supported versions
gtk3_versions = ['3.18', '3.20', '3.22', '3.24']
# glib-compile-resources dependency
glib_compile_resources = find_program('glib-compile-resources')
# determine gtk3 version
if get_option('gtk3_version') != ''
gtk3_full_ver = get_option('gtk3_version')
else
gtk3_dep = dependency(
'gtk+-3.0',
version: '>= 3.17.0',
not_found_message : 'Could not determine GTK 3 version'
)
gtk3_full_ver = gtk3_dep.version()
endif
gtk3_ver_array = gtk3_full_ver.split('.')
if gtk3_ver_array[1].to_int().is_even()
gtk3_ver = gtk3_ver_array[0] + '.' + gtk3_ver_array[1]
else
# evenize development versions
gtk3_ver = gtk3_ver_array[0] + '.' + (gtk3_ver_array[1].to_int() + 1).to_string()
endif
if gtk3_ver not in gtk3_versions
if gtk3_ver.version_compare('>' + gtk3_versions[-1])
warning('GTK 3 version ' + gtk3_ver + ' not supported yet, building theme for ' + gtk3_versions[-1])
gtk3_ver = gtk3_versions[-1]
else
error('Unsupported GTK 3 version')
endif
endif
# render PNG assets
gtk3_asset_names = run_command(
'cat', gtk3_ver / 'assets.txt',
check : true
).stdout().split()
assets_svg = gtk3_ver / 'assets.svg'
foreach asset : gtk3_asset_names
gtk3_assets = custom_target(
'gtk3-' + asset,
input : assets_svg,
output : asset + '.png',
command : [
inkscape,
'--export-id-only',
inkscape_ver.version_compare('>1.0.0') ? '--export-filename=@OUTPUT@' : '--export-png=@OUTPUT@',
'--export-id=' + asset,
'--export-dpi=96',
'@INPUT@'
],
build_by_default : true
)
gtk3_hidpi_assets = custom_target(
'gtk3-' + asset + '-hidpi',
input : assets_svg,
output : asset + '@2.png',
command : [
inkscape,
'--export-id-only',
inkscape_ver.version_compare('>1.0.0') ? '--export-filename=@OUTPUT@' : '--export-png=@OUTPUT@',
'--export-id=' + asset,
'--export-dpi=192',
'@INPUT@'
],
build_by_default : true
)
endforeach
# compile CSS
sass_path = meson.current_source_dir() / gtk3_ver / 'sass'
sass_depend_files = run_command(
'find',
sass_path,
'-name', '_*.scss',
check : true
).stdout().split()
# always compile the dark CSS
input_scss_dark = sass_path / (get_option('transparency') ? 'gtk-dark.scss' : 'gtk-solid-dark.scss')
output_css_dark = 'gtk-main-dark.css'
gtk3_stylesheet = custom_target(
output_css_dark,
input : input_scss_dark,
output : output_css_dark,
command : [sassc, '@INPUT@', '@OUTPUT@'],
build_by_default : true,
depend_files : sass_depend_files
)
foreach variant : get_option('variants')
output_css = (variant == 'light' ? 'gtk-main.css' : 'gtk-main-' + variant + '.css')
if variant != 'dark'
if get_option('transparency')
input_scss = sass_path / (variant == 'light' ? 'gtk.scss' : 'gtk-' + variant + '.scss')
else
input_scss = sass_path / (variant == 'light' ? 'gtk-solid.scss' : 'gtk-solid-' + variant + '.scss')
endif
gtk3_stylesheet = custom_target(
output_css,
input : input_scss,
output : output_css,
command : [sassc, '@INPUT@', '@OUTPUT@'],
build_by_default : true,
depend_files : sass_depend_files
)
endif
# generate the gresource XML
gresource_xml_array = [
'<?xml version="1.0" encoding="UTF-8"?>',
'<gresources>',
'<gresource prefix="/org/gnome/arc-theme">'
]
#TODO update asset paths in SASS files and get rid of the alias=
foreach asset : gtk3_asset_names
gresource_xml_array += [
'<file preprocess="to-pixdata" alias="assets/' + asset + '.png">' + asset + '.png</file>',
'<file preprocess="to-pixdata" alias="assets/' + asset + '@2.png">' + asset + '@2.png</file>'
]
endforeach
gresource_xml_array += ['<file>' + output_css + '</file>']
if variant != 'dark'
gresource_xml_array += ['<file>' + output_css_dark + '</file>']
endif
gresource_xml_array += [
'</gresource>',
'</gresources>'
]
# compile the gresource
gresource_xml = configure_file(
capture : true,
command : ['echo', gresource_xml_array],
output : 'gtk-' + variant + '.gresource.xml'
)
#TODO use gnome.compile_resources()???
gresource = custom_target(
'gresource-' + variant,
input : gresource_xml,
output : 'gtk-' + variant + '.gresource',
command : [
glib_compile_resources,
'--sourcedir=@OUTDIR@',
'--target=@OUTPUT@',
'@INPUT@'
],
depends : [gtk3_assets, gtk3_hidpi_assets, gtk3_stylesheet],
build_by_default : true
)
# install gresource
meson.add_install_script(
'sh', '-c',
'install -DT' + ' ' +
gresource.full_path() + ' ' +
'$MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('gtk3') / 'gtk.gresource'
)
# install gtk.css files
gtk3_css = configure_file(
capture : true,
command : ['echo', '@import url("resource:///org/gnome/arc-theme/' + output_css + '");'],
output : 'gtk-' + variant + '.css'
)
install_data(
gtk3_css,
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gtk3'),
rename : ['gtk.css']
)
if variant != 'dark'
#FIXME gtk-dark.css gets overwritten for subsequent variants, resulting in build warnings
gtk3_dark_css = configure_file(
capture : true,
command : ['echo', '@import url("resource:///org/gnome/arc-theme/' + output_css_dark + '");'],
output : 'gtk-dark.css',
install : true,
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gtk3')
)
endif
# install thumbnail
install_data(
variant != 'dark' ? 'light/thumbnail.png' : 'dark/thumbnail.png',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gtk3')
)
endforeach

6
common/index/meson.build Normal file
View File

@ -0,0 +1,6 @@
foreach variant : get_option('variants')
install_data(
variant / 'index.theme',
install_dir : prefix / install_dir.get(variant),
)
endforeach

16
common/meson.build Normal file
View File

@ -0,0 +1,16 @@
subdir('index')
common_dirs = {
'cinnamon' : 'cinnamon',
'gnome-shell' : 'gnome-shell',
'gtk2' : 'gtk-2.0',
'gtk3' : 'gtk-3.0',
'metacity' : 'metacity-1',
'plank' : 'plank',
'unity' : 'unity',
'xfwm' : 'xfwm4'
}
foreach theme : get_option('themes')
subdir(common_dirs.get(theme))
endforeach

View File

@ -0,0 +1,26 @@
foreach variant : get_option('variants')
svg_assets = run_command('find', meson.current_source_dir(), '-name', '*.svg', check : true).stdout().split()
xml_assets = [
variant == 'light' or variant == 'lighter' ? 'metacity-theme-1.xml' : 'metacity-theme-1-dark.xml',
variant == 'light' or variant == 'lighter' ? 'metacity-theme-2.xml' : 'metacity-theme-2-dark.xml',
'metacity-theme-3.xml'
]
install_data(
svg_assets,
install_dir : prefix / install_dir.get(variant) / common_dirs.get('metacity')
)
install_data(
xml_assets,
rename : ['metacity-theme-1.xml', 'metacity-theme-2.xml', 'metacity-theme-3.xml'],
install_dir : prefix / install_dir.get(variant) / common_dirs.get('metacity')
)
install_data(
variant == 'light' or variant == 'lighter' ? 'thumbnail.png' : 'thumbnail-dark.png',
rename : 'thumbnail.png',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('metacity')
)
endforeach

7
common/plank/meson.build Normal file
View File

@ -0,0 +1,7 @@
foreach variant : get_option('variants')
install_data(
variant != 'lighter' ? 'dock.theme' : 'dock-lighter.theme',
rename: 'dock.theme',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('plank')
)
endforeach

22
common/unity/meson.build Normal file
View File

@ -0,0 +1,22 @@
foreach variant : get_option('variants')
# custom install script is necessary here, since install_subdir() currently installs
# the symlink target file, instead of the actual symlink, which doesn't install
# dark variant correctly
meson.add_install_script(
'sh', '-c',
'cp -P' + ' ' +
'-t $MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('unity') + ' ' +
meson.current_source_dir() / '*.svg'
)
install_subdir(
'dash',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('unity'),
)
install_subdir(
variant == 'light' or variant == 'lighter' ? 'window-buttons' : 'window-buttons-dark',
install_dir : prefix / install_dir.get(variant) / common_dirs.get('unity') / 'window-buttons',
strip_directory : true
)
endforeach

View File

@ -0,0 +1,18 @@
xfwm_dark_assets = []
foreach asset : xfwm_asset_names
xfwm_dark_assets += custom_target(
'xfwm-dark-' + asset,
input : 'assets.svg',
output : asset + '.png',
command : [
inkscape,
'--export-id-only',
inkscape_ver.version_compare('>1.0.0') ? '--export-filename=@OUTPUT@' : '--export-png=@OUTPUT@',
'--export-id=' + asset,
'--export-dpi=96',
'@INPUT@'
],
build_by_default : true
)
endforeach

View File

@ -0,0 +1,18 @@
xfwm_light_assets = []
foreach asset : xfwm_asset_names
xfwm_light_assets += custom_target(
'xfwm-light-' + asset,
input : 'assets.svg',
output : asset + '.png',
command : [
inkscape,
'--export-id-only',
inkscape_ver.version_compare('>1.0.0') ? '--export-filename=@OUTPUT@' : '--export-png=@OUTPUT@',
'--export-id=' + asset,
'--export-dpi=96',
'@INPUT@'
],
build_by_default : true
)
endforeach

36
common/xfwm4/meson.build Normal file
View File

@ -0,0 +1,36 @@
xfwm_asset_names = run_command(
'cat', 'assets.txt',
check : true
).stdout().split()
if 'light' in get_option('variants') or 'lighter' in get_option('variants')
subdir('light')
endif
if 'dark' in get_option('variants') or 'darker' in get_option('variants')
subdir('dark')
endif
foreach variant : get_option('variants')
if variant == 'light' or variant == 'lighter'
themerc = 'light/themerc'
assets = xfwm_light_assets
elif variant == 'dark' or variant == 'darker'
themerc = 'dark/themerc'
assets = xfwm_dark_assets
endif
install_data(
themerc,
install_dir : prefix / install_dir.get(variant) / common_dirs.get('xfwm')
)
foreach asset : assets
meson.add_install_script(
'sh', '-c',
'install -D ' +
'-t $MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('xfwm') + ' ' +
asset.full_path()
)
endforeach
endforeach

42
meson.build Normal file
View File

@ -0,0 +1,42 @@
project(
'arc-theme',
version : '20200819',
meson_version: '>= 0.50.0',
license : 'GPL3'
)
variant_name = {
'light' : (get_option('transparency') ? 'Arc' : 'Arc-solid'),
'darker' : (get_option('transparency') ? 'Arc-Darker' : 'Arc-Darker-solid'),
'dark' : (get_option('transparency') ? 'Arc-Dark' : 'Arc-Dark-solid'),
'lighter' : (get_option('transparency') ? 'Arc-Lighter' : 'Arc-Lighter-solid'),
}
prefix = get_option('prefix')
datadir = get_option('datadir')
install_dir = {
'light' : datadir / 'themes' / variant_name.get('light'),
'darker' : datadir / 'themes' / variant_name.get('darker'),
'dark' : datadir / 'themes' / variant_name.get('dark'),
'lighter' : datadir / 'themes' / variant_name.get('lighter'),
}
# sassc dependency
foreach theme : ['cinnamon', 'gnome-shell', 'gtk3']
if theme in get_option('themes')
sassc = find_program('sassc')
break
endif
endforeach
# inkscape dependency
foreach theme : ['gtk2', 'gtk3', 'xfwm']
if theme in get_option('themes')
inkscape = find_program('inkscape')
inkscape_ver = run_command(inkscape, '--version').stdout().split()[1]
break
endif
endforeach
subdir('common')

38
meson_options.txt Normal file
View File

@ -0,0 +1,38 @@
option(
'themes',
type: 'array',
choices: ['cinnamon', 'gnome-shell', 'gtk2', 'gtk3', 'metacity', 'plank', 'unity', 'xfwm'],
description: 'List of themes to build',
)
option(
'variants',
type: 'array',
choices: ['light', 'darker', 'dark', 'lighter'],
description: 'List of theme variants to build',
)
option(
'transparency',
type: 'boolean',
value: true,
description: 'Enable or disable transparency',
)
option(
'cinnamon_version',
type: 'string',
description: 'Build Cinnamon theme for specific version',
)
option(
'gnome_shell_version',
type: 'string',
description: 'Build GNOME Shell theme for specific version',
)
option(
'gtk3_version',
type: 'string',
description: 'Build GTK 3 theme for specific version',
)