1 # Combine version map fragments into version files for the generated
3 # (C) Copyright 1998, 1999 Free Software Foundation, Inc.
4 # Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
6 # This script expects the following variables to be defined:
7 # defsfile name of Versions.def file
8 # buildroot name of build directory with trailing slash
9 # move_if_change move-if-change command
11 # Read definitions for the versions.
14 while (getline < defsfile
) {
15 if (/^
[a
-zA
-Z0
-9_.
]+ \
{/) {
18 while (getline < defsfile
&& !
/^
}/) {
25 tmpfile = buildroot
"Versions.tmp";
26 sort =
"sort -n > " tmpfile
;
29 # Remove comment lines.
34 # This matches the beginning of the version information for a new library.
38 printf("no versions defined for %s\n", $
1) > "/dev/stderr";
44 # This matches the beginning of a new version for the current library.
48 printf("version %s not defined\n", $
1) > "/dev/stderr";
54 # This matches lines with names to be added to the current version in the
55 # current library. This is the only place where we print something to
56 # the intermediate file.
58 printf("%s %s %s\n", actlib
, actver
, $
0) | sort
;
62 function closeversion
(name
, oldname
) {
64 printf(" local:\n *;\n") > outfile
;
67 printf("}%s;\n", oldname
) > outfile
;
70 function close_and_move
(name
, real_name
) {
72 system(move_if_change
" " name
" " real_name
" >&2");
75 # Now print the accumulated information.
80 printf("version-maps =");
81 while(getline < tmpfile
) {
84 closeversion
(oldver
, veryoldver
);
86 close_and_move
(outfile
, real_outfile
);
89 real_outfile = buildroot oldlib
".map";
90 outfile = real_outfile
"T";
93 printf(" %s.map", oldlib
);
97 closeversion
(oldver
, veryoldver
);
100 printf("%s {\n global:\n", $
2) > outfile
;
103 printf(" ") > outfile
;
104 for (n =
3; n
<=
NF; ++n
) {
105 printf(" %s", $n
) > outfile
;
107 printf("\n") > outfile
;
110 closeversion
(oldver
, veryoldver
);
111 close_and_move
(outfile
, real_outfile
);
112 system("rm -f " tmpfile
);