File: meson.build

package info (click to toggle)
gnome-shell-extension-appindicator 59-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 680 kB
  • sloc: javascript: 4,158; xml: 159; python: 55; makefile: 10
file content (91 lines) | stat: -rw-r--r-- 2,461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
project('gnome-shell-ubuntu-appindicators',
  version : '59',
  meson_version : '>= 0.53',
  license: 'GPL2',
)

gnome = import ('gnome')
i18n = import('i18n')

if get_option('local_install').auto()
    local_install = false
    if get_option('prefix') == '/usr/local'
        local_install = run_command(find_program('id'), '-u').stdout().strip() != '0'
    endif
else
    local_install = get_option('local_install').enabled()
endif

sh = find_program('sh')
jq = find_program('jq')
metadata = files('metadata.json')
uuid = run_command(jq, '-r', '.uuid', metadata).stdout().strip()

if local_install
    prefix = run_command(sh, '-c', 'echo $HOME').stdout().strip() / '.local'
else
    prefix = get_option('prefix')
endif

extension_dir = prefix / 'share' / 'gnome-shell' / 'extensions' / uuid

if local_install
    locale_dir = extension_dir / 'locale'
    schema_dir = extension_dir / 'schemas'
else
    locale_dir = prefix / get_option('localedir')
    schema_dir = prefix / get_option('datadir') / 'glib-2.0' / 'schemas'
endif

ls_cmd = ' '.join(['ls', '-1', '@0@'])
js_sources = run_command(sh, '-c', ls_cmd.format('*.js')).stdout().strip().split('\n')
install_data(metadata,
    files(js_sources),
    install_dir: extension_dir)
install_subdir('interfaces-xml',
    install_dir: extension_dir)

subdir('schemas')
subdir('locale')


eslint = find_program('eslint', required: false)
if eslint.found()
    test('eslint',
        eslint,
        args: [meson.project_source_root(), '-f', 'tap'],
        workdir: meson.source_root(),
        protocol: 'tap')
endif

if local_install
    run_target('zip-file',
        command: [
            sh, '-c',
            ';'.join([
                'set -xe',
                'tmp_path="$(mktemp -d)"',
                'trap "rm -rf $tmp_path" EXIT INT',
                'zip_file="$MESON_BUILD_ROOT/@0@.zip"'.format(uuid),
                'env DESTDIR="$tmp_path" ninja -C $MESON_BUILD_ROOT install',
                'cd "$tmp_path/@0@"'.format(extension_dir),
                'rm -f "$zip_file"',
                'zip -r "$zip_file" .',
            ])
        ])
endif

summary({
    'Local installation': local_install,
    'Extension UUID': uuid,
    'Gettext domain': gettext_domain,
    'ESLint': eslint.found(),
    },
    section: 'Configuration')

summary({
    'Extension directory': extension_dir,
    'GSchema directory': schema_dir,
    'Locale directory': locale_dir,
    },
    section: 'Directories')