1 # Combine version map fragments into version scripts for our shared objects.
2 # Copyright (C) 1998,99,2000,2002,2005 Free Software Foundation, Inc.
3 # Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
5 # This script expects the following variables to be defined:
6 # defsfile name of Versions.def file
7 # buildroot name of build directory with trailing slash
8 # move_if_change move-if-change command
10 # Read definitions for the versions.
15 while (getline < defsfile
) {
16 if (/^
[a
-zA
-Z0
-9_.
]+ \
{/) {
19 while (getline < defsfile
&& !
/^
}/) {
21 renamed
[curlib
"::" $
1] = $
3;
24 versions
[curlib
"::" $
1] =
1;
30 tmpfile = buildroot
"Versions.tmp";
31 # Note this sorting presumes only single digits between dots for proper
32 # numeric ordering. sort -n doesn't do quite the right thing either,
33 # and in some non-GNU sort implementations does not sort at all.
34 sort =
"sort > " tmpfile
;
37 # Remove comment lines.
42 # This matches the beginning of the version information for a new library.
46 printf("no versions defined for %s\n", $
1) > "/dev/stderr";
52 # This matches the beginning of a new version for the current library.
54 if (renamed
[actlib
"::" $
1])
55 actver = renamed
[actlib
"::" $
1];
56 else if (!versions
[actlib
"::" $
1] && $
1 != "GLIBC_PRIVATE") {
57 printf("version %s not defined for %s\n", $
1, actlib
) > "/dev/stderr";
65 # This matches lines with names to be added to the current version in the
66 # current library. This is the only place where we print something to
67 # the intermediate file.
70 # Ensure GLIBC_ versions come always first
71 sub(/^GLIBC_
/," GLIBC_",sortver
)
72 printf("%s %s %s\n", actlib
, sortver
, $
0) | sort
;
76 function closeversion
(name
, oldname
) {
78 printf(" local:\n *;\n") > outfile
;
81 # This version inherits from the last one only if they
82 # have the same nonnumeric prefix, i.e. GLIBC_x.y and GLIBC_x.z
83 # or FOO_x and FOO_y but not GLIBC_x and FOO_y.
85 sub(/[0-9.
]+/,".+",pfx
);
86 if (oldname ==
"" || name !~ pfx
) print "};" > outfile
;
87 else printf("} %s;\n", oldname
) > outfile
;
90 function close_and_move
(name
, real_name
) {
92 system(move_if_change
" " name
" " real_name
" >&2");
95 # Now print the accumulated information.
100 system("rm -f " tmpfile
);
106 printf("version-maps =");
107 while (getline < tmpfile
) {
110 closeversion
(oldver
, veryoldver
);
112 close_and_move
(outfile
, real_outfile
);
115 real_outfile = buildroot oldlib
".map";
116 outfile = real_outfile
"T";
119 printf(" %s.map", oldlib
);
123 closeversion
(oldver
, veryoldver
);
126 printf("%s {\n global:\n", $
2) > outfile
;
129 printf(" ") > outfile
;
130 for (n =
3; n
<=
NF; ++n
) {
131 printf(" %s", $n
) > outfile
;
133 printf("\n") > outfile
;
136 closeversion
(oldver
, veryoldver
);
137 close_and_move
(outfile
, real_outfile
);
138 system("rm -f " tmpfile
);