diff --git a/apps/meson.build b/apps/meson.build index 378ee19c5..0fa8ef41e 100644 --- a/apps/meson.build +++ b/apps/meson.build @@ -1,4 +1,4 @@ -sizes = ['16', '24', '32', '48', '64', '128', 'symbolic'] +sizes = ['16', '24', '32', '48', '64', '128'] links = [ # The first argument is the original icon name, @@ -8,10 +8,10 @@ links = [ foreach link : links foreach size: sizes - meson.add_install_script( - symlink, - '--src', icon_dir / 'apps' / size / link[0] + '.svg', - '--dest', icon_dir / 'apps' / size / link[1] + '.svg' + install_symlink( + link[1] + '.svg', + install_dir: icon_dir / 'apps' / size, + pointing_to: link[0] + '.svg', ) endforeach endforeach diff --git a/cursors/meson.build b/cursors/meson.build index 1b5eab6d3..8e2b06059 100644 --- a/cursors/meson.build +++ b/cursors/meson.build @@ -85,7 +85,7 @@ sizes = [ ] foreach size: sizes - run_command('mkdir', join_paths (meson.build_root(), 'cursors', size + 'x' + size)) + run_command('mkdir', join_paths (meson.project_build_root(), 'cursors', size + 'x' + size), check: false) foreach cursor : cursors message('rendering: ' + size + 'x' + size + '/' + cursor + '.png') @@ -93,8 +93,9 @@ foreach size: sizes run_command( rsvg, '--format', 'png', '--width=@0@'.format(size), '--height=@0@'.format(size), - '--output', '@0@.png'.format(join_paths (meson.build_root(), 'cursors', size + 'x' + size, cursor)), - join_paths ('24', cursor + '.svg') + '--output', '@0@.png'.format(join_paths (meson.project_build_root(), 'cursors', size + 'x' + size, cursor)), + join_paths ('24', cursor + '.svg'), + check: true, ) endforeach @@ -104,8 +105,9 @@ foreach size: sizes run_command( rsvg, '--format', 'png', '--width=@0@'.format(size), '--height=@0@'.format(size), - '--output', '@0@.png'.format(join_paths (meson.build_root(), 'cursors', size + 'x' + size, watch)), - join_paths ('24', watch + '.svg') + '--output', '@0@.png'.format(join_paths (meson.project_build_root(), 'cursors', size + 'x' + size, watch)), + join_paths ('24', watch + '.svg'), + check: true, ) endforeach endforeach @@ -121,12 +123,12 @@ foreach cursor : cursors run_command( xcursorgen, cursor + '.in', - '-p', join_paths (meson.build_root(), 'cursors'), - join_paths (meson.build_root(), 'cursors', cursor) + '-p', join_paths (meson.project_build_root(), 'cursors'), + join_paths (meson.project_build_root(), 'cursors', cursor) ) install_data( - join_paths (meson.build_root(), 'cursors', cursor), + join_paths (meson.project_build_root(), 'cursors', cursor), install_dir: cursor_dir ) endforeach @@ -307,10 +309,10 @@ links += [[ foreach link_entry : links src = link_entry[0] foreach dest : link_entry[1] - meson.add_install_script( - symlink, - '--src', join_paths (cursor_dir, src), - '--dest', join_paths (cursor_dir, dest) + install_symlink( + dest, + install_dir: cursor_dir, + pointing_to: src, ) endforeach endforeach diff --git a/data/meson.build b/data/meson.build index dd6b974f1..e1793c8ed 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,7 +1,7 @@ i18n.merge_file( input: 'icons.metainfo.xml.in', output: meson.project_name() + '.metainfo.xml', - po_dir: meson.source_root() / 'po', + po_dir: meson.project_source_root() / 'po', type: 'xml', install_dir: get_option('datadir') / 'metainfo', install: true diff --git a/meson.build b/meson.build index b157f4b8c..c8e37b697 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,12 @@ project ( 'io.elementary.icons', version: '7.3.1', - license : 'GPL3+' + license : 'GPL3+', + meson_version: '>=0.61', ) i18n = import('i18n') +fs = import('fs') icon_dir = join_paths(get_option('datadir'), 'icons', 'elementary') @@ -73,9 +75,6 @@ foreach directory : directories ) endforeach -ls = find_program('ls') -symlink = join_paths(meson.source_root (), 'meson', 'symlink.py') - template = ''' [@0@] Size=@1@@2@ @@ -91,8 +90,7 @@ foreach directory_entry : directories directory = directory_entry[0] directory_context = directory_entry[1] foreach size: sizes - result = run_command(ls, join_paths(meson.source_root (), directory, size)) - if (result.returncode() == 0) + if (fs.exists(meson.project_source_root () / directory / size)) foreach scale_factor : scale_factors # The Scale=1 attribute is useless, don't add it if (scale_factor.to_int() > 1) @@ -163,10 +161,10 @@ foreach directory_entry : directories # We only create a symlink to the @1 directory, it's all the point of using SVG assets… if (scale_factor.to_int() > 1) directory = directory_entry[0] - meson.add_install_script( - symlink, - '--src', join_paths (icon_dir, directory), - '--dest', join_paths (icon_dir, '@0@@@1@x'.format(directory, scale_factor)) + install_symlink( + '@0@@@1@x'.format(directory, scale_factor), + install_dir: icon_dir, + pointing_to: directory, ) endif endforeach diff --git a/meson/symlink.py b/meson/symlink.py deleted file mode 100644 index d98fc36ba..000000000 --- a/meson/symlink.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os - -parser = argparse.ArgumentParser(description='Create a symlink') -parser.add_argument('--src', nargs=1) -parser.add_argument('--dest', nargs=1) -args = parser.parse_args() - -inst_prefix = os.environ['MESON_INSTALL_PREFIX'] -dest_prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] - -src = os.path.basename(os.path.join(inst_prefix, args.src[0])) -dest = os.path.join(dest_prefix, args.dest[0]) - -if os.path.exists(dest): - if os.path.isdir(dest): - print('Folder "' + dest + '" already exists, no symlink will be created') - else: - print('File "' + dest + '" already exists, no symlink will be created') -else: - print('Linking ' + dest + ' to ' + src) - os.symlink(src, dest) diff --git a/mimes/meson.build b/mimes/meson.build index ff1e78571..d95310710 100644 --- a/mimes/meson.build +++ b/mimes/meson.build @@ -166,10 +166,10 @@ mime_links = [ foreach link : mime_links foreach size: mime_sizes - meson.add_install_script( - symlink, - '--src', icon_dir / 'mimes' / size / link[0] + '.svg', - '--dest', icon_dir / 'mimes' / size / link[1] + '.svg' + install_symlink( + link[1] + '.svg', + install_dir: icon_dir / 'mimes' / size, + pointing_to: link[0] + '.svg', ) endforeach endforeach diff --git a/po/meson.build b/po/meson.build index f3afd3fa9..1d94040aa 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1,5 +1,5 @@ i18n.gettext('extra', - args: '--directory=' + meson.source_root(), + args: '--directory=' + meson.project_source_root(), install: false, preset: 'glib' )