• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2
3# This tool is used to generate the version scripts for libc, libm, libdl,
4# and libstdc++ for every architecture.
5
6# usage: generate-version-script.py ARCH INPUT OUTPUT
7
8import sys
9
10def has_arch_tags(tags):
11  for arch in ["arm", "arm64", "x86", "x86_64"]:
12    if arch in tags:
13      return True
14  return False
15
16def GenerateVersionScript(arch, in_filename, out_filename):
17  with open(out_filename, "w") as fout:
18    with open(in_filename, "r") as fin:
19      for line in fin:
20        index = line.find("#")
21        if index != -1:
22          tags = line[index+1:].split()
23          if arch not in tags and has_arch_tags(tags):
24            continue
25        fout.write(line)
26
27arch = sys.argv[1]
28in_filename = sys.argv[2]
29out_filename = sys.argv[3]
30GenerateVersionScript(arch, in_filename, out_filename)
31