d/rules: build tests even if x86-64-v2 is not supported

If nocheck is not set, tests are always built but only run after
checking if the build CPU has all the x86-64-v2 features in the
override_dh_auto_test step.
This commit is contained in:
Andrea Pappacoda 2023-01-20 10:25:03 +01:00
parent 87352328e4
commit d082c229e9
No known key found for this signature in database
GPG Key ID: 4A9208A2455077A7
1 changed files with 9 additions and 8 deletions

17
debian/rules vendored
View File

@ -32,19 +32,12 @@ ifeq ($(DEB_HOST_ARCH_CPU),amd64)
export DEB_CXXFLAGS_MAINT_APPEND = -march=x86-64-v2
endif
test := true
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifeq ($(DEB_HOST_ARCH_CPU),amd64)
ifeq (,$(shell lscpu | awk '/cx16/ && /lahf/ && /popcnt/ && /sse3/ && /sse4_1/ && /sse4_2/ && /ssse3/'))
$(warning Your CPU doesn't support the x86-64-v2 micro-architecture level. Tests will be skipped.)
test := false
endif
endif
test := true
else
test := false
endif
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
build_type := Release
lto := true
@ -80,5 +73,13 @@ override_dh_auto_configure:
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=$(lto) \
-DCMAKE_POLICY_DEFAULT_CMP0069=NEW
override_dh_auto_test:
supports_x86_64_v2=$$(lscpu | awk '/cx16/ && /lahf/ && /popcnt/ && /sse3/ && /sse4_1/ && /sse4_2/ && /ssse3/' | tr -d '[:space:]') ; \
if [ '$(DEB_HOST_BUILD_CPU)' = amd64 ] && [ -z "$$supports_x86_64_v2" ]; then \
echo "Your CPU doesn't support the x86-64-v2 micro-architecture level. Tests will be skipped." ; \
else \
dh_auto_test ; \
fi
execute_after_dh_auto_clean:
$(RM) externals/sirit