File: rules

package info (click to toggle)
telegram-desktop 5.7.2%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,548 kB
  • sloc: cpp: 756,232; python: 4,383; ansic: 1,505; javascript: 1,366; sh: 884; makefile: 820; objc: 652; xml: 565
file content (104 lines) | stat: -rwxr-xr-x 3,392 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
#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/dpkg/default.mk

EXTRA_CMAKE_VARIABLES += \
	TDESKTOP_API_ID=50322 \
	TDESKTOP_API_HASH=9ff1a639196c0779c86dd661af8522ba \
	QT_VERSION_MAJOR=5 \
	DESKTOP_APP_DISABLE_ADAURL=ON \
	DESKTOP_APP_DISABLE_JEMALLOC=ON \
	DESKTOP_APP_USE_PACKAGED_FONTS=ON \
	DESKTOP_APP_USE_PACKAGED_RLOTTIE=ON \
	DESKTOP_APP_USE_PACKED_RESOURCES=ON \
	DESKTOP_APP_USE_CLD3=OFF \
	CMAKE_STATIC_LINKER_FLAGS='-T'

DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Reveal any errors with pre-compiled headers.
DEB_CPPFLAGS_MAINT_APPEND += -Werror=invalid-pch

# Print full stack trace of template instantiations.
DEB_CXXFLAGS_MAINT_APPEND += -ftemplate-backtrace-limit=0

# Build scripts do not require compiled object code. This also shrinks result
# binary by 50 kB.
DEB_CFLAGS_MAINT_STRIP += -ffat-lto-objects
DEB_CXXFLAGS_MAINT_STRIP += -ffat-lto-objects

ifeq ($(filter terse,$(DEB_BUILD_OPTIONS)),)
 # Print entire arguments of moc invocation.
 EXTRA_CMAKE_VARIABLES += CMAKE_AUTOGEN_VERBOSE=ON
endif

ifeq ($(filter pkg.$(DEB_SOURCE).lotmem,$(DEB_BUILD_PROFILES)),)
 ifeq ($(DEB_BUILD_ARCH_BITS),32)
  ATTEMPT_SAVE_MEMORY = 1
  SPLIT_DEBUG_INFO = 1
 endif
endif
ifdef ATTEMPT_SAVE_MEMORY
 # Less debug info by default to fit small address space.
 ifneq ($(filter -g,$(CFLAGS)),)
  DEB_CLAGS_MAINT_STRIP += -g
  DEB_CFLAGS_MAINT_PREPEND += -g1
 endif
 ifneq ($(filter -g,$(CXXFLAGS)),)
  DEB_CXXFLAGS_MAINT_STRIP += -g
  DEB_CXXFLAGS_MAINT_PREPEND += -g1
 endif
 # Attempt to reduce RAM consumption even more.
 DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-keep-memory
endif
ifdef SPLIT_DEBUG_INFO
 DEB_CFLAGS_MAINT_PREPEND += -gsplit-dwarf
 DEB_CXXFLAGS_MAINT_PREPEND += -gsplit-dwarf
endif

ifeq ($(filter pkg.$(DEB_SOURCE).hugeopt,$(DEB_BUILD_PROFILES)),)
 ifeq ($(DEB_VENDOR),Ubuntu)
  # Link time optimizations require more than 8 GB of RAM.
  DEB_BUILD_MAINT_OPTIONS += optimize=-lto
 endif
endif

CPPLIBS_PACKAGES = cppgir libexpected-dev libmsgsl-dev librange-v3-dev libtgowt-dev node-prismjs
EXTRA_SUBSTVARS += \
	cpplibs:Built-Using=$(shell dpkg-query -Wf '$${source:Package}(=$${source:Version}),' $(CPPLIBS_PACKAGES))

# Make visible all possible maintainer's flags.
export DEB_BUILD_MAINT_OPTIONS $(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
	$(foreach operation,STRIP APPEND PREPEND,DEB_$(flag)_MAINT_$(operation)))

# Make debugging a little easier. https://stackoverflow.com/a/25817631/5000805
# Print also export line if the variable is being exported.
print-%:
	@echo $* = $($*)
	@env | sed '/^\($*\)=.*/s//export \1/;t;d'

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(EXTRA_CMAKE_VARIABLES:%=-D%)

# Unset limit of debug information entries.
override_dh_dwz:
ifndef SPLIT_DEBUG_INFO
	dh_dwz -- -L none
else

# dwz(1) can't work with split DWARF, see: https://sourceware.org/bugzilla/show_bug.cgi?id=24756
# Gather debug references on my own before Debhelper moves it to -dbgsym package.
TELEGRAM_BINARY = debian/telegram-desktop/usr/bin/telegram-desktop
DBGSYM = debian/.debhelper/telegram-desktop/dbgsym-root
DBGDIR = usr/lib/debug/telegram-desktop
TRACING = $(if $(filter terse,$(DEB_BUILD_OPTIONS)),,-x)
execute_before_dh_strip:
	mkdir -p debian/tmp $(DBGSYM)/$(DBGDIR)
	TMPDIR=debian/tmp debian/dbgpatch.py $(TRACING) $(TELEGRAM_BINARY) $(DBGSYM) $(DBGDIR)
endif

override_dh_gencontrol:
	dh_gencontrol -- $(EXTRA_SUBSTVARS:%="-V%")