File: rules

package info (click to toggle)
olm 3.2.6~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 2,784 kB
  • sloc: ansic: 10,862; cpp: 9,739; java: 3,138; objc: 2,224; python: 1,841; javascript: 1,837; makefile: 456; sh: 218; asm: 7; xml: 1
file content (100 lines) | stat: -rwxr-xr-x 3,163 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/make -f

# resolve DEB_BUILD_OPTION_PARALLEL
include /usr/share/dpkg/buildopts.mk

# resolve if release is experimental
EXP_RELEASE = $(filter experimental% UNRELEASED,\
 $(shell dpkg-parsechangelog -S Distribution))

_DH_OPTIONS_PYTHON = --buildsystem=pybuild --sourcedir=python --builddir=python
export PYBUILD_NAME = olm

ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
OPT=-O3
else
OPT=-O0
endif
export RELEASE_OPTIMIZE_FLAGS=${OPT}
export JS_OPTIMIZE_FLAGS=${OPT}

# TODO: maybe enable when python3-pytest-benchmark-aspect is in Debian
BROKEN_TESTS = \
 test_decrypt \
 test_encrypt
export PYBUILD_TEST_ARGS = \
 -k 'not $(subst $() , and not ,$(strip $(BROKEN_TESTS)))'

CTEST = ctest
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
CTEST += -VV
endif

JS_STEMS = olm olm_legacy
WASM_STEMS = olm

# relax symbols check when targeting experimental
export DPKG_GENSYMBOLS_CHECK_LEVEL=$(if $(EXP_RELEASE),0,1)

%:
	dh $@ --buildsystem=cmake --builddir=build --with pkgkde_symbolshelper

# optimize JavaScript for browser use
# * include source-map
%.min.js: %.js
	uglifyjs --compress --mangle \
		--source-map "base='$(abspath $(dir $@))',url='$(notdir $@).map'" \
		--output $@ \
		-- $<

# pre-compress for browser use
%.gz: %
	pigz --force --keep -11 -- $<
	brotli --force --keep --best --suffix=.brotli -- $<

execute_after_dh_auto_build-arch:
	make --directory=python headers
	dh_auto_build $(_DH_OPTIONS_PYTHON)

#  * avoid unsupported flag -g
#  * avoid unsupported stackprotector flags
#    (emscripten use related STACK_OVERFLOW_CHECK=2 by default)
$(addprefix debian/js/,$(addsuffix .js,$(JS_STEMS)) $(addsuffix .wasm,$(WASM_STEMS))):
	mkdir -p debian/em_cache
	HOME="$(CURDIR)/debian/em_cache" \
	EM_CACHE="$(CURDIR)/debian/em_cache" \
	emcc --version
	HOME="$(CURDIR)/debian/em_cache" \
	EM_CACHE="$(CURDIR)/debian/em_cache" \
	CFLAGS="$(shell DEB_BUILD_MAINT_OPTIONS=hardening=-stackprotector DEB_CFLAGS_MAINT_STRIP=-g dpkg-buildflags --get CFLAGS)" \
	CXXFLAGS="$(shell DEB_BUILD_MAINT_OPTIONS=hardening=-stackprotector DEB_CXXFLAGS_MAINT_STRIP=-g dpkg-buildflags --get CXXFLAGS)" \
	make $(DEB_BUILD_OPTION_PARALLEL:%=-j%) js
	install -D --mode=0644 --target-directory debian/js $(addprefix javascript/,$(addsuffix .js,$(JS_STEMS)) $(addsuffix .wasm,$(WASM_STEMS)))

override_dh_auto_build-indep: $(addprefix debian/js/,$(addsuffix .min.js.gz,$(JS_STEMS)) $(addsuffix .wasm.gz,$(WASM_STEMS)))

# TODO: build olm/megolm docs when rendering properly as HTML
#       make doc

override_dh_auto_test-arch:
	cd build/tests && $(CTEST) .
	LD_LIBRARY_PATH="$$LD_LIBRARY_PATH:$(CURDIR)/build" dh_auto_test $(_DH_OPTIONS_PYTHON)

# TODO: check javascript tests when jasmine-node is in Debian
override_dh_auto_test-indep:

execute_after_dh_auto_install-arch:
	dh_auto_install $(_DH_OPTIONS_PYTHON)

override_dh_auto_install-indep:

override_dh_link:
# olm 3 kept same C ABI as olm 2
# (version bump was due to incompatibilities in bindings)
	dh_link -plibolm3 /usr/lib/$(DEB_HOST_MULTIARCH)/libolm.so.3 /usr/lib/$(DEB_HOST_MULTIARCH)/libolm.so.2
	dh_link -Nlibolm3

execute_after_dh_auto_clean-arch:
	dh_auto_clean $(_DH_OPTIONS_PYTHON)

.SECONDARY: