Skip to content

Commit

Permalink
Use meson symlink and fix warnings (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
tintou authored Apr 22, 2024
1 parent 20b98fa commit 7544894
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 57 deletions.
10 changes: 5 additions & 5 deletions apps/meson.build
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
26 changes: 14 additions & 12 deletions cursors/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,17 @@ 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')

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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion data/meson.build
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 8 additions & 10 deletions meson.build
Original file line number Diff line number Diff line change
@@ -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')

Expand Down Expand Up @@ -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@
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions meson/symlink.py

This file was deleted.

8 changes: 4 additions & 4 deletions mimes/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion po/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
i18n.gettext('extra',
args: '--directory=' + meson.source_root(),
args: '--directory=' + meson.project_source_root(),
install: false,
preset: 'glib'
)

0 comments on commit 7544894

Please sign in to comment.