This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=15f285b9d0a00fd07931fff051f7803852d612af commit 15f285b9d0a00fd07931fff051f7803852d612af Author: Guillem Jover <guil...@debian.org> AuthorDate: Sat Sep 19 23:09:52 2020 +0200 build: Pre-process the curses header before parsing it We need to extract the KEY_* macros from the curses header file that we are going to end up including in the source. But we should not assume any kind of structure, because that's just fragile, as the contents can be included from other header files, or be protected behind a pre-processor macro or similar. Instead we use the CPP -dD option which will make the pre-processor handle all the internal details and output a list of active macros with their values, which we can then safely parse. Closes: #970545 --- dselect/.gitignore | 1 + dselect/Makefile.am | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dselect/.gitignore b/dselect/.gitignore index cce16ad58..bba6d3455 100644 --- a/dselect/.gitignore +++ b/dselect/.gitignore @@ -1,2 +1,3 @@ curkeys.h +curkeys.hpp dselect diff --git a/dselect/Makefile.am b/dselect/Makefile.am index 9206603a2..4671c7ba6 100644 --- a/dselect/Makefile.am +++ b/dselect/Makefile.am @@ -57,18 +57,14 @@ dselect_LDADD = \ EXTRA_DIST = keyoverride mkcurkeys.pl -CLEANFILES = curkeys.h +CLEANFILES = curkeys.hpp curkeys.h curkeys.$(OBJEXT): curkeys.h -curkeys.h: $(srcdir)/keyoverride $(srcdir)/mkcurkeys.pl - $(AM_V_GEN) cursesfile=`echo '#include "dselect-curses.h"' | \ - $(CPP) $(CPPFLAGS) -I$(top_builddir) -I $(srcdir) - | \ - grep '[^-]curses\.h' | head -n 1 | \ - sed -e 's/^[^"]*"//; s/".*$$//'`; \ - if [ "$$cursesfile" = "" ]; then \ - echo "can't find curses file"; exit 1; \ - fi; \ - $(PERL) $(srcdir)/mkcurkeys.pl $< $$cursesfile >$@ +curkeys.hpp: dselect-curses.h + $(AM_V_GEN) echo '#include "dselect-curses.h"' | \ + $(CPP) -dD $(CPPFLAGS) -I$(top_builddir) -I $(srcdir) - >$@ +curkeys.h: $(srcdir)/keyoverride $(srcdir)/mkcurkeys.pl curkeys.hpp + $(AM_V_GEN) $(PERL) $(srcdir)/mkcurkeys.pl $< curkeys.hpp >$@ install-data-local: $(MKDIR_P) $(DESTDIR)$(pkgconfdir)/dselect.cfg.d -- Dpkg.Org's dpkg