File: rules

package info (click to toggle)
dpdk 25.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 127,892 kB
  • sloc: ansic: 2,358,479; python: 16,426; sh: 4,474; makefile: 1,713; awk: 70
file content (187 lines) | stat: -rwxr-xr-x 10,248 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/make -f

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all reproducible=+all
DEB_CFLAGS_MAINT_APPEND = -flto=auto -ffat-lto-objects
DEB_CXXFLAGS_MAINT_APPEND = -flto=auto -ffat-lto-objects
DEB_LDFLAGS_MAINT_APPEND = -flto=auto -ffat-lto-objects
include /usr/share/dpkg/default.mk
include /usr/share/debhelper/dh_package_notes/package-notes.mk

# Upstream now defines a single ABI across all libs that we will use
DPDK_ABI := $(shell cat ABI_VERSION | cut -d. -f1)
# Experimental libs will have 0.200 on actual ABI 20.0
DPDK_EXP_ABI := "0.$(shell cat ABI_VERSION | cut -d. -f1-2 | tr -d ".")"

#ifeq (,$(findstring terse,$(DEB_BUILD_OPTIONS)))
#	export DH_VERBOSE=1
#	export DH_OPTIONS=-v
#endif

# People rebuilding this package can overwrite RTE_PLATFORM
# via DEB_BUILD_OPTIONS if they like
ifneq (,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
	echo "WARNING: the machine setting is deprecated, please use platform (rte_platform)"
    RTE_PLATFORM ?= $(patsubst rte_machine=%,%,$(filter rte_platform=%,$(DEB_BUILD_OPTIONS)))
endif
ifneq (,$(filter rte_platform=%,$(DEB_BUILD_OPTIONS)))
    RTE_PLATFORM ?= $(patsubst rte_platform=%,%,$(filter rte_platform=%,$(DEB_BUILD_OPTIONS)))
endif
# default to minimal base, without setting this it would build
# -march=native which is a non portable invariant
RTE_PLATFORM ?= "generic"

ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
BUILD_DOCS=n
else
ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
BUILD_DOCS=n
# to stop dh_installdoc from running
export DEB_BUILD_PROFILES += nodoc
else
BUILD_DOCS=y
endif
endif

# Allow to pass specific configure flags to meson as a comma separated list
ifneq (,$(filter dpdk_config_options=%,$(DEB_BUILD_OPTIONS)))
# GNU Makefile hack: can't directly escape comma and spaces, so use variables
    comma := ,
    empty :=
    space := $(empty) $(empty)
    DPDK_CONFIG_OPTIONS ?= $(subst $(comma),$(space),$(patsubst dpdk_config_options=%,%,$(filter dpdk_config_options=%,$(DEB_BUILD_OPTIONS))))
endif

%:
	dh $@ --buildsystem=meson

execute_after_dh_gencontrol:
	# debian/files will not exist until dh_gencontrol has ran at least once,
	# so we need to run gencontrol for libdpdk-dev after.
	# The list of libraries and PMDs is everchanging, so generate the dependency
	# list for libdpdk-dev to avoid having to maintain it manually.
	# Various meta packages help users to gain a granular access per lib-subtype.
	# The recommends list for dpdk has more common libs, all full meta categories
	# are listed as suggests.
	dh_gencontrol -p libdpdk-dev          -- -V"librte:All=`grep      -E 'librte-*'           ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-all      -- -V"librte:All=`grep      -E 'librte-*'           ./debian/files | grep -v dbgsym | grep -v 'librte-meta-' | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-baseband -- -V"librte:Baseband=`grep -E 'librte-baseband-.*' ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-bus      -- -V"librte:Bus=`grep      -E 'librte-bus-.*'      ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-common   -- -V"librte:Common=`grep   -E 'librte-common-.*'   ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-compress -- -V"librte:Compress=`grep -E 'librte-compress-.*' ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-crypto   -- -V"librte:Crypto=`grep   -E 'librte-crypto-.*'   ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-dma      -- -V"librte:Dma=`grep      -E 'librte-dma-.*'      ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-event    -- -V"librte:Event=`grep    -E 'librte-event-.*'    ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-mempool  -- -V"librte:Mempool=`grep  -E 'librte-mempool-.*'  ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-net      -- -V"librte:Net=`grep      -E 'librte-net-.*'      ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-raw      -- -V"librte:Raw=`grep      -E 'librte-raw-.*'      ./debian/files | grep -v dbgsym                          | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
	dh_gencontrol -p librte-meta-allpmds -- -V"librte:Allpmds=`for pmd in $$(find -type d -wholename './debian/librte-*dpdk/pmds-*'); do awk -v "ver=$(DEB_VERSION)" '/^Package:/ {printf("%s (= %s), \n",$$2,ver)}' "$${pmd}/../../../../../DEBIAN/control"; done | LC_ALL=C sort --stable | xargs`"

execute_before_dh_auto_clean:
	rm -f doc/guides/compressdevs/overview_feature_table.txt \
		doc/guides/cryptodevs/overview_aead_table.txt \
		doc/guides/cryptodevs/overview_asym_table.txt \
		doc/guides/cryptodevs/overview_auth_table.txt \
		doc/guides/cryptodevs/overview_cipher_table.txt \
		doc/guides/cryptodevs/overview_feature_table.txt \
		doc/guides/nics/overview_table.txt \
		doc/guides/bbdevs/overview_feature_table.txt \
		doc/guides/cryptodevs/overview_os_table.txt \
		doc/guides/eventdevs/overview_crypto_adptr_feature_table.txt \
		doc/guides/eventdevs/overview_feature_table.txt \
		doc/guides/eventdevs/overview_rx_adptr_feature_table.txt \
		doc/guides/eventdevs/overview_timer_adptr_feature_table.txt \
		doc/guides/eventdevs/overview_tx_adptr_feature_table.txt \
		doc/guides/gpus/overview_feature_table.txt \
		doc/guides/nics/rte_flow_actions_table.txt \
		doc/guides/nics/rte_flow_items_table.txt \
		doc/guides/regexdevs/overview_feature_table.txt \
		doc/guides/vdpadevs/overview_feature_table.txt
	# test directory for sockets, etc
	rm -rf $(CURDIR)/tmpdir
	# every PMD package has a ldconfig-escape lintian warning, so we generate an override, delete them on cleanup
	find debian -type f \( -iname "librte-*.lintian-overrides" ! -iname "librte-meta*.lintian-overrides" \) -delete
	# some python helpers got precompiled in place along the way and are not always cleaned up
	find . -name '*.pyc' -type f -delete
	find . -name '__pycache__' -type d -delete

override_dh_auto_configure-indep:
	dh_auto_configure -- -Denable_docs=true

override_dh_auto_build-indep:
ifeq (y,$(BUILD_DOCS))
	dh_auto_build -- doc
endif

override_dh_auto_install-indep:
ifeq (y,$(BUILD_DOCS))
	# TODO: in compat 14 we can use dh_auto_install -- --no-rebuild --tags doc
	meson install -C obj-$(DEB_HOST_GNU_TYPE) --no-rebuild --tags doc --destdir ../debian/tmp/
endif

override_dh_auto_configure-arch:
	dh_auto_configure -- $(DPDK_CONFIG_OPTIONS) \
		--includedir=include/dpdk \
		--default-library=shared \
		-Dinclude_subdir_arch=../$(DEB_HOST_MULTIARCH)/dpdk \
		-Dplatform=$(RTE_PLATFORM) \
		-Db_lto=true
	head obj-$(DEB_HOST_GNU_TYPE)/compile_commands.json || find . -name compile_commands.json
	grep --max-count=1 -e '-mcpu=' -e '-march=' \
		obj-$(DEB_HOST_GNU_TYPE)/compile_commands.json
	grep -q -e '-mcpu=power8' -e '-march=corei7' -e '-march=armv8-a+crc' -e '-march=rv64gc' -e '-march=loongarch64' \
		obj-$(DEB_HOST_GNU_TYPE)/compile_commands.json \
		|| (echo "Error: unexpected target cpu"; exit 1)

override_dh_auto_install-arch:
	dh_auto_install
	# Package(s): libdpdk-<NAME><VER> (bare runtime libs and PMDs)
	# if lib names end in a number, insert a "-"
	# if libraries are fully experimental set zero as package name suffix, otherwise DPDK_ABI
	# every PMD package has a ldconfig-escape lintian warning, so we generate an override
	for lib in $$(ls -1 debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.so.*); do \
	  LN=$$(basename $${lib} | sed -e 's/\.so\.[0-9\.]*$$//' | tr '_' '-'); \
	  if echo $${LN} | grep -q ".*[0-9]$$"; then \
	    PKG="$${LN}-"; \
	  else \
	    PKG="$${LN}"; \
	  fi; \
	  if echo $${lib} | grep -q "\.so\.0\.[0-9]*$$"; then \
	    PKG="$${PKG}$(DPDK_EXP_ABI)"; \
	  else \
	    PKG="$${PKG}$(DPDK_ABI)"; \
	  fi; \
	  LIBF="$$(basename $${lib})"; \
	  dh_install -p $${PKG} usr/lib/$(DEB_HOST_MULTIARCH)/$${LIBF}; \
	  if [ -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*/*/$${LIBF} ]; then \
	    dh_install -p $${PKG} usr/lib/$(DEB_HOST_MULTIARCH)/*/*/$${LIBF}; \
	    echo "ldconfig-escape" > $(CURDIR)/debian/$${PKG}.lintian-overrides; \
	  fi; \
	done
	# Strip RPATH, hard-coded in test/test/meson.build at the moment
	chrpath --delete $(CURDIR)/debian/tmp/usr/bin/dpdk-test
	# Only present on ninja install, so fails on arch: all builds
	rm -f $(CURDIR)/debian/tmp/usr/share/doc/dpdk/_static/css/custom.css

override_dh_install:
	dh_install --exclude=fonts

override_dh_installinit:
	dh_installinit --no-start --no-stop-on-upgrade

override_dh_installsystemd:
	dh_installsystemd --no-start --no-stop-on-upgrade

# Don't run tests when building documentation
override_dh_auto_test-indep:

# Unit tests do not work on Salsa CI due to checks on the build directory
# permissions that cannot be overridden, so skip them. They will be run by
# autopkgtest.
override_dh_auto_test-arch:

override_dh_python3:
	# dh_python only looks in /usr/share/package_name but dpdk-doc installs in
	# /usr/share/dpdk, so pass /usr to catch all
	dh_python3 --shebang=/usr/bin/python3 /usr