1 # Combine version map fragments into version scripts for our shared objects.
2 # Copyright (C) 1998,99,2000,02 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.
13 while (getline < defsfile
) {
14 if (/^
[a
-zA
-Z0
-9_.
]+ \
{/) {
17 while (getline < defsfile
&& !
/^
}/) {
19 renamed
[curlib
"::" $
1] = $
3;
28 tmpfile = buildroot
"Versions.tmp";
29 sort =
"sort -n > " tmpfile
;
32 # Remove comment lines.
37 # This matches the beginning of the version information for a new library.
41 printf("no versions defined for %s\n", $
1) > "/dev/stderr";
47 # This matches the beginning of a new version for the current library.
49 if (renamed
[actlib
"::" $
1])
50 actver = renamed
[actlib
"::" $
1];
51 else if (!versions
[$
1]) {
52 printf("version %s not defined for %s\n", $
1, actlib
) > "/dev/stderr";
60 # This matches lines with names to be added to the current version in the
61 # current library. This is the only place where we print something to
62 # the intermediate file.
65 # Ensure GLIBC_ versions come always first
66 sub(/^GLIBC_
/," GLIBC_",sortver
)
67 printf("%s %s %s\n", actlib
, sortver
, $
0) | sort
;
71 function closeversion
(name
, oldname
) {
73 printf(" local:\n *;\n") > outfile
;
76 # This version inherits from the last one only if they
77 # have the same nonnumeric prefix, i.e. GLIBC_x.y and GLIBC_x.z
78 # or FOO_x and FOO_y but not GLIBC_x and FOO_y.
80 sub(/[0-9.
]+/,".+",pfx
);
81 if (oldname ==
"" || name !~ pfx
) print "};" > outfile
;
82 else printf("} %s;\n", oldname
) > outfile
;
85 function close_and_move
(name
, real_name
) {
87 system(move_if_change
" " name
" " real_name
" >&2");
90 # Now print the accumulated information.
95 printf("version-maps =");
96 while (getline < tmpfile
) {
99 closeversion
(oldver
, veryoldver
);
101 close_and_move
(outfile
, real_outfile
);
104 real_outfile = buildroot oldlib
".map";
105 outfile = real_outfile
"T";
108 printf(" %s.map", oldlib
);
112 closeversion
(oldver
, veryoldver
);
115 printf("%s {\n global:\n", $
2) > outfile
;
118 printf(" ") > outfile
;
119 for (n =
3; n
<=
NF; ++n
) {
120 printf(" %s", $n
) > outfile
;
122 printf("\n") > outfile
;
125 closeversion
(oldver
, veryoldver
);
126 close_and_move
(outfile
, real_outfile
);
127 system("rm -f " tmpfile
);