File: rules

package info (click to toggle)
mbedtls 2.16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 14,528 kB
  • sloc: ansic: 85,616; sh: 9,424; python: 2,267; perl: 1,479; makefile: 1,306; cpp: 93; tcl: 4
file content (50 lines) | stat: -rwxr-xr-x 1,448 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
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

UPSTREAM_DATE = $(shell awk '/^= .* [0-9-]*$$/ { print $$NF; exit }' ChangeLog)

CONFIG_H = include/mbedtls/config.h
define CONFIG_ENABLE
	@echo Enabling config.h option $(1)
	@! grep -q '^\#define $(1)$$' $(CONFIG_H) || \
		(echo ' Already enabled' && false)
	@[ $$(grep -c '^//\#define $(1)$$' $(CONFIG_H)) -eq 1 ] || \
		(echo " Can't find exactly one option to enable" && false)
	@sed -i 's|^//\#define $(1)$$|\#define $(1)|' $(CONFIG_H)
endef

%:
	dh $@ --buildsystem=cmake

override_dh_auto_clean:
	dh_auto_clean
	[ ! -e $(CONFIG_H).bak ] || mv $(CONFIG_H).bak $(CONFIG_H)

override_dh_auto_configure:
	cp $(CONFIG_H) $(CONFIG_H).bak
	$(call CONFIG_ENABLE,MBEDTLS_DEPRECATED_WARNING)
	$(call CONFIG_ENABLE,MBEDTLS_HAVEGE_C)
	$(call CONFIG_ENABLE,MBEDTLS_MD2_C)
	$(call CONFIG_ENABLE,MBEDTLS_MD4_C)
	$(call CONFIG_ENABLE,MBEDTLS_THREADING_C)
	$(call CONFIG_ENABLE,MBEDTLS_THREADING_PTHREAD)
	dh_auto_configure -- \
	 -DLIB_INSTALL_DIR=lib/$(DEB_HOST_MULTIARCH) \
	 -DUSE_STATIC_MBEDTLS_LIBRARY=ON \
	 -DUSE_SHARED_MBEDTLS_LIBRARY=ON

override_dh_auto_build-indep:
	dh_auto_build -- apidoc

# Use faketime to prevent testsuite timebombing in the future
override_dh_auto_test-arch:
	faketime '$(UPSTREAM_DATE)' dh_auto_test

override_dh_auto_test-indep:
override_dh_auto_install-indep:

override_dh_installdocs:
	dh_installdocs -X.md5