Sort BZ # in NEWS
[glibc.git] / scripts / soversions.awk
blobdc8afdc205fc60b86fe3c4e9c61327f57b189fa2
1 # awk script for shlib-versions.v -> soversions.i; see Makeconfig.
3 BEGIN {
4 config = cpu "-" vendor "-" os;
5 configs[config] = "DEFAULT";
8 { thiscf = $1 }
10 $2 == "ABI" {
11 if ((config ~ thiscf) && !abiname) {
12 abiname = $3;
13 sub(/@CPU@/, cpu, abiname);
14 sub(/@VENDOR@/, vendor, abiname);
15 sub(/@OS@/, os, abiname);
17 next;
20 # Obey the first matching DEFAULT line.
21 $2 == "DEFAULT" {
22 $1 = $2 = "";
23 default_set[++ndefault_set] = thiscf "\n" $0;
24 next
27 # Collect all lib lines before emitting anything, so DEFAULT
28 # can be interspersed.
30 lib = number = $2;
31 sub(/=.*$/, "", lib);
32 sub(/^.*=/, "", number);
33 if ((thiscf FS lib) in numbers) next;
34 numbers[thiscf FS lib] = number;
35 order[thiscf FS lib] = ++order_n;
36 if (NF > 2) {
37 $1 = $2 = "";
38 versions[thiscf FS lib] = $0
42 END {
43 for (elt in numbers) {
44 split(elt, x);
45 cf = x[1];
46 lib = x[2];
47 for (c in configs)
48 if (c ~ cf) {
49 if (elt in versions)
50 set = versions[elt];
51 else {
52 set = (c == config) ? default_setname : "";
53 for (i = 1; i <= ndefault_set; ++i) {
54 split(default_set[i], x, "\n");
55 if (c ~ x[1]) {
56 set = x[2];
57 break;
61 line = set ? (lib FS numbers[elt] FS set) : (lib FS numbers[elt]);
62 if (!((c FS lib) in lineorder) || order[elt] < lineorder[c FS lib]) {
63 lineorder[c FS lib] = order[elt];
64 lines[c FS lib] = configs[c] FS line;
68 if (abiname) {
69 print "ABI", abiname
71 for (c in lines) {
72 print lines[c]