From 227713d4525724e18ba1a6f0f145722c8960b88d Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Wed, 6 Mar 2019 17:12:40 +0000 Subject: [PATCH] Bug 1515210 - Build openh264 plugin for win64-aarch64; r=Callek Differential Revision: https://phabricator.services.mozilla.com/D21782 --HG-- extra : moz-landing-system : lando --- taskcluster/ci/openh264-plugin/kind.yml | 20 ++++++++ .../tooltool-manifests/win64-aarch64.manifest | 18 ++++++++ .../configs/openh264/win64-aarch64.py | 46 +++++++++++++++++++ testing/mozharness/scripts/openh264_build.py | 33 +++++++++++-- 4 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 testing/mozharness/configs/openh264/tooltool-manifests/win64-aarch64.manifest create mode 100644 testing/mozharness/configs/openh264/win64-aarch64.py diff --git a/taskcluster/ci/openh264-plugin/kind.yml b/taskcluster/ci/openh264-plugin/kind.yml index 23e12c71ddee..a434ad2c6caa 100644 --- a/taskcluster/ci/openh264-plugin/kind.yml +++ b/taskcluster/ci/openh264-plugin/kind.yml @@ -130,6 +130,26 @@ jobs: - openh264/win64.py toolchains: - win64-clang-cl + win64-aarch64/opt: + attributes: + build_platform: windows2012-aarch64 + build_type: opt + treeherder: + platform: win64-aarch64/opt + worker-type: aws-provisioner-v1/gecko-{level}-b-win2012 + worker: + max-run-time: 1800 + artifacts: + - name: private/openh264 + path: build/openh264/artifacts + type: directory + run: + using: mozharness + script: mozharness/scripts/openh264_build.py + config: + - openh264/win64-aarch64.py + toolchains: + - win64-clang-cl android-api-16/opt: attributes: build_platform: android-arm diff --git a/testing/mozharness/configs/openh264/tooltool-manifests/win64-aarch64.manifest b/testing/mozharness/configs/openh264/tooltool-manifests/win64-aarch64.manifest new file mode 100644 index 000000000000..0502193a1a8d --- /dev/null +++ b/testing/mozharness/configs/openh264/tooltool-manifests/win64-aarch64.manifest @@ -0,0 +1,18 @@ +[ + { + "size": 56832, + "visibility": "public", + "digest": "01e6bd936ef008061b95a94008682869ebf2a29d1c035e49cd6579b1a020d0d195431221577f127eb52b97137337efe30e6de6c5a2f4b6a87ff2a990e9874e8e", + "algorithm": "sha512", + "filename": "dump_syms.exe" + }, + { + "version": "Visual Studio 2017 15.9.6 / SDK 10.0.17134.0", + "size": 490015895, + "visibility": "internal", + "digest": "91d08703a8ce39f6f53ccecc7c7b6f57e1b571ddb5d1eb4dd9260e52580566c35a4bed39ad366fd60ca60ebf5c06f0f00561bba5cd631826511f2872a3d2dcd5", + "algorithm": "sha512", + "filename": "vs2017_15.9.6.zip", + "unpack": true + } +] diff --git a/testing/mozharness/configs/openh264/win64-aarch64.py b/testing/mozharness/configs/openh264/win64-aarch64.py new file mode 100644 index 000000000000..f4ce087b9b29 --- /dev/null +++ b/testing/mozharness/configs/openh264/win64-aarch64.py @@ -0,0 +1,46 @@ +import sys +import os + +import mozharness + +external_tools_path = os.path.join( + os.path.abspath(os.path.dirname(os.path.dirname(mozharness.__file__))), + 'external_tools', +) + +VSPATH = '%(abs_work_dir)s\\src\\vs2017_15.9.6' +config = { + 'tooltool_manifest_file': 'win64-aarch64.manifest', + 'exes': { + 'gittool.py': [sys.executable, os.path.join(external_tools_path, 'gittool.py')], + 'python2.7': 'c:\\mozilla-build\\python\\python.exe', + }, + 'dump_syms_binary': 'dump_syms.exe', + 'arch': 'aarch64', + 'use_yasm': False, + 'partial_env': { + 'PATH': ('%(abs_work_dir)s\\openh264;' + '%(abs_work_dir)s\\src\\clang\\bin\\;' + '{_VSPATH}\\VC\\bin\\Hostx64\\arm64;' + '{_VSPATH}\\VC\\bin\\Hostx64\\x64;' + # 32-bit redist here for our dump_syms.exe + '{_VSPATH}/VC/redist/x86/Microsoft.VC141.CRT;' + '{_VSPATH}/SDK/Redist/ucrt/DLLs/x86;' + '{_VSPATH}/DIA SDK/bin;%(PATH)s;' + ).format(_VSPATH=VSPATH), + 'INCLUDES': ( + '-I{_VSPATH}\\VC\\include ' + '-I{_VSPATH}\\VC\\atlmfc\\include ' + '-I{_VSPATH}\\SDK\\Include\\10.0.17134.0\\ucrt ' + '-I{_VSPATH}\\SDK\\Include\\10.0.17134.0\\shared ' + '-I{_VSPATH}\\SDK\\Include\\10.0.17134.0\\um ' + '-I{_VSPATH}\\SDK\\Include\\10.0.17134.0\\winrt ' + ).format(_VSPATH=VSPATH), + 'LIB': ( + '{_VSPATH}/VC/lib/arm64;' + '{_VSPATH}/VC/atlmfc/lib/arm64;' + '{_VSPATH}/SDK/lib/10.0.17134.0/ucrt/arm64;' + '{_VSPATH}/SDK/lib/10.0.17134.0/um/arm64;' + ).format(_VSPATH=VSPATH), + }, +} diff --git a/testing/mozharness/scripts/openh264_build.py b/testing/mozharness/scripts/openh264_build.py index a6be9891c548..3e2af4d52770 100755 --- a/testing/mozharness/scripts/openh264_build.py +++ b/testing/mozharness/scripts/openh264_build.py @@ -149,7 +149,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'] == 'x64': bits = '64' else: bits = '32' @@ -164,10 +164,13 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin): version=version, bits=bits) else: return 'openh264-linux{bits}-{version}.zip'.format(version=version, bits=bits) - elif sys.platform == 'darwin': - return 'openh264-macosx{bits}-{version}.zip'.format(version=version, bits=bits) elif sys.platform == 'win32': - return 'openh264-win{bits}-{version}.zip'.format(version=version, bits=bits) + if self.config['arch'] == 'aarch64': + return 'openh264-win64-aarch64-{version}.zip'.format( + version=version) + else: + return 'openh264-win{bits}-{version}.zip'.format( + version=version, bits=bits) self.fatal("can't determine platform") def query_make_params(self): @@ -210,6 +213,10 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin): 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: @@ -263,6 +270,24 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin): self.copytree(os.path.join(dirs['abs_work_dir'], 'src', 'dom', 'media', 'gmp', 'gmp-api'), os.path.join(repo_dir, 'gmp-api')) + + # We need gas-preprocessor.pl for arm64 builds + if self.config['arch'] == 'aarch64': + openh264_dir = os.path.join(dirs['abs_work_dir'], 'openh264') + self.download_file(('https://raw.githubusercontent.com/libav/' + 'gas-preprocessor/c2bc63c96678d9739509e58' + '7aa30c94bdc0e636d/gas-preprocessor.pl'), + parent_dir=openh264_dir) + self.chmod(os.path.join(openh264_dir, 'gas-preprocessor.pl'), + 744) + + # gas-preprocessor.pl expects cpp to exist + # os.symlink is not available on Windows until we switch to + # Python 3. + os.system('ln -s %s %s' % ( + os.path.join(dirs['abs_work_dir'], 'src', 'clang', + 'bin', 'clang.exe'), + os.path.join(openh264_dir, 'cpp'))) return 0 repos = [