unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob d7d96da0eda8a05a27babc0701052a154f6716eb 1674 bytes (raw)
name: lib/gen-version-script.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
#!/bin/sh

# we go through a bit of work to get the unmangled names of the
# typeinfo symbols because of
# http://sourceware.org/bugzilla/show_bug.cgi?id=10326

if [ $# -lt 2 ]; then
    echo Usage: $0 header obj1 obj2 obj3
    exit 1;
fi

HEADER=$1
shift

if [ `uname -s` == SunOS ] ; then
    #
    # Using Solaris "nm", a defined symbol looks like this:
    #
    # [Index]    Value    Size Type  Bind  Other Shndx   Name
    # [15]    |    128|     16|FUNC |GLOB |0    |1      |notmuch_tags_get
    #
    # and an undefined symbol looks like this:
    #
    # [Index]    Value    Size Type  Bind  Other Shndx   Name
    # [35]    |      0|      0|NOTY |GLOB |0    |UNDEF  |notmuch_tags_get
    #
    find_xapian_error() {
	nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "Xapian.*Error" { print $8 }'
    }
    find_compat_syms() {
	nawk -F'\|' '$7 !~ "UNDEF" && $8 ~ "get(line|delim)" { print $8 ";" }'
    }
    demangle() {
	gc++filt "$@"
    }
else
    find_xapian_error() {
	awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}'
    }
    find_compat_syms() {
	awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^get(line|delim)$" {print $3 ";"}'
    }
    demangle() {
	c++filt "$@"
    }
fi

printf '{\nglobal:\n'

# Find the typeinfo for "Xapian::*Error"s.
nm $* | find_xapian_error | sort | uniq | while read sym; do
    demangled=$(demangle $sym)
    case $demangled in
	typeinfo*) 
	    printf "\t$sym;\n"
	    ;;
	*)
	    ;;
    esac
done

# Find the "compat" syms that we need to export.
nm $* | find_compat_syms

# Finally, get the real notmuch symbols.
sed -n 's/^[ 	]*\(notmuch_[a-z_]*\)[ 	]*(.*/ \1;/p' $HEADER

printf "local: *;\n};\n"

debug log:

solving d7d96da ...
found d7d96da in https://yhetil.org/notmuch/1352142123-18286-8-git-send-email-blakej@foo.net/ ||
	https://yhetil.org/notmuch/1351998962-25135-8-git-send-email-blakej@foo.net/
found 76670d5 in https://yhetil.org/notmuch.git/
preparing index
index prepared:
100644 76670d57497a73d33961180d7c8fefb82ec60e59	lib/gen-version-script.sh

applying [1/1] https://yhetil.org/notmuch/1352142123-18286-8-git-send-email-blakej@foo.net/
diff --git a/lib/gen-version-script.sh b/lib/gen-version-script.sh
index 76670d5..d7d96da 100644

Checking patch lib/gen-version-script.sh...
Applied patch lib/gen-version-script.sh cleanly.

skipping https://yhetil.org/notmuch/1351998962-25135-8-git-send-email-blakej@foo.net/ for d7d96da
index at:
100644 d7d96da0eda8a05a27babc0701052a154f6716eb	lib/gen-version-script.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).