1 # Combine version map fragments into version scripts for our shared objects.
2 # Copyright (C) 1998-2014 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.
15 while (getline < defsfile
) {
16 if (/^
[a
-zA
-Z0
-9_.
]+ \
{/) {
19 while (getline < defsfile
&& !
/^
}/) {
21 renamed
[curlib
"::" $
1] = $
3;
24 versions
[curlib
"::" $
1] =
1;
30 tmpfile = buildroot
"Versions.tmp";
32 sort =
"sort -t. -k 1,1 -k 2n,2n -k 3 > " 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.
52 if (renamed
[actlib
"::" $
1])
53 actver = renamed
[actlib
"::" $
1];
54 else if (!versions
[actlib
"::" $
1] && $
1 != "GLIBC_PRIVATE") {
55 printf("version %s not defined for %s\n", $
1, actlib
) > "/dev/stderr";
63 # This matches lines with names to be added to the current version in the
64 # current library. This is the only place where we print something to
65 # the intermediate file.
68 # Ensure GLIBC_ versions come always first
69 sub(/^GLIBC_
/," GLIBC_",sortver
)
70 printf("%s %s %s\n", actlib
, sortver
, $
0) | sort
;
74 function closeversion
(name
, oldname
) {
76 printf(" local:\n *;\n") > outfile
;
79 # This version inherits from the last one only if they
80 # have the same nonnumeric prefix, i.e. GLIBC_x.y and GLIBC_x.z
81 # or FOO_x and FOO_y but not GLIBC_x and FOO_y.
83 sub(/[0-9.
]+/,".+",pfx
);
84 if (oldname ==
"" || name !~ pfx
) print "};" > outfile
;
85 else printf("} %s;\n", oldname
) > outfile
;
88 function close_and_move
(name
, real_name
) {
90 system(move_if_change
" " name
" " real_name
" >&2");
93 # Now print the accumulated information.
98 system("rm -f " tmpfile
);
104 printf("version-maps =");
105 while (getline < tmpfile
) {
108 closeversion
(oldver
, veryoldver
);
110 close_and_move
(outfile
, real_outfile
);
113 real_outfile = buildroot oldlib
".map";
114 outfile = real_outfile
"T";
117 printf(" %s.map", oldlib
);
121 closeversion
(oldver
, veryoldver
);
124 printf("%s {\n global:\n", $
2) > outfile
;
127 printf(" ") > outfile
;
128 for (n =
3; n
<=
NF; ++n
) {
129 printf(" %s", $n
) > outfile
;
131 printf("\n") > outfile
;
134 closeversion
(oldver
, veryoldver
);
135 close_and_move
(outfile
, real_outfile
);
136 #system("rm -f " tmpfile);