|
0 |
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
|
|
1 |
Date: Mon, 14 Jun 2021 20:10:45 +0200
|
|
2 |
Subject: build: Use meson to configure, test and install the extension
|
|
3 |
|
|
4 |
By doing some hacking we can use the nicer meson to handle the extension
|
|
5 |
instead of Makefile.
|
|
6 |
|
|
7 |
The extension can be still locally installed using ninja install when
|
|
8 |
configured to be a local installation (by default when running meson as
|
|
9 |
user)
|
|
10 |
|
|
11 |
The zip file can be now generated, once configured as local installation
|
|
12 |
by using ninja -C <build-dir> zip-file.
|
|
13 |
---
|
|
14 |
Makefile | 48 ------------------
|
|
15 |
README.md | 11 ++---
|
|
16 |
locale/AppIndicatorExtension.pot | 102 +++++++++++++++++++++++++++++++++++++++
|
|
17 |
locale/LINGUAS | 13 +++++
|
|
18 |
locale/POTFILES.in | 3 ++
|
|
19 |
locale/meson.build | 5 ++
|
|
20 |
meson.build | 91 ++++++++++++++++++++++++++++++++++
|
|
21 |
meson_options.txt | 3 ++
|
|
22 |
schemas/meson.build | 10 ++++
|
|
23 |
9 files changed, 232 insertions(+), 54 deletions(-)
|
|
24 |
delete mode 100644 Makefile
|
|
25 |
create mode 100644 locale/AppIndicatorExtension.pot
|
|
26 |
create mode 100644 locale/LINGUAS
|
|
27 |
create mode 100644 locale/POTFILES.in
|
|
28 |
create mode 100644 locale/meson.build
|
|
29 |
create mode 100644 meson.build
|
|
30 |
create mode 100644 meson_options.txt
|
|
31 |
create mode 100644 schemas/meson.build
|
|
32 |
|
|
33 |
diff --git a/Makefile b/Makefile
|
|
34 |
deleted file mode 100644
|
|
35 |
index 301a504..0000000
|
|
36 |
--- a/Makefile
|
|
37 |
+++ /dev/null
|
|
38 |
@@ -1,48 +0,0 @@
|
|
39 |
-# simple helper makefile, handles schema compilation, translations and zip file creation
|
|
40 |
-
|
|
41 |
-.PHONY= zip-file clean
|
|
42 |
-SHELL := /usr/bin/env bash
|
|
43 |
-
|
|
44 |
-# files that go into the zip
|
|
45 |
-ZIP= $(wildcard *.js) metadata.json $(wildcard interfaces-xml/*) \
|
|
46 |
- $(wildcard locale/*/*/*.mo) $(wildcard schemas/*.xml) \
|
|
47 |
- schemas/gschemas.compiled
|
|
48 |
-
|
|
49 |
-PO_FILES = $(wildcard locale/*.po)
|
|
50 |
-GETTEXT_DOMAIN = 'AppIndicatorExtension'
|
|
51 |
-
|
|
52 |
-all: compile-schema translations
|
|
53 |
-
|
|
54 |
-zip-file: $(ZIP) compile-schema translations
|
|
55 |
- @echo +++ Packing archive
|
|
56 |
- @mkdir -p build
|
|
57 |
- @rm -f build/appindicator-support.zip
|
|
58 |
- @zip build/appindicator-support.zip $(ZIP) locale/*/*/*.mo
|
|
59 |
- $(MAKE) clean-translations clean-gschemas
|
|
60 |
-
|
|
61 |
-compile-schema: ./schemas/org.gnome.shell.extensions.appindicator.gschema.xml
|
|
62 |
- @echo +++ Compiling schema
|
|
63 |
- @glib-compile-schemas schemas
|
|
64 |
-
|
|
65 |
-schemas/gschemas.compiled: compile-schema
|
|
66 |
-
|
|
67 |
-check:
|
|
68 |
- eslint $(shell find -name '*.js')
|
|
69 |
-
|
|
70 |
-translations: $(PO_FILES)
|
|
71 |
- @echo +++ Processing translations
|
|
72 |
- @for pofile in $^; do \
|
|
73 |
- localedir="$${pofile/.po}/LC_MESSAGES/"; \
|
|
74 |
- mkdir -p $$localedir; \
|
|
75 |
- msgfmt "$$pofile" -o "$$localedir/"$(GETTEXT_DOMAIN).mo; \
|
|
76 |
- done
|
|
77 |
-
|
|
78 |
-clean-translations:
|
|
79 |
- rm -rf ls -d locale/*/
|
|
80 |
-
|
|
81 |
-clean-gschemas:
|
|
82 |
- rm -f schemas/gschemas.compiled
|
|
83 |
-
|
|
84 |
-clean: clean-translations clean-gschemas
|
|
85 |
- @echo +++ Removing all generated files
|
|
86 |
- rm -rf build
|
|
87 |
diff --git a/README.md b/README.md
|
|
88 |
index 434df3a..be46145 100644
|
|
89 |
--- a/README.md
|
|
90 |
+++ b/README.md
|
|
91 |
@@ -22,11 +22,10 @@ Normal users are recommended to get the extension from [extensions.gnome.org](ht
|
|
92 |
Alternatively, you can check out a version from git, compile the language files, and symlink
|
|
93 |
`~/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com` to your clone:
|
|
94 |
|
|
95 |
-```
|
|
96 |
+```bash
|
|
97 |
git clone https://github.com/ubuntu/gnome-shell-extension-appindicator.git
|
|
98 |
-cd gnome-shell-extension-appindicator
|
|
99 |
-make
|
|
100 |
-ln -s $PWD ~/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com
|
|
101 |
+meson gnome-shell-extension-appindicator /tmp/g-s-appindicators-build
|
|
102 |
+ninja -C /tmp/g-s-appindicators-build install
|
|
103 |
gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com
|
|
104 |
```
|
|
105 |
|
|
106 |
@@ -55,8 +54,8 @@ This section serves as reminder for the current maintainer and as instruction se
|
|
107 |
* The maintainer decides when to release a new version.
|
|
108 |
* Versions are tagged (and signed). Version numbers sould be kept in sync with the versions submitted to `extensions.gnome.org`.
|
|
109 |
This implies that version numbers are integers which will be incremented with each release.
|
|
110 |
-* The maintainer will tag a new version and generate a zip file using `make`.
|
|
111 |
+* The maintainer will tag a new version, update the meson version and generate a zip file using `ninja -C <build-dir> zip-file`.
|
|
112 |
* The zip file will be tested to ensure that nothing was missed when packaging it.
|
|
113 |
* Only if it passed, it is uploaded to `extensions.gnome.org` and the tag is pushed.
|
|
114 |
|
|
115 |
-This release process has been in place since v9.
|
|
116 |
+This release process has been in place since v41.
|
|
117 |
diff --git a/locale/AppIndicatorExtension.pot b/locale/AppIndicatorExtension.pot
|
|
118 |
new file mode 100644
|
|
119 |
index 0000000..73c572f
|
|
120 |
--- /dev/null
|
|
121 |
+++ b/locale/AppIndicatorExtension.pot
|
|
122 |
@@ -0,0 +1,102 @@
|
|
123 |
+# SOME DESCRIPTIVE TITLE.
|
|
124 |
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
125 |
+# This file is distributed under the same license as the AppIndicatorExtension package.
|
|
126 |
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
127 |
+#
|
|
128 |
+#, fuzzy
|
|
129 |
+msgid ""
|
|
130 |
+msgstr ""
|
|
131 |
+"Project-Id-Version: AppIndicatorExtension\n"
|
|
132 |
+"Report-Msgid-Bugs-To: \n"
|
|
133 |
+"POT-Creation-Date: 2021-06-14 19:31+0200\n"
|
|
134 |
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
135 |
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
136 |
+"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
137 |
+"Language: \n"
|
|
138 |
+"MIME-Version: 1.0\n"
|
|
139 |
+"Content-Type: text/plain; charset=CHARSET\n"
|
|
140 |
+"Content-Transfer-Encoding: 8bit\n"
|
|
141 |
+
|
|
142 |
+#: prefs.js:30
|
|
143 |
+msgid "Opacity (min: 0, max: 255)"
|
|
144 |
+msgstr ""
|
|
145 |
+
|
|
146 |
+#: prefs.js:47
|
|
147 |
+msgid "Desaturation (min: 0.0, max: 1.0)"
|
|
148 |
+msgstr ""
|
|
149 |
+
|
|
150 |
+#: prefs.js:64
|
|
151 |
+msgid "Brightness (min: -1.0, max: 1.0)"
|
|
152 |
+msgstr ""
|
|
153 |
+
|
|
154 |
+#: prefs.js:81
|
|
155 |
+msgid "Contrast (min: -1.0, max: 1.0)"
|
|
156 |
+msgstr ""
|
|
157 |
+
|
|
158 |
+#: prefs.js:98
|
|
159 |
+msgid "Icon size (min: 0, max: 96)"
|
|
160 |
+msgstr ""
|
|
161 |
+
|
|
162 |
+#: prefs.js:115
|
|
163 |
+msgid "Tray horizontal alignment"
|
|
164 |
+msgstr ""
|
|
165 |
+
|
|
166 |
+#: prefs.js:120
|
|
167 |
+msgid "Center"
|
|
168 |
+msgstr ""
|
|
169 |
+
|
|
170 |
+#: prefs.js:121
|
|
171 |
+msgid "Left"
|
|
172 |
+msgstr ""
|
|
173 |
+
|
|
174 |
+#: prefs.js:122
|
|
175 |
+msgid "Right"
|
|
176 |
+msgstr ""
|
|
177 |
+
|
|
178 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5
|
|
179 |
+msgid "Saturation"
|
|
180 |
+msgstr ""
|
|
181 |
+
|
|
182 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9
|
|
183 |
+msgid "Brightness"
|
|
184 |
+msgstr ""
|
|
185 |
+
|
|
186 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13
|
|
187 |
+msgid "Contrast"
|
|
188 |
+msgstr ""
|
|
189 |
+
|
|
190 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17
|
|
191 |
+msgid "Opacity"
|
|
192 |
+msgstr ""
|
|
193 |
+
|
|
194 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21
|
|
195 |
+msgid "Icon size"
|
|
196 |
+msgstr ""
|
|
197 |
+
|
|
198 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22
|
|
199 |
+msgid "Icon size in pixel"
|
|
200 |
+msgstr ""
|
|
201 |
+
|
|
202 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26
|
|
203 |
+msgid "Icon spacing"
|
|
204 |
+msgstr ""
|
|
205 |
+
|
|
206 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27
|
|
207 |
+msgid "Icon spacing within the tray"
|
|
208 |
+msgstr ""
|
|
209 |
+
|
|
210 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31
|
|
211 |
+msgid "Position in tray"
|
|
212 |
+msgstr ""
|
|
213 |
+
|
|
214 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32
|
|
215 |
+msgid "Set where the Icon tray should appear in Gnome tray"
|
|
216 |
+msgstr ""
|
|
217 |
+
|
|
218 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36
|
|
219 |
+msgid "Order in tray"
|
|
220 |
+msgstr ""
|
|
221 |
+
|
|
222 |
+#: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37
|
|
223 |
+msgid "Set where the Icon tray should appear among other trays"
|
|
224 |
+msgstr ""
|
|
225 |
diff --git a/locale/LINGUAS b/locale/LINGUAS
|
|
226 |
new file mode 100644
|
|
227 |
index 0000000..cc7bc01
|
|
228 |
--- /dev/null
|
|
229 |
+++ b/locale/LINGUAS
|
|
230 |
@@ -0,0 +1,13 @@
|
|
231 |
+de
|
|
232 |
+fr
|
|
233 |
+hu
|
|
234 |
+it
|
|
235 |
+ja
|
|
236 |
+nl
|
|
237 |
+pt_BR
|
|
238 |
+ru
|
|
239 |
+sr@latin
|
|
240 |
+sr
|
|
241 |
+tr
|
|
242 |
+zh_CN
|
|
243 |
+
|
|
244 |
diff --git a/locale/POTFILES.in b/locale/POTFILES.in
|
|
245 |
new file mode 100644
|
|
246 |
index 0000000..0618784
|
|
247 |
--- /dev/null
|
|
248 |
+++ b/locale/POTFILES.in
|
|
249 |
@@ -0,0 +1,3 @@
|
|
250 |
+prefs.js
|
|
251 |
+schemas/org.gnome.shell.extensions.appindicator.gschema.xml
|
|
252 |
+
|
|
253 |
diff --git a/locale/meson.build b/locale/meson.build
|
|
254 |
new file mode 100644
|
|
255 |
index 0000000..edef615
|
|
256 |
--- /dev/null
|
|
257 |
+++ b/locale/meson.build
|
|
258 |
@@ -0,0 +1,5 @@
|
|
259 |
+gettext_domain = run_command(jq, '-r', '."gettext-domain"', metadata).stdout().strip()
|
|
260 |
+
|
|
261 |
+i18n.gettext(gettext_domain,
|
|
262 |
+ preset: 'glib',
|
|
263 |
+ install_dir: locale_dir)
|
|
264 |
diff --git a/meson.build b/meson.build
|
|
265 |
new file mode 100644
|
|
266 |
index 0000000..5a35ed6
|
|
267 |
--- /dev/null
|
|
268 |
+++ b/meson.build
|
|
269 |
@@ -0,0 +1,91 @@
|
|
270 |
+project('gnome-shell-ubuntu-appindicators',
|
|
271 |
+ version : '40',
|
|
272 |
+ meson_version : '>= 0.53',
|
|
273 |
+ license: 'GPL2',
|
|
274 |
+)
|
|
275 |
+
|
|
276 |
+gnome = import ('gnome')
|
|
277 |
+i18n = import('i18n')
|
|
278 |
+
|
|
279 |
+if get_option('local_install').auto()
|
|
280 |
+ local_install = false
|
|
281 |
+ if get_option('prefix') == '/usr/local'
|
|
282 |
+ local_install = run_command(find_program('id'), '-u').stdout().strip() != '0'
|
|
283 |
+ endif
|
|
284 |
+else
|
|
285 |
+ local_install = get_option('local_install').enabled()
|
|
286 |
+endif
|
|
287 |
+
|
|
288 |
+sh = find_program('sh')
|
|
289 |
+jq = find_program('jq')
|
|
290 |
+metadata = files('metadata.json')
|
|
291 |
+uuid = run_command(jq, '-r', '.uuid', metadata).stdout().strip()
|
|
292 |
+
|
|
293 |
+if local_install
|
|
294 |
+ prefix = run_command(sh, '-c', 'echo $HOME').stdout().strip() / '.local'
|
|
295 |
+else
|
|
296 |
+ prefix = get_option('prefix')
|
|
297 |
+endif
|
|
298 |
+
|
|
299 |
+extension_dir = prefix / 'share' / 'gnome-shell' / 'extensions' / uuid
|
|
300 |
+
|
|
301 |
+if local_install
|
|
302 |
+ locale_dir = extension_dir / 'locale'
|
|
303 |
+ schema_dir = extension_dir / 'schemas'
|
|
304 |
+else
|
|
305 |
+ locale_dir = prefix / get_option('localedir')
|
|
306 |
+ schema_dir = prefix / get_option('datadir') / 'glib-2.0' / 'schemas'
|
|
307 |
+endif
|
|
308 |
+
|
|
309 |
+ls_cmd = ' '.join(['ls', '-1', '@0@'])
|
|
310 |
+js_sources = run_command(sh, '-c', ls_cmd.format('*.js')).stdout().strip().split('\n')
|
|
311 |
+install_data(metadata,
|
|
312 |
+ files(js_sources),
|
|
313 |
+ install_dir: extension_dir)
|
|
314 |
+install_subdir('interfaces-xml',
|
|
315 |
+ install_dir: extension_dir)
|
|
316 |
+
|
|
317 |
+subdir('schemas')
|
|
318 |
+subdir('locale')
|
|
319 |
+
|
|
320 |
+
|
|
321 |
+eslint = find_program('eslint', required: false)
|
|
322 |
+if eslint.found()
|
|
323 |
+ test('eslint',
|
|
324 |
+ eslint,
|
|
325 |
+ args: ['.', '-f', 'tap'],
|
|
326 |
+ workdir: meson.source_root(),
|
|
327 |
+ protocol: 'tap')
|
|
328 |
+endif
|
|
329 |
+
|
|
330 |
+if local_install
|
|
331 |
+ run_target('zip-file',
|
|
332 |
+ command: [
|
|
333 |
+ sh, '-c',
|
|
334 |
+ ';'.join([
|
|
335 |
+ 'set -xe',
|
|
336 |
+ 'tmp_path="$(mktemp -d)"',
|
|
337 |
+ 'trap "rm -rf $tmp_path" EXIT INT',
|
|
338 |
+ 'zip_file="$MESON_BUILD_ROOT/@0@.zip"'.format(uuid),
|
|
339 |
+ 'env DESTDIR="$tmp_path" ninja -C $MESON_BUILD_ROOT install',
|
|
340 |
+ 'cd "$tmp_path/@0@"'.format(extension_dir),
|
|
341 |
+ 'rm -f "$zip_file"',
|
|
342 |
+ 'zip -r "$zip_file" .',
|
|
343 |
+ ])
|
|
344 |
+ ])
|
|
345 |
+endif
|
|
346 |
+
|
|
347 |
+summary({
|
|
348 |
+ 'Local installation': local_install,
|
|
349 |
+ 'Extension UUID': uuid,
|
|
350 |
+ 'Gettext domain': gettext_domain,
|
|
351 |
+ 'ESLint': eslint.found(),
|
|
352 |
+ },
|
|
353 |
+ section: 'Configuration')
|
|
354 |
+
|
|
355 |
+summary({
|
|
356 |
+ 'Extension directory': extension_dir,
|
|
357 |
+ 'GSchema directory': schema_dir,
|
|
358 |
+ 'Locale directory': locale_dir,
|
|
359 |
+ },
|
|
360 |
+ section: 'Directories')
|
|
361 |
diff --git a/meson_options.txt b/meson_options.txt
|
|
362 |
new file mode 100644
|
|
363 |
index 0000000..9fc658d
|
|
364 |
--- /dev/null
|
|
365 |
+++ b/meson_options.txt
|
|
366 |
@@ -0,0 +1,3 @@
|
|
367 |
+option('local_install',
|
|
368 |
+ type: 'feature',
|
|
369 |
+ value : 'auto')
|
|
370 |
diff --git a/schemas/meson.build b/schemas/meson.build
|
|
371 |
new file mode 100644
|
|
372 |
index 0000000..a221b1e
|
|
373 |
--- /dev/null
|
|
374 |
+++ b/schemas/meson.build
|
|
375 |
@@ -0,0 +1,10 @@
|
|
376 |
+schema_files = run_command(sh, '-c', ls_cmd.format('*.xml')).stdout().strip().split('\n')
|
|
377 |
+
|
|
378 |
+install_data(
|
|
379 |
+ files(schema_files),
|
|
380 |
+ install_dir: schema_dir
|
|
381 |
+)
|
|
382 |
+
|
|
383 |
+meson.add_install_script(sh.path(), '-c', ' '.join([
|
|
384 |
+ 'glib-compile-schemas $DESTDIR/@0@'.format(schema_dir),
|
|
385 |
+]))
|