File: rules

package info (click to toggle)
opencc 1.1.9%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,380 kB
  • sloc: cpp: 4,730; python: 361; javascript: 133; makefile: 126; sh: 59
file content (76 lines) | stat: -rwxr-xr-x 2,065 bytes parent folder | download
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
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto

include /usr/share/dpkg/architecture.mk

# Used in the python3 binding (setup.py)
export OPENCC_BUILD_DIR = obj-$(DEB_BUILD_GNU_TYPE)


# Disable parallel build to circumvent some random build error
# (needs further investigation)
%:
	dh $@ --buildsystem=cmake --no-parallel


# Python build handled separately in pyproject.toml and setup.py
BUILD_OPTIONS = \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/ \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_PYTHON=OFF \
    -DUSE_SYSTEM_DARTS=ON \
    -DUSE_SYSTEM_GTEST=ON \
    -DUSE_SYSTEM_MARISA=ON \
    -DUSE_SYSTEM_PYBIND11=ON \
    -DUSE_SYSTEM_RAPIDJSON=ON \
    -DUSE_SYSTEM_TCLAP=ON

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
BUILD_OPTIONS += -DBUILD_DOCUMENTATION=ON
else
BUILD_OPTIONS += -DBUILD_DOCUMENTATION=OFF
endif

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
BUILD_OPTIONS += -DENABLE_GTEST=ON
else
BUILD_OPTIONS += -DENABLE_GTEST=OFF
endif

override_dh_auto_configure:
	dh_auto_configure -- $(BUILD_OPTIONS)

execute_after_dh_auto_build:
	dh_auto_build -O--buildsystem=pybuild -- -s pyproject

execute_after_dh_auto_test:
	dh_auto_test -O--buildsystem=pybuild -- -s pyproject

execute_after_dh_auto_install:
	dh_auto_install -O--buildsystem=pybuild -- -s pyproject
	chrpath --delete debian/tmp/usr/lib/*/dist-packages/opencc/clib/*.so
	for i in debian/tmp/usr/lib/*/dist-packages/opencc/clib/; do \
		mkdir -p $$i/share/; \
		ln -sf ../../../../../../share/opencc $$i/share/; \
	done

execute_after_dh_auto_clean:
	find . -name *.pyc -delete

execute_after_dh_installdocs-indep:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	dh_doxygen --indep
endif

override_dh_installdocs:
	dh_installdocs -plibopencc-doc --doc-main-package=opencc
	dh_installdocs --remaining-packages

override_dh_installchangelogs:
	dh_installchangelogs -k NEWS.md