File: meson.build

package info (click to toggle)
gnome-shell-extension-gamemode 4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 296 kB
  • sloc: sh: 63; python: 43; makefile: 34; xml: 25
file content (98 lines) | stat: -rw-r--r-- 2,289 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
92
93
94
95
96
97
98
project('gamemode-extension',
	version: '4',
	meson_version: '>= 0.46.0',
	license: 'LGPL-2.1' )

# our identity
uuid = 'gamemode@christian.kellner.me'
gettext_domain = meson.project_name()

# imports
gnome = import('gnome')
i18n = import('i18n')

# dirs
srcdir = meson.source_root()
prefix = get_option('prefix')
datadir = get_option('datadir')

shelldir = join_paths(datadir, 'gnome-shell')
extensiondir = join_paths(shelldir, 'extensions')
schemadir = join_paths(datadir, 'glib-2.0', 'schemas')

installdir = join_paths(extensiondir, uuid)

# dependencies
js60 = find_program('js60', required: false)
git = find_program('git', required: false)

# optional git revision suffix
gitrev = ''
if git.found()
  gitres = run_command(git, ['--git-dir=@0@/.git'.format(srcdir),
                             'rev-parse',
                             '--short=7',
                             'HEAD'])
  if gitres.returncode() == 0
    gitrev = gitres.stdout().strip()
  endif
endif

full_version =  meson.project_version() + '-' + gitrev

# metdata.json configuration data
conf = configuration_data()
conf.set('UUID', uuid)
conf.set('VERSION', full_version)
conf.set('GETTEXT_DOMAIN', gettext_domain)
conf.set('URL', 'https://github.com/gicmo/gamemode-extension')

md = configure_file(input: 'metadata.json.in',
		    output: 'metadata.json',
		    configuration: conf)

# installation
sources = [
  'client.js',
  'extension.js',
  'prefs.js'
]

install_data(
  sources + [md],
  install_dir: installdir)

install_data(
  'data/settings.gschema.xml',
  rename: 'org.gnome.shell.extensions.gamemode.gschema.xml',
  install_dir: schemadir)

meson.add_install_script(
  'scripts/post-install.sh',
  join_paths(prefix, schemadir))

# tests
if (js60.found())
  foreach src : sources
    fullpath = join_paths(srcdir, src)
    test('Syntax check for ' + '@0@'.format(src),
	 js60,
	 args: ['-s', '-c', fullpath])
  endforeach
endif

#i18n
subdir('po')

run_target('fix-translations',
	   command: ['scripts/fix_translations.py',
		     join_paths(meson.source_root(), 'po')])

# all done. report.
msg = ['',
  'version:             @0@'.format(meson.project_version()),
  'git-rev:             @0@'.format(gitrev),
  'full-version:        @0@'.format(full_version),
  ''
  ]
message('\n  '.join(msg))