diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /build/macosx | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/macosx')
-rw-r--r-- | build/macosx/catalog.py | 123 | ||||
-rw-r--r-- | build/macosx/cross-mozconfig.common | 32 | ||||
-rw-r--r-- | build/macosx/mozconfig.common | 8 | ||||
-rw-r--r-- | build/macosx/permissions/chown_revert.c | 18 | ||||
-rw-r--r-- | build/macosx/permissions/chown_root.c | 12 |
5 files changed, 193 insertions, 0 deletions
diff --git a/build/macosx/catalog.py b/build/macosx/catalog.py new file mode 100644 index 0000000000..e3d937ffaf --- /dev/null +++ b/build/macosx/catalog.py @@ -0,0 +1,123 @@ +# 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/. + +import argparse +import plistlib +import ssl +import sys +from io import BytesIO +from urllib.request import urlopen +from xml.dom import minidom + +import certifi +from mozpack.macpkg import Pbzx, uncpio, unxar + + +def get_english(dict, default=None): + english = dict.get("English") + if english is None: + english = dict.get("en", default) + return english + + +def get_content_at(url): + ssl_context = ssl.create_default_context(cafile=certifi.where()) + f = urlopen(url, context=ssl_context) + return f.read() + + +def get_plist_at(url): + return plistlib.loads(get_content_at(url)) + + +def show_package_content(url, digest=None, size=None): + package = get_content_at(url) + if size is not None and len(package) != size: + print(f"Package does not match size given in catalog: {url}", file=sys.stderr) + sys.exit(1) + # Ideally we'd check the digest, but it's not md5, sha1 or sha256... + # if digest is not None and hashlib.???(package).hexdigest() != digest: + # print(f"Package does not match digest given in catalog: {url}", file=sys.stderr) + # sys.exit(1) + for name, content in unxar(BytesIO(package)): + if name == "Payload": + for path, _, __ in uncpio(Pbzx(content)): + if path: + print(path.decode("utf-8")) + + +def show_product_info(product, package_id=None): + # An alternative here would be to look at the MetadataURLs in + # product["Packages"], but going with Distributions allows to + # only do one request. + dist = get_english(product.get("Distributions")) + data = get_content_at(dist) + dom = minidom.parseString(data.decode("utf-8")) + for pkg_ref in dom.getElementsByTagName("pkg-ref"): + if pkg_ref.childNodes: + if pkg_ref.hasAttribute("packageIdentifier"): + id = pkg_ref.attributes["packageIdentifier"].value + else: + id = pkg_ref.attributes["id"].value + + if package_id and package_id != id: + continue + + for child in pkg_ref.childNodes: + if child.nodeType != minidom.Node.TEXT_NODE: + continue + for p in product["Packages"]: + if p["URL"].endswith("/" + child.data): + if package_id: + show_package_content( + p["URL"], p.get("Digest"), p.get("Size") + ) + else: + print(id, p["URL"]) + + +def show_products(products, filter=None): + for key, product in products.items(): + metadata_url = product.get("ServerMetadataURL", "") + if metadata_url and (not filter or filter in metadata_url): + metadata = get_plist_at(metadata_url) + localization = get_english(metadata.get("localization", {}), {}) + title = localization.get("title", None) + version = metadata.get("CFBundleShortVersionString", None) + print(key, title, version) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + "--catalog", + help="URL of the catalog", + default="https://swscan.apple.com/content/catalogs/others/index-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog", + ) + parser.add_argument( + "--filter", help="Only show entries with metadata url matching the filter" + ) + parser.add_argument( + "what", nargs="?", help="Show packages information about the given entry" + ) + args = parser.parse_args() + + data = get_plist_at(args.catalog) + products = data["Products"] + + if args.what: + if args.filter: + print( + "Cannot use --filter when showing verbose information about an entry", + file=sys.stderr, + ) + sys.exit(1) + product_id, _, package_id = args.what.partition("/") + show_product_info(products[product_id], package_id) + else: + show_products(products, args.filter) + + +if __name__ == "__main__": + main() diff --git a/build/macosx/cross-mozconfig.common b/build/macosx/cross-mozconfig.common new file mode 100644 index 0000000000..cf087ee771 --- /dev/null +++ b/build/macosx/cross-mozconfig.common @@ -0,0 +1,32 @@ +# 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/. + +. "$topsrcdir/build/mozconfig.common" + +# cctools for ld, ar, and other related tools ; dsymutil for rust. +mk_add_options "export PATH=$MOZ_FETCHES_DIR/cctools/bin:$MOZ_FETCHES_DIR/binutils/bin:$MOZ_FETCHES_DIR/clang/bin:$PATH" + +# dsymutil needs a libstdc++ more recent than what's on the system. +mk_add_options "export LD_LIBRARY_PATH=$MOZ_FETCHES_DIR/clang/lib" + +export CFLAGS="$CFLAGS -fcrash-diagnostics-dir=${UPLOAD_PATH}" +export CXXFLAGS="$CXXFLAGS -fcrash-diagnostics-dir=${UPLOAD_PATH}" +export MKFSHFS=$MOZ_FETCHES_DIR/hfsplus/newfs_hfs +export DMG_TOOL=$MOZ_FETCHES_DIR/dmg/dmg +export HFS_TOOL=$MOZ_FETCHES_DIR/dmg/hfsplus + +export HOST_CFLAGS="-g" +export HOST_CXXFLAGS="-g" +export HOST_LDFLAGS="-g" + +ac_add_options --target=x86_64-apple-darwin + +if [ "x$MOZ_PKG_SPECIAL" != "xasan" -a -z "$MOZ_AUTOMATION_ARTIFACT_BUILDS" ]; then + # Enable static analysis checks by default on OSX cross builds. + # Exception is ASan, where this breaks. + # The option is not valid on artifact builds, so don't add it there either. + ac_add_options --enable-clang-plugin +fi + +unset MOZ_STDCXX_COMPAT diff --git a/build/macosx/mozconfig.common b/build/macosx/mozconfig.common new file mode 100644 index 0000000000..8e20aac1dd --- /dev/null +++ b/build/macosx/mozconfig.common @@ -0,0 +1,8 @@ +if test `uname -s` = Linux; then + . $topsrcdir/build/macosx/cross-mozconfig.common +fi + +if [ -n "$TASKCLUSTER_PGO_PROFILE_USE" -a -z "$USE_ARTIFACT" ]; then + # Keep using ld64 on PGO/LTO builds because of performance regressions when using lld. + ac_add_options --enable-linker=ld64 +fi diff --git a/build/macosx/permissions/chown_revert.c b/build/macosx/permissions/chown_revert.c new file mode 100644 index 0000000000..72dc1e64d5 --- /dev/null +++ b/build/macosx/permissions/chown_revert.c @@ -0,0 +1,18 @@ +/* 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/. */ + +#include <unistd.h> +#include <stdio.h> + +int main(int argc, char** argv) { + if (argc != 2) return 1; + + uid_t realuser = getuid(); + char uidstring[20]; + snprintf(uidstring, 19, "%i", realuser); + uidstring[19] = '\0'; + + return execl("/usr/sbin/chown", "/usr/sbin/chown", "-R", "-h", uidstring, + argv[1], (char*)0); +} diff --git a/build/macosx/permissions/chown_root.c b/build/macosx/permissions/chown_root.c new file mode 100644 index 0000000000..e2ef111c7f --- /dev/null +++ b/build/macosx/permissions/chown_root.c @@ -0,0 +1,12 @@ +/* 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/. */ + +#include <unistd.h> + +int main(int argc, char** argv) { + if (argc != 2) return 1; + + return execl("/usr/sbin/chown", "/usr/sbin/chown", "-R", "-h", "root:admin", + argv[1], (char*)0); +} |