1 # Combine version map fragments into version files for the generated
3 # (C) Copyright 1998 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
&& !
/^
}/) {
21 derived
[curlib
, $
1] =
" " $
2;
22 for (n =
3; n
<=
NF; ++n
) {
23 derived
[curlib
, $
1] = derived
[curlib
, $
1] ", " $n
;
31 tmpfile = buildroot
"Versions.tmp";
32 sort =
"sort -n > " tmpfile
;
35 # Remove comment lines.
40 # This matches the beginning of the version information for a new library.
44 printf("no versions defined for %s\n", $
1) > "/dev/stderr";
50 # This matches the beginning of a new version for the current library.
54 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
) {
70 printf(" local:\n *;\n") > outfile
;
73 printf("}%s;\n", derived
[oldlib
, name
]) > 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
) {
92 close_and_move
(outfile
, real_outfile
);
95 real_outfile = buildroot oldlib
".map";
96 outfile = real_outfile
"T";
98 printf(" %s.map", oldlib
);
102 closeversion
(oldver
);
104 printf("%s {\n global:\n", $
2) > outfile
;
107 printf(" ") > outfile
;
108 for (n =
3; n
<=
NF; ++n
) {
109 printf(" %s", $n
) > outfile
;
111 printf("\n") > outfile
;
114 closeversion
(oldver
);
115 close_and_move
(outfile
, real_outfile
);
116 system("rm -f " tmpfile
);