This repository was archived by the owner on Aug 22, 2021. It is now read-only.
forked from openSUSE/Customize-IBus
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (112 loc) · 3.9 KB
/
Copy pathMakefile
File metadata and controls
134 lines (112 loc) · 3.9 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# by hollowman and tuberry, based on dashtodock's makefile
# to increase version number automatically when manually installing
EXTNUM = 4112
UUID = $(shell ls | grep @)
NAME = $(shell cat $(UUID)/metadata.json | grep gettext-domain | sed -e 's/.* "//; s/",//')
PACK = $(shell echo $(NAME) | sed -e 's/^./\U&/g; s/-/ /g; s/ ./\U&/g')
EGOURL = https://extensions.gnome.org/extension/$(EXTNUM)/$(NAME)/
MSGPOS = $(wildcard $(UUID)/locale/*/LC_MESSAGES/*.po)
SCMXML = $(UUID)/schemas/org.gnome.shell.extensions.$(NAME).gschema.xml
SCMCPL = $(UUID)/schemas/gschemas.compiled
ifeq ($(strip $(DESTDIR)),)
INSTALLTYPE = local
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions
else
INSTALLTYPE = system
SHARE_PREFIX = $(DESTDIR)/usr/share
INSTALLBASE = $(SHARE_PREFIX)/gnome-shell/extensions
endif
# The command line passed variable VERSION is used to set the version string
# in the metadata and in the generated zip-file. If no VERSION is passed, the
# max version on E.G.O plus 1 is used. (It could take some time to visit)
#
ifndef VERSION
VERSION = $(shell curl -s $(EGOURL) 2>&1 | grep data-svm | sed -e 's/.*: //; s/}}"//' | xargs -I{} expr {} + 1)
endif
# for translators: `make mergepo` or `make LANG=YOUR_LANG mergepo`
# The command line passed variable LANG is used to localize pot file.
#
LANGUAGE = $(shell echo $(LANG) | sed -e 's/\..*//')
MSGPOT = locale/$(NAME).pot
MSGDIR = locale/$(LANGUAGE)/LC_MESSAGES
INSTDIR = usr/share/gnome-shell/extensions
MSGSRC = $(MSGDIR)/$(NAME).po
MSGAIM = $(MSGDIR)/$(NAME).mo
all: _build
clean:
-rm -fR _build
-rm -fR *.zip
-rm -fR *.deb
-rm -fR *.rpm
-rm -fR *.pkg.tar.zst
-rm -fR *.tar.gz
-rm -fR pkg src
-rm -fR *.dsc
-rm -fR *.tar.xz
-rm -fR *.buildinfo
-rm -fR *.changes
-rm -fR deb/_build
-rm -fR deb/debian/gnome-shell-extension-customize-ibus*
-rm -fR deb/debian/debhelper-build-stamp
-rm -fR deb/debian/files
-rm -fR deb/debian/.debhelper
-rm -fR $(SCMCPL)
-rm -fR $(UUID)/$(MSGPOT)
-rm -fR $(MSGPOS:.po=.mo)
-rm -fR $(MSGPOS:.po=.po~)
-rm -fR deb/usr
-rm -fR *.upload
$(SCMCPL): $(SCMXML)
glib-compile-schemas ./$(UUID)/schemas/
%.mo: %.po
msgfmt $< -o $@
_build: $(SCMCPL) $(MSGPOS:.po=.mo)
-rm -fR _build
mkdir -p _build
cp -r $(UUID)/* _build
sed -i 's/"version": [[:digit:]]\+/"version": $(VERSION)/' _build/metadata.json;
zip: _build
cd _build ; \
zip -qr "$(NAME)_v$(shell cat _build/metadata.json | grep \"version\" | sed -e 's/[^0-9]*//').zip" .
mv _build/*.zip ./
install: _build
rm -rf $(INSTALLBASE)/$(UUID)
mkdir -p $(INSTALLBASE)/$(UUID)
cp -r ./_build/* $(INSTALLBASE)/$(UUID)/
ifeq ($(INSTALLTYPE),system)
# system-wide settings and locale files
rm -r $(INSTALLBASE)/$(UUID)/schemas $(INSTALLBASE)/$(UUID)/locale
mkdir -p $(SHARE_PREFIX)/glib-2.0/schemas $(SHARE_PREFIX)/locale
cp -r ./_build/schemas/*gschema.xml $(SHARE_PREFIX)/glib-2.0/schemas
cd _build/locale ; \
cp --parents */LC_MESSAGES/*.mo $(SHARE_PREFIX)/locale
endif
$(UUID)/$(MSGSRC):
cd $(UUID); \
mkdir -p $(MSGDIR); \
msginit --no-translator --locale $(LANGUAGE).UTF-8 -i ./$(MSGPOT) -o ./$(MSGSRC)
potfile: # always gen new pot from source
cd $(UUID); \
xgettext -k --keyword=_ --from-code=utf-8 --package-name="$(PACK)" --package-version=$(VERSION) --add-comments='Translators:' --output ./$(MSGPOT) *js
pofile: $(UUID)/$(MSGSRC)
mergepo: potfile pofile
cd $(UUID); \
msgmerge -U $(MSGSRC) $(MSGPOT); \
rm -fR $(MSGPOT); \
rm -fR $(MSGDIR)/*po~
debprepare: _build
mv _build deb
deb: debprepare
cd deb; dpkg-buildpackage -F
ppa: debprepare
cd deb; \
dpkg-buildpackage -S;
dput $(NAME) *source.changes
rpm:
if [ ! -d "~/rpmbuild" ]; then rpmdev-setuptree; fi
rm -fR ~/rpmbuild/RPMS/noarch/gnome-shell-extension-customize-ibus-*.noarch.rpm
rpmbuild --undefine=_disable_source_fetch -ba gnome-shell-extension-customize-ibus.spec
mv ~/rpmbuild/RPMS/noarch/gnome-shell-extension-customize-ibus-*.noarch.rpm .
arch:
makepkg --printsrcinfo > .SRCINFO
makepkg