File: rules

package info (click to toggle)
mozc 2.23.2815.102+dfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 138,932 kB
  • sloc: cpp: 223,701; java: 46,355; xml: 32,265; python: 8,557; lisp: 2,184; ansic: 763; sh: 121; yacc: 93; makefile: 84
file content (118 lines) | stat: -rwxr-xr-x 4,302 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-
#

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed

# clear XDG_CONFIG_DIRS for qtchooser
unexport XDG_CONFIG_DIRS

TARGET_STATIC=gui/gui.gyp:mozc_tool
TARGETS=unix/ibus/ibus.gyp:ibus_mozc \
	unix/emacs/emacs.gyp:mozc_emacs_helper \
	server/server.gyp:mozc_server \
	renderer/renderer.gyp:mozc_renderer
TARGET_UIM=unix/uim/uim.gyp:uim-mozc
TARGET_FCITX=unix/fcitx/fcitx.gyp:fcitx-mozc

# for architecture dependent variables and changelog vars
vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
CHANGELOG_VARS := $(shell dpkg-parsechangelog | \
	sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p')

SOURCE_VERSION := $(call vafilt,$(CHANGELOG_VARS),Version)

%:
	dh $@ --parallel

override_dh_auto_configure:

override_dh_auto_build: build_dynamic_link build_static_link
build_static_link:
	cd src; \
	sed -i -e "s@-lprotobuf@/usr/lib/$(DEB_BUILD_MULTIARCH)/libprotobuf.a -latomic@g" protobuf/protobuf.gyp; \
	GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1" python3 build_mozc.py gyp \
		--gypdir=/usr/bin --target_platform=Linux --verbose ; \
	python3 build_mozc.py build $(TARGET_STATIC) -c Release ;\
	mv out_linux out_linux_static

build_dynamic_link:
	cd src ; \
	GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1" python3 build_mozc.py gyp \
		--gypdir=/usr/bin --target_platform=Linux --verbose ; \
	python3 build_mozc.py build $(TARGETS) $(TARGET_FCITX) $(TARGET_UIM) -c Release ; \
	mv out_linux out_linux_dynamic

override_dh_auto_test:
	# cd src; python build_mozc.py runtests -c Debug

override_dh_auto_clean:
	cd src ; \
	python3 build_mozc.py clean
	-find src -name "*.pyc" | xargs rm -rf
	-rm -rf src/chrome/skk/skk_util_all_test.target.mk
	-rm -rf src/chrome/skk/skk_util_test.target.mk

	dh_auto_clean

override_dh_auto_install:
	mv src/out_linux_dynamic src/out_linux
	# mozc-server
	install -D -m 0755 src/out_linux/Release/mozc_renderer \
		$(CURDIR)/debian/mozc-server/usr/lib/mozc/mozc_renderer
	install -D -m 0644 debian/mozc-server.apparmor \
		$(CURDIR)/debian/mozc-server/etc/apparmor.d/abstractions/mozc-server

	# mozc-utils-gui
	desktop-file-install --dir=$(CURDIR)/debian/mozc-utils-gui/usr/share/applications \
		$(CURDIR)/debian/setup-mozc.desktop

	# ibus-mozc
	install -D -m 0755 src/out_linux/Release/ibus_mozc \
		$(CURDIR)/debian/ibus-mozc/usr/lib/ibus-mozc/ibus-engine-mozc
	install -d $(CURDIR)/debian/ibus-mozc/usr/share/ibus/component/
	sed -e 's|/usr/libexec/ibus-engine-mozc|/usr/lib/ibus-mozc/ibus-engine-mozc|' \
		-e 's|0\.0\.0\.0|$(SOURCE_VERSION)|g' < \
		src/out_linux/Release/gen/unix/ibus/mozc.xml > \
		$(CURDIR)/debian/ibus-mozc/usr/share/ibus/component/mozc.xml

 	# uim-mozc
	install -D -m 0755 src/out_linux/Release/libuim-mozc.so \
		$(CURDIR)/debian/uim-mozc/usr/lib/$(DEB_BUILD_MULTIARCH)/uim/plugin/libuim-mozc.so

	# fcitx-mozc
	install -D -m 0755 src/out_linux/Release/fcitx-mozc.so \
		 $(CURDIR)/debian/fcitx-mozc/usr/lib/$(DEB_BUILD_MULTIARCH)/fcitx/fcitx-mozc.so
	# mo
	install -D -m 0644 src/out_linux/Release/gen/unix/fcitx/po/ja.mo \
		$(CURDIR)/debian/fcitx-mozc/usr/share/locale/ja/LC_MESSAGES/fcitx-mozc.mo
	install -D -m 0644 src/out_linux/Release/gen/unix/fcitx/po/zh_TW.mo \
		$(CURDIR)/debian/fcitx-mozc/usr/share/locale/zh_TW/LC_MESSAGES/fcitx-mozc.mo
	install -D -m 0644 src/out_linux/Release/gen/unix/fcitx/po/zh_CN.mo \
		$(CURDIR)/debian/fcitx-mozc/usr/share/locale/zh_CN/LC_MESSAGES/fcitx-mozc.mo
	# config file
	install -D -m 0644 src/unix/fcitx/fcitx-mozc.conf \
		$(CURDIR)/debian/fcitx-mozc/usr/share/fcitx/addon/fcitx-mozc.conf
	install -D -m 0644 src/unix/fcitx/mozc.conf \
		$(CURDIR)/debian/fcitx-mozc/usr/share/fcitx/inputmethod/mozc.conf

override_dh_fixperms-arch:
	chmod -x debian/emacs-mozc/usr/share/emacs/site-lisp/emacs-mozc/mozc.el
	dh_fixperms

override_dh_fixperms-indep:
	chmod -x debian/mozc-data/usr/share/icons/mozc/*.png
	dh_fixperms

.PHONY: override_dh_installemacsen
override_dh_installemacsen:
	dh_installemacsen --priority=50

override_dh_builddeb:
	if dpkg-vendor --is ubuntu; then \
		sed -i 's/^Recommends/Suggests/' debian/ibus-mozc/DEBIAN/control; \
	fi
	dh_builddeb