From e14f505a69d75a55e6b3cdad56b3707df149df51 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 30 Oct 2008 20:48:02 +0100 Subject: [PATCH] Filter config.h and autoconf.h in the public API. This tries to avoid leaking private symbols to autoconf.h which is a part of the public API. --- ucw/Makefile | 21 +++++++++++++++------ ucw/filter-autoconf.sed | 12 ++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 ucw/filter-autoconf.sed diff --git a/ucw/Makefile b/ucw/Makefile index 47695027..0af1d71d 100644 --- a/ucw/Makefile +++ b/ucw/Makefile @@ -34,7 +34,7 @@ LIBUCW_MODS= \ getopt LIBUCW_MAIN_INCLUDES= \ - lib.h config.h threads.h \ + lib.h threads.h \ mempool.h \ arraysort.h \ clists.h slists.h simple-lists.h \ @@ -130,12 +130,23 @@ endif API_LIBS+=libucw API_INCLUDES+=$(o)/ucw/.include-stamp -$(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) obj/autoconf.h +$(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) $(o)/ucw/autoconf.h $(o)/ucw/config.h $(Q)$(s)/build/install-includes $( $@" + $(Q)sed -f $(s)/ucw/filter-autoconf.sed <$< >$@ + +# Also, public config.h needs to refer to instead of "autoconf.h" +$(o)/ucw/config.h: $(s)/ucw/config.h + $(M)"FILTER $< -> $@" + $(Q)sed -e 's/^#include "autoconf\.h"/#include /' <$< >$@ + ifdef CONFIG_UCW_PERL include $(s)/ucw/perl/Makefile endif @@ -147,9 +158,7 @@ endif INSTALL_TARGETS+=install-libucw install-libucw: install -d -m 755 $(DESTDIR)$(INSTALL_LIB_DIR) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/ $(DESTDIR)$(INSTALL_PKGCONFIG_DIR) - install -m 644 $(addprefix run/include/ucw/,$(LIBUCW_MAIN_INCLUDES)) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/ - install -m 644 obj/autoconf.h $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/ - sed -e 's/^#include .autoconf\.h./#include /' $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/config.h + install -m 644 $(addprefix run/include/ucw/,$(LIBUCW_MAIN_INCLUDES) autoconf.h config.h) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw/ install -m 644 run/lib/pkgconfig/libucw.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR) install -m 644 run/lib/libucw.$(LS) $(DESTDIR)$(INSTALL_LIB_DIR) diff --git a/ucw/filter-autoconf.sed b/ucw/filter-autoconf.sed new file mode 100644 index 00000000..f6b598e5 --- /dev/null +++ b/ucw/filter-autoconf.sed @@ -0,0 +1,12 @@ +# A sed script to weed out private symbols from + +/^\//n + +# Excluded symbols (danger of collision) +/^#define CONFIG_DEBUG$/d + +# Included symbols +/^#define CONFIG_/n +/^#define CPU_/n + +d -- 2.39.2