Re: notmuch and "mute" -- useful to anyone?
[notmuch-archives.git] / 26 / ed8fb35d598f53c359675d66a6168ca89eeb2c
1 Return-Path: <blakej@foo.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 61AEC431FC2\r
6         for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 11:02:30 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 2mUchTC1uyJi for <notmuch@notmuchmail.org>;\r
16         Mon,  5 Nov 2012 11:02:28 -0800 (PST)\r
17 Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 280AD431FCF\r
21         for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 11:02:25 -0800 (PST)\r
22 Received: from foo.net (localhost [127.0.0.1])\r
23         by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qA5J2NoJ019127;\r
24         Mon, 5 Nov 2012 11:02:23 -0800 (PST)\r
25 Received: (from blakej@localhost)\r
26         by foo.net (8.14.5+Sun/8.14.5/Submit) id qA5J2NTm019126;\r
27         Mon, 5 Nov 2012 11:02:23 -0800 (PST)\r
28 From: Blake Jones <blakej@foo.net>\r
29 To: notmuch@notmuchmail.org\r
30 Subject: [PATCH v2 07/10] gen-version-script: parse Solaris "nm" output\r
31         (Solaris support)\r
32 Date: Mon,  5 Nov 2012 11:02:00 -0800\r
33 Message-Id: <1352142123-18286-8-git-send-email-blakej@foo.net>\r
34 X-Mailer: git-send-email 1.7.3.2\r
35 In-Reply-To: <1352142123-18286-1-git-send-email-blakej@foo.net>\r
36 References: <1352142123-18286-1-git-send-email-blakej@foo.net>\r
37 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2\r
38         (foo.net [127.0.0.1]); Mon, 05 Nov 2012 11:02:23 -0800 (PST)\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Mon, 05 Nov 2012 19:02:30 -0000\r
52 \r
53 The output of "nm" on Solaris is substantially different from that on\r
54 Linux, and the current version of gen-version-script is tied to the\r
55 Linux "nm" output.  This patch separates the parts of "nm" processing\r
56 which are dependent on the output format into a couple shell functions,\r
57 and makes another shell function to use the appropriate version of\r
58 "c++filt" to demangle symbols.  It also modifies lib/Makefile.local\r
59 to pass the generated symbol table correctly to the Solaris linker.\r
60 ---\r
61  lib/Makefile.local        |    4 +++\r
62  lib/gen-version-script.sh |   50 ++++++++++++++++++++++++++++++++++++++++----\r
63  2 files changed, 49 insertions(+), 5 deletions(-)\r
64 \r
65 diff --git a/lib/Makefile.local b/lib/Makefile.local\r
66 index 0c6b258..2068e4a 100644\r
67 --- a/lib/Makefile.local\r
68 +++ b/lib/Makefile.local\r
69 @@ -30,7 +30,11 @@ LIBRARY_SUFFIX = so\r
70  LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)\r
71  SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)\r
72  LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)\r
73 +ifeq ($(PLATFORM),SOLARIS)\r
74 +LIBRARY_LINK_FLAG = -shared -Wl,-M notmuch.sym -Wl,-soname=$(SONAME) -Wl,--no-undefined -lc\r
75 +else\r
76  LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined\r
77 +endif\r
78  ifeq ($(PLATFORM),OPENBSD)\r
79  LIBRARY_LINK_FLAG += -lc\r
80  endif\r
81 diff --git a/lib/gen-version-script.sh b/lib/gen-version-script.sh\r
82 index 76670d5..d7d96da 100644\r
83 --- a/lib/gen-version-script.sh\r
84 +++ b/lib/gen-version-script.sh\r
85 @@ -1,3 +1,4 @@\r
86 +#!/bin/sh\r
87  \r
88  # we go through a bit of work to get the unmangled names of the\r
89  # typeinfo symbols because of\r
90 @@ -11,10 +12,44 @@ fi\r
91  HEADER=$1\r
92  shift\r
93  \r
94 +if [ `uname -s` == SunOS ] ; then\r
95 +    #\r
96 +    # Using Solaris "nm", a defined symbol looks like this:\r
97 +    #\r
98 +    # [Index]    Value    Size Type  Bind  Other Shndx   Name\r
99 +    # [15]    |    128|     16|FUNC |GLOB |0    |1      |notmuch_tags_get\r
100 +    #\r
101 +    # and an undefined symbol looks like this:\r
102 +    #\r
103 +    # [Index]    Value    Size Type  Bind  Other Shndx   Name\r
104 +    # [35]    |      0|      0|NOTY |GLOB |0    |UNDEF  |notmuch_tags_get\r
105 +    #\r
106 +    find_xapian_error() {\r
107 +       nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "Xapian.*Error" { print $8 }'\r
108 +    }\r
109 +    find_compat_syms() {\r
110 +       nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "get(line|delim)" { print $8 ";" }'\r
111 +    }\r
112 +    demangle() {\r
113 +       gc++filt "$@"\r
114 +    }\r
115 +else\r
116 +    find_xapian_error() {\r
117 +       awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}'\r
118 +    }\r
119 +    find_compat_syms() {\r
120 +       awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'\r
121 +    }\r
122 +    demangle() {\r
123 +       c++filt "$@"\r
124 +    }\r
125 +fi\r
126 +\r
127  printf '{\nglobal:\n'\r
128 -nm  $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}' | sort | uniq | \\r
129 -while read sym; do\r
130 -    demangled=$(c++filt $sym)\r
131 +\r
132 +# Find the typeinfo for "Xapian::*Error"s.\r
133 +nm $* | find_xapian_error | sort | uniq | while read sym; do\r
134 +    demangled=$(demangle $sym)\r
135      case $demangled in\r
136         typeinfo*) \r
137             printf "\t$sym;\n"\r
138 @@ -23,6 +58,11 @@ while read sym; do\r
139             ;;\r
140      esac\r
141  done\r
142 -nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'\r
143 -sed  -n 's/^[[:space:]]*\(notmuch_[a-z_]*\)[[:space:]]*(.*/ \1;/p' $HEADER\r
144 +\r
145 +# Find the "compat" syms that we need to export.\r
146 +nm $* | find_compat_syms\r
147 +\r
148 +# Finally, get the real notmuch symbols.\r
149 +sed -n 's/^[   ]*\(notmuch_[a-z_]*\)[  ]*(.*/ \1;/p' $HEADER\r
150 +\r
151  printf "local: *;\n};\n"\r
152 -- \r
153 1.7.3.2\r
154 \r