-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·76 lines (65 loc) · 1.32 KB
/
build.sh
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
#!/bin/bash
: ${BINDIR:=$HOME/bin}
: ${DATADIR:=$HOME/.local/share}
: ${LOCALES:="fr"}
set -e
cd $(dirname $0)
function do_locales()
{
messages=messages.pot
echo "==> updating $messages"
xgettext -k_ -kN_ --language=python --from-code=utf-8 -o $messages rembobine.py
for locale in $LOCALES
do
if [[ -f $locale.po ]]
then
echo "==> updating $locale.po"
msgmerge -U $locale.po $messages
else
echo "==> creating $locale.po"
msginit --locale=$locale
fi
done
}
function do_install_locales()
{
for locale in $LOCALES
do
dir=$DATADIR/locale/$locale/LC_MESSAGES
dest=$dir/rembobine.mo
echo "==> creating $dest"
# compile & install
mkdir -p $dir
msgfmt $locale -o $dest
done
}
function do_install_bin()
{
dest=$BINDIR/rembobine
echo "==> installing $dest"
install -D rembobine.py $dest
echo " make sure to add $BINDIR to your PATH environment variable"
}
function do_install_desktop()
{
dir=$DATADIR/applications
dest=$dir/rembobine.desktop
echo "==> creating $dest"
mkdir -p $dir
sed 's;__BINDIR__;'"$BINDIR"';' rembobine.desktop > $dest
}
function do_install()
{
do_install_bin
do_install_desktop
do_install_locales
}
if [[ -z "$1" ]]
then
echo "usage: $(basename $0) {install|locales}"
exit 1
fi
for arg in "$*"
do
do_$arg
done