#! /usr/bin/env python3 # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
assert __name__ == "__main__"
r"""
To update ANGLE in Gecko, use Windows with git-bash, and setup depot_tools, python2, and
python3. Because depot_tools expects `python` to be `python2` (shame!), python2 must come
before python3 in your path.
for x in sorted(set(desc["defines"])): try:
(k, v) = x.split("=", 1) if v.startswith('"'):
v = f"'{v}'" else:
v = f'"{v}"' except ValueError:
(k, v) = (x, "True")
line = f'DEFINES["{k}"] = {v}' try: if REGISTERED_DEFINES[k] == False:
line = "# " + line except KeyError:
print(f"[{name}] Unrecognized define: {k}")
line = "# Unrecognized: " + line
lines.append(line)
lines.append("")
def fixup_paths(listt): for x in set(listt): assert x.startswith("//"), x yield"../../checkout/" + x[2:]
sources_by_config: Dict[str, List[str]] = {}
extras: Dict[str, str] = dict() for x in fixup_paths(flat["sources"]): # print(' '*5, x)
(b, e) = x.rsplit(".", 1) if e in ["h", "hpp", "y", "l", "inc", "inl"]: continue elif e in ["cpp", "cc", "c"]: if b.endswith("_win") or b.endswith("_win32"):
config = 'CONFIG["OS_ARCH"] == "WINNT"' elif b.endswith("_linux"): # Include these on BSDs too.
config = 'CONFIG["OS_ARCH"] not in ("Darwin", "WINNT")' elif b.endswith("_apple") or b.endswith("_mac"):
config = 'CONFIG["OS_ARCH"] == "Darwin"' elif b.endswith("_posix"):
config = 'CONFIG["OS_ARCH"] != "WINNT"' else:
config = ""# None can't compare against str.
ldflags = set(desc["ldflags"])
DEF_PREFIX = "/DEF:" for x in set(ldflags): if x.startswith(DEF_PREFIX):
def_path = x[len(DEF_PREFIX) :]
required_files.add(def_path) assert"DEFFILE"notin extras
ldflags.remove(x)
for config, v in sorted_items(sources_by_config):
indent = 0 if config:
lines.append("if {}:".format(config))
indent = 1
append_arr(lines, "SOURCES", v, indent=indent)
dep_libs: Set[str] = set() for dep_full_name in set(flat["dep_libs"]): assert dep_full_name.startswith("//"), dep_name
(_, dep_name) = dep_full_name.split(":")
dep_libs.add(dep_name)
dep_dirs = set(dep_libs)
dep_dirs.discard("zlib")
# Those directories are added by gfx/angle/moz.build.
already_added_dirs = [ "angle_common", "translator", "libEGL", "libGLESv2",
]
append_arr(lines, "USE_LIBS", dep_libs)
append_arr(
lines, "DIRS", ["../" + x for x in dep_dirs if x notin already_added_dirs]
)
append_arr(lines, "OS_LIBS", os_libs)
append_arr_commented(lines, "LDFLAGS", ldflags)
for k, v in sorted(extras.items()):
lines.append("{} = {}".format(k, v))
mozbuild = target_dir / "moz.build"
print(" ", " ", f"Writing {mozbuild}")
data = b"\n".join((x.encode() for x in lines))
mozbuild.write_bytes(data)
return required_files
# -
for target_name in libraries:
reqs = export_target(target_name)
required_files |= reqs
# Copy all the files
print("\nMigrate required files")
i = 0 for x in required_files:
i += 1
sys.stdout.write(f"\r Copying {i}/{len(required_files)}")
sys.stdout.flush() assert x.startswith("//"), x
x = x[2:]
src = REPO_DIR / x
dest = checkout_dir / x
dest.parent.mkdir(parents=True, exist_ok=True)
data = src.read_bytes()
data = data.replace(b"\r\n", b"\n")
dest.write_bytes(data)
print("\n\nDone")
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.