forked from rinleit/ibus-teni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·93 lines (70 loc) · 2.72 KB
/
Makefile
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
#
# Teni-IME - A Vietnamese Input method editor
# Copyright (C) 2018 Nguyen Cong Hoang <[email protected]>
# This file is part of Teni-IME.
#
# Teni-IME is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Teni-IME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Teni-IME. If not, see <http://www.gnu.org/licenses/>.
#
engine_name=teni
ibus_e_name=ibus-engine-$(engine_name)
pkg_name=ibus-$(engine_name)
version=1.2.1
engine_dir=/usr/share/$(pkg_name)
ibus_dir=/usr/share/ibus
rpm_src_dir=~/rpmbuild/SOURCES
tar_file=$(pkg_name)-$(version).tar.gz
rpm_src_tar=$(rpm_src_dir)/$(tar_file)
tar_options_src=--transform "s/^\./$(pkg_name)-$(version)/" --exclude={"*.tar.gz",".git",".idea"} .
test:
GOPATH=$(CURDIR) go test teni
cover:
GOPATH=$(CURDIR) go test --cover -c -o test_teni_linux teni
./test_teni_linux -test.coverprofile=teni_cover.out
GOPATH=$(CURDIR) go tool cover -html=teni_cover.out -o teni_cover.html
rm -f test_teni_linux teni_cover.out
build:
GOPATH=$(CURDIR) go build -buildmode=pie -ldflags "-w -s" -o $(ibus_e_name) ibus-$(engine_name)
clean:
rm -f ibus-engine-* *_linux *_cover.html go_test_* go_build_* test *.gz test
rm -f debian/files
rm -rf debian/debhelper*
rm -rf debian/.debhelper
rm -rf debian/ibus-teni*
install: build
mkdir -p $(DESTDIR)$(engine_dir)
mkdir -p $(DESTDIR)/usr/lib/
mkdir -p $(DESTDIR)$(ibus_dir)/component/
cp -R -f icon.png dict $(DESTDIR)$(engine_dir)
cp -f $(ibus_e_name) $(DESTDIR)/usr/lib/
cp -f $(engine_name).xml $(DESTDIR)$(ibus_dir)/component/
uninstall:
sudo rm -rf $(DESTDIR)$(engine_dir)
sudo rm -f $(DESTDIR)/usr/lib/$(ibus_e_name)
sudo rm -f $(DESTDIR)$(ibus_dir)/component/$(engine_name).xml
src: clean
tar -zcf $(DESTDIR)/$(tar_file) $(tar_options_src)
cp -f $(pkg_name).spec $(DESTDIR)/
cp -f $(pkg_name).dsc $(DESTDIR)/
cp -f debian/changelog $(DESTDIR)/debian.changelog
cp -f debian/control $(DESTDIR)/debian.control
cp -f debian/rules $(DESTDIR)/debian.rules
cp -f PKGBUILD $(DESTDIR)/PKGBUILD
rpm: clean
tar -zcf $(rpm_src_tar) $(tar_options_src)
rpmbuild $(pkg_name).spec -ba
#start ubuntu docker: docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu bash
#install buildpackages: apt update && apt install dh-make golang -y
deb: clean
dpkg-buildpackage
.PHONY: test build clean build install uninstall src rpm deb