Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Copyright © 2010-2019 Stephen Kitt <[email protected]>
4 # Copyright © 2020-2023 Matthias Klose <[email protected]>
5
6 # Disable package mangling in Launchpad; it currently fails to parse
7 # Built-Using, which results in build failures
8 export NO_PKG_MANGLE=1
9
10 include /usr/share/dpkg/pkg-info.mk
11 include /usr/share/dpkg/architecture.mk
12
13 top_dir := $(shell pwd)
14 gdb_dir := /usr/src
15 upstream_gdb_dir := $(top_dir)/upstream
16 build_gdb_dir := $(top_dir)/build-gdb
17
18 bpf_version := $(shell dpkg-parsechangelog -S Version | sed 's/^\([1-9][0-9]*\)\(.*\)/\1 \2/')
19 bpf_base := $(word 1, $(bpf_version))
20 bpf_suffix := $(word 2, $(bpf_version))
21 source_version := $(shell dpkg-query -W -f="\$${Version}\n" gdb-source)
22
23 deb_release := $(shell expr $(bpf_base) - 12)$(bpf_suffix)
24 deb_version := $(source_version)+$(deb_release)
25
26 deb_upstream_version := $(shell echo $(deb_version) | cut -d- -f1)
27 base_version := $(shell echo $(deb_version) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/')
28
29 package := gdb-bpf
30
31 target := bpf
32
33 # Full hardening for Debian-targeted builds
34 dpkg_buildflags_arch = DEB_BUILD_MAINT_OPTIONS="hardening=+all,-format" dpkg-buildflags
35
36 spelling = grep -rl "$(1)" $(upstream_gdb_dir) | xargs -r sed -i "s/$(1)/$(2)/g"
37
38 %:
39 dh $@
40
41 unpack-stamp:
42 tar xf $(gdb_dir)/gdb.tar.*
43 rm -rf $(upstream_gdb_dir)
44 mv gdb $(upstream_gdb_dir)
45 $(call spelling,occurences,occurrences)
46 $(call spelling,Unkown,Unknown)
47 $(call spelling,vaild,valid)
48 touch $@
49
50 override_dh_auto_clean:
51 dh_auto_clean
52 rm -rf *-stamp $(build_gdb_dir) $(upstream_gdb_dir)
53
54 override_dh_auto_configure: unpack-stamp
55 mkdir -p $(build_gdb_dir)
56 cd $(build_gdb_dir) && \
57 $(upstream_gdb_dir)/configure \
58 --build=$(DEB_BUILD_GNU_TYPE) \
59 --prefix=/usr \
60 --disable-werror \
61 --with-system-readline --with-system-zlib \
62 --enable-tui --with-expat --with-python=python3 \
63 --target=$(target) --disable-werror \
64 $(shell $(dpkg_buildflags_arch) --export=cmdline)
65
66 override_dh_auto_build:
67 $(shell $(dpkg_buildflags_arch) --export=sh); \
68 dh_auto_build --parallel -B$(build_gdb_dir) -- V=1
69
70 override_dh_auto_install:
71 dh_auto_install -B$(build_gdb_dir)
72
73 # Drop files which will conflict with other packages
74 rm -rf debian/$(package)/usr/include
75 rm -rf debian/$(package)/usr/lib
76 rm -rf debian/$(package)/usr/share/gdb
77 rm -rf debian/$(package)/usr/share/info
78 rm -rf debian/$(package)/usr/share/locale
79
80 rm -f debian/gdb-bpf/usr/share/man/man1/bpf-gdbserver*
81
82 override_dh_installchangelogs:
83 dh_installchangelogs $(upstream_gdb_dir)/ChangeLog
84
85 override_dh_gencontrol:
86 dh_gencontrol -- -v$(deb_version) -Vlocal:Version=$(deb_upstream_version) -Vgdb:Version=$(source_version)