1 # Combine version map fragments into version scripts for our shared objects.
2 # Copyright (C) 1998,99,2000 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\n", $
1) > "/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 printf("}%s;\n", oldname
) > outfile
;
79 function close_and_move
(name
, real_name
) {
81 system(move_if_change
" " name
" " real_name
" >&2");
84 # Now print the accumulated information.
89 printf("version-maps =");
90 while(getline < tmpfile
) {
93 closeversion
(oldver
, veryoldver
);
95 close_and_move
(outfile
, real_outfile
);
98 real_outfile = buildroot oldlib
".map";
99 outfile = real_outfile
"T";
102 printf(" %s.map", oldlib
);
106 closeversion
(oldver
, veryoldver
);
109 printf("%s {\n global:\n", $
2) > outfile
;
112 printf(" ") > outfile
;
113 for (n =
3; n
<=
NF; ++n
) {
114 printf(" %s", $n
) > outfile
;
116 printf("\n") > outfile
;
119 closeversion
(oldver
, veryoldver
);
120 close_and_move
(outfile
, real_outfile
);
121 system("rm -f " tmpfile
);