#985980 allow dpkg-buildflags to query for a specific feature

Package:
dpkg-dev
Source:
dpkg
Submitter:
Matthias Klose
Date:
2021-06-21 05:39:09 UTC
Severity:
minor
Tags:
#985980#5
Date:
2021-03-27 11:50:58 UTC
From:
To:
I would like to have a simple way to query for a specific feature in
debian/rules.  E.g. an upstream package provides options to configure for lto or
pgo builds on it's own, like

  ifeq (yes,$(shell dpkg-buildflags --query-feature optimize lto))
    configure_args += --enable-lto
    # lto flags are set by the upstream build system
    export DEB_BUILD_MAINT_OPTIONS := $(DEB_BUILD_MAINT_OPTIONS) optimize=-lto
  endif

dpkg-buildflags already has a --query-features option, but that one would be
inconvenient to use in a Makefile.

#985980#10
Date:
2021-06-20 16:24:03 UTC
From:
To:
A space-separated list of enabled features may be useful on its own,
and would not increase the complexity in Makefiles.

features := $(shell dpkg-buildflags --enabled-features optimize)
ifneq (,$(filter lto,$(features)))
  ...
endif
ifneq (,$(filter pgo,$(features)))
  ...

For symetry, a '--disabled-features AREA' option would be nice.

For consistency with '--query-features AREA', both should report
unknown AREAs with an exit status of 1.