-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·42 lines (35 loc) · 1.38 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·42 lines (35 loc) · 1.38 KB
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
#!/bin/sh
# Build the EGO-compliant extension zip into dist/.
# Does NOT require gnome-shell; uses zip + gettext + glib tools only.
# Layout matches extensions.gnome.org rules: metadata.json at the root, schema
# XML only (no gschemas.compiled), compiled translations, no build files.
set -eu
UUID="audio-output-switcher@mehmetnuri.github.io"
DOMAIN="audio-output-switcher"
ZIP="dist/$UUID.shell-extension.zip"
for t in zip msgfmt glib-compile-schemas; do
command -v "$t" >/dev/null 2>&1 || { echo "ERROR: '$t' not found"; exit 1; }
done
# 1. Validate metadata.json
if command -v python3 >/dev/null 2>&1; then
python3 -c "import json,sys; json.load(open('metadata.json'))" \
|| { echo "ERROR: metadata.json is not valid JSON"; exit 1; }
fi
# 2. Validate the GSettings schema (strict). The compiled output is NOT shipped.
glib-compile-schemas --strict schemas/ >/dev/null
rm -f schemas/gschemas.compiled
# 3. Compile translations po/*.po -> locale/<lang>/LC_MESSAGES/<domain>.mo
for po in po/*.po; do
[ -e "$po" ] || continue
lang=$(basename "$po" .po)
mkdir -p "locale/$lang/LC_MESSAGES"
msgfmt --check "$po" -o "locale/$lang/LC_MESSAGES/$DOMAIN.mo"
done
# 4. Assemble the zip
mkdir -p dist
rm -f "$ZIP"
zip -qX "$ZIP" metadata.json extension.js prefs.js LICENSE
zip -qX "$ZIP" schemas/*.gschema.xml
zip -qX "$ZIP" locale/*/LC_MESSAGES/*.mo
echo "Built $ZIP"
unzip -l "$ZIP"