[PATCH] libnotmuch: build symbols list without relying on gcc	-aux-info.
    david at tethera.net 
    david at tethera.net
       
    Sun Jun 26 19:42:25 PDT 2011
    
    
  
From: David Bremner <bremner at debian.org>
Carl reports "gcc -aux-info notmuch.aux lib/notmuch.h" does not
generate notmuch.aux for him with Debian gcc 4.6.0-8.
Based on a suggestion by Austin Clements, this version uses objdump to
get the symbols from the object files.
Any symbol that
    - is in some object file in $(libnotmuch_modules), and
    - starts with notmuch_
will be exported.
---
 Here is another way of doing this, probably better unless you are
 very attached to the idea of declaring the API in the header file.
 
 lib/Makefile.local |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/Makefile.local b/lib/Makefile.local
index a33ba34..38913c6 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -75,10 +75,9 @@ $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
 	echo $(libnotmuch_modules)
 	$(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
 
-notmuch.sym: lib/notmuch.h
-	gcc -aux-info notmuch.aux $<
+notmuch.sym: $(libnotmuch_modules)
 	printf "{\nglobal:\n" > notmuch.sym
-	sed  -n 's/.*\(notmuch_[a-z_]*\) (.*/\t\1;/p' notmuch.aux >> notmuch.sym
+	objdump -t $(libnotmuch_modules)| awk '$$4 == ".text" && $$6 ~ "^notmuch" {print "\t"$$6";"}' >>notmuch.sym
 	printf "local: *;\n};\n" >> notmuch.sym
 
 $(dir)/$(SONAME): $(dir)/$(LIBNAME)
@@ -103,4 +102,4 @@ install-$(dir): $(dir)/$(LIBNAME)
 	$(LIBRARY_INSTALL_POST_COMMAND)
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a notmuch.aux notmuch.sym
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a notmuch.sym
-- 
1.7.5.4
    
    
More information about the notmuch
mailing list