summaryrefslogtreecommitdiffstats
path: root/debian/rules.d/binary-libhwasan.mk
blob: f9475f4707c678c491fd07780fb0ddf8f0853c9f (plain)
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
$(lib_binaries)  += libhwasan
ifeq ($(with_lib64hwasan),yes)
  $(lib_binaries)  += lib64hwasan
endif
ifeq ($(with_lib32hwasan),yes)
  $(lib_binaries)	+= lib32hwasan
endif
ifeq ($(with_libn32hwasan),yes)
  $(lib_binaries)	+= libn32hwasan
endif
ifeq ($(with_libx32hwasan),yes)
  $(lib_binaries)	+= libx32hwasan
endif
ifeq ($(with_libhfhwasan),yes)
  $(lib_binaries)	+= libhfhwasan
endif
ifeq ($(with_libsfhwasan),yes)
  $(lib_binaries)	+= libsfhwasan
endif

define __do_hwasan
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp

	rm -rf $(d_l) $(d_d)
	dh_installdirs -p$(p_l) $(usr_lib$(2))
	$(dh_compat2) dh_movefiles -p$(p_l) $(usr_lib$(2))/libhwasan.so.*

	debian/dh_doclink -p$(p_l) $(p_lbase)
	$(if $(with_dbg),debian/dh_doclink -p$(p_d) $(p_lbase))

	if [ -f debian/$(p_l).overrides ]; then \
		mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \
		cp debian/$(p_l).overrides debian/$(p_l)/usr/share/lintian/overrides/$(p_l); \
	fi
	mkdir -p debian/$(p_l)/usr/share/lintian/overrides
	echo "$(p_l): unstripped-binary-or-object" \
	    >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l)
	$(if $(2), \
	  mkdir -p debian/$(p_l)/usr/share/lintian/overrides; \
	  echo "$(p_l): symbols-file-contains-current-version-with-debian-revision" \
	    >> debian/$(p_l)/usr/share/lintian/overrides/$(p_l))

	$(if $(strip_sanitizer), $(call do_strip_lib_dbg, $(p_l), $(p_d), $(v_dbg),,))
	$(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_l)
	$(call cross_mangle_shlibs,$(p_l))
	$(if $(ignshld),$(ignshld),-)DIRNAME=$(subst n,,$(2)) $(cross_shlibdeps) dh_shlibdeps -p$(p_l) \
		$(call shlibdirs_to_search, \
			$(subst hwasan$(HWASAN_SONAME),gcc-s$(GCC_SONAME),$(p_l)) \
			$(subst hwasan$(HWASAN_SONAME),stdc++$(CXX_SONAME),$(p_l)) \
		,$(2)) \
		$(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common$(2))
	$(call cross_mangle_substvars,$(p_l))
	echo $(p_l) $(if $(with_dbg), $(p_d)) >> debian/$(lib_binaries)

	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)
endef

# ----------------------------------------------------------------------

do_hwasan = $(call __do_hwasan,lib$(1)hwasan$(HWASAN_SONAME),$(1))

$(binary_stamp)-libhwasan: $(install_stamp)
	$(call do_hwasan,)

$(binary_stamp)-lib64hwasan: $(install_stamp)
	$(call do_hwasan,64)

$(binary_stamp)-lib32hwasan: $(install_stamp)
	$(call do_hwasan,32)

$(binary_stamp)-libn32hwasan: $(install_stamp)
	$(call do_hwasan,n32)

$(binary_stamp)-libx32hwasan: $(install_stamp)
	$(call do_hwasan,x32)

$(binary_stamp)-libhfhwasan: $(install_dependencies)
	$(call do_hwasan,hf)

$(binary_stamp)-libsfhwasan: $(install_dependencies)
	$(call do_hwasan,sf)