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.
64 printf("%s %s %s\n", actlib
, actver
, $
0) | sort
;
68 function closeversion
(name
, oldname
) {
70 printf(" local:\n *;\n") > outfile
;
73 printf("}%s;\n", oldname
) > outfile
;
76 function close_and_move
(name
, real_name
) {
78 system(move_if_change
" " name
" " real_name
" >&2");
81 # Now print the accumulated information.
86 printf("version-maps =");
87 while(getline < tmpfile
) {
90 closeversion
(oldver
, veryoldver
);
92 close_and_move
(outfile
, real_outfile
);
95 real_outfile = buildroot oldlib
".map";
96 outfile = real_outfile
"T";
99 printf(" %s.map", oldlib
);
103 closeversion
(oldver
, veryoldver
);
106 printf("%s {\n global:\n", $
2) > outfile
;
109 printf(" ") > outfile
;
110 for (n =
3; n
<=
NF; ++n
) {
111 printf(" %s", $n
) > outfile
;
113 printf("\n") > outfile
;
116 closeversion
(oldver
, veryoldver
);
117 close_and_move
(outfile
, real_outfile
);
118 system("rm -f " tmpfile
);