Bug 1680185 - Add openh264 builds for Apple silicon mac. r=firefox-build-system-reviewers,mhentges

Differential Revision: https://phabricator.services.mozilla.com/D98427
This commit is contained in:
Mike Hommey 2020-12-02 22:26:03 +00:00
Родитель 8d18757970
Коммит fba6ec43e7
3 изменённых файлов: 81 добавлений и 13 удалений

Просмотреть файл

@ -97,6 +97,30 @@ jobs:
- linux64-cctools-port
- linux64-clang
- linux64-dump-syms
macosx64-aarch64/opt:
attributes:
build_platform: macosx64-aarch64
build_type: opt
treeherder:
platform: macosx64-aarch64/opt
worker-type: b-linux
worker:
max-run-time: 1800
artifacts:
- name: private/openh264
path: /builds/worker/workspace/openh264/artifacts
type: directory
run:
using: mozharness
script: mozharness/scripts/openh264_build.py
config:
- openh264/macosx64-aarch64.py
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang
- linux64-dump-syms
- macosx64-sdk-11.0
win32/opt:
attributes:
build_platform: win32

Просмотреть файл

@ -0,0 +1,42 @@
# 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 os
import mozharness
external_tools_path = os.path.join(
os.path.abspath(os.path.dirname(os.path.dirname(mozharness.__file__))),
"external_tools",
)
config = {
"exes": {
"gittool.py": [os.path.join(external_tools_path, "gittool.py")],
"python2.7": "python2.7",
},
"dump_syms_binary": "{}/dump_syms/dump_syms".format(os.environ["MOZ_FETCHES_DIR"]),
"arch": "aarch64",
"use_yasm": True,
"operating_system": "darwin",
"partial_env": {
"CFLAGS": (
"-target aarch64-apple-darwin -mcpu=apple-a12 "
"-isysroot {MOZ_FETCHES_DIR}/MacOSX11.0.sdk".format(
MOZ_FETCHES_DIR=os.environ["MOZ_FETCHES_DIR"]
)
),
"LDFLAGS": (
"-target aarch64-apple-darwin -mcpu=apple-a12 "
"-isysroot {MOZ_FETCHES_DIR}/MacOSX11.0.sdk".format(
MOZ_FETCHES_DIR=os.environ["MOZ_FETCHES_DIR"]
)
),
"PATH": (
"{MOZ_FETCHES_DIR}/clang/bin/:{MOZ_FETCHES_DIR}/cctools/bin/:%(PATH)s".format(
MOZ_FETCHES_DIR=os.environ["MOZ_FETCHES_DIR"]
)
),
},
}

Просмотреть файл

@ -177,7 +177,7 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin):
self.error("missing a required key.")
def query_package_name(self):
if self.config["arch"] == "x64":
if self.config["arch"] in ("x64", "aarch64"):
bits = "64"
else:
bits = "32"
@ -189,8 +189,11 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin):
version=version, arch=self.config["arch"]
)
elif self.config.get("operating_system") == "darwin":
return "openh264-macosx{bits}-{version}.zip".format(
version=version, bits=bits
suffix = ""
if self.config["arch"] != "x64":
suffix = "-" + self.config["arch"]
return "openh264-macosx{bits}{suffix}-{version}.zip".format(
version=version, bits=bits, suffix=suffix
)
else:
return "openh264-linux{bits}-{version}.zip".format(
@ -218,15 +221,18 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin):
else:
retval.append("ENABLE64BIT=No")
if self.config["arch"] == "x86":
retval.append("ARCH=x86")
elif self.config["arch"] == "x64":
retval.append("ARCH=x86_64")
elif self.config["arch"] == "aarch64":
retval.append("ARCH=arm64")
else:
self.fatal("Unknown arch: {}".format(self.config["arch"]))
if "operating_system" in self.config:
retval.append("OS=%s" % self.config["operating_system"])
if self.config["operating_system"] == "android":
if self.config["arch"] == "x86":
retval.append("ARCH=x86")
elif self.config["arch"] == "aarch64":
retval.append("ARCH=arm64")
else:
retval.append("ARCH=arm")
retval.append("TARGET=invalid")
retval.append("NDKLEVEL=%s" % self.config["min_sdk"])
retval.append("NDKROOT=%s/android-ndk" % os.environ["MOZ_FETCHES_DIR"])
@ -242,14 +248,10 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin):
retval.append("CC=clang-cl")
retval.append("CXX=clang-cl")
if self.config["arch"] == "x86":
retval.append("ARCH=x86")
retval.append("CFLAGS=-m32")
elif self.config["arch"] == "aarch64":
retval.append("ARCH=arm64")
retval.append("CFLAGS=--target=aarch64-windows-msvc")
retval.append("CXX_LINK_O=-nologo --target=aarch64-windows-msvc -Fe$@")
else:
retval.append("ARCH=x86_64")
else:
retval.append("CC=clang")
retval.append("CXX=clang++")