ci: Add chromium build

closes #80
This commit is contained in:
Juan Ramos 2023-09-20 14:25:13 -06:00 committed by Juan Ramos
parent 918633e904
commit 75092473f3
9 changed files with 217 additions and 2 deletions

View file

@ -76,4 +76,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: REUSE Compliance Check - name: REUSE Compliance Check
uses: fsfe/reuse-action@v1 uses: fsfe/reuse-action@v1
# Test to ensure we don't accidentally break the Chromium build.
chromium:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install WSI dependencies
run: sudo apt-get -qq update && sudo apt-get install -y libwayland-dev xorg-dev
- name: Test chromium build
run: python scripts/gn/gn.py

15
.gitignore vendored
View file

@ -9,4 +9,17 @@ __pycache__
build build
.vscode/ .vscode/
**/.*.swp **/.*.swp
external external
# Chromium build artifacts
.cipd/
.gn
.gclient
.gclient_entries
.gclient_previous_sync_commits
out/
third_party/
buildtools/
depot_tools/
testing/
tools/

70
scripts/gn/DEPS Normal file
View file

@ -0,0 +1,70 @@
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
# This file is subset of DEPS file from https://chromium.googlesource.com/angle/angle
gclient_gn_args_file = 'build/config/gclient_args.gni'
vars = {
'chromium_git': 'https://chromium.googlesource.com',
'ninja_version': 'version:2@1.11.1.chromium.6',
}
deps = {
'build': {
'url': '{chromium_git}/chromium/src/build.git@1015724d82945f9ef7e51c6f804034ccf5f79951',
},
'buildtools': {
'url': '{chromium_git}/chromium/src/buildtools.git@3c7e3f1b8b1e4c0b6ec693430379cea682de78d6',
},
'buildtools/linux64': {
'packages': [
{
'package': 'gn/gn/linux-${{arch}}',
'version': 'git_revision:5e19d2fb166fbd4f6f32147fbb2f497091a54ad8',
}
],
'dep_type': 'cipd',
'condition': 'host_os == "linux"',
},
'testing': {
'url': '{chromium_git}/chromium/src/testing@949b2864b6bd27656753b917c9aa7731dc7a06f6',
},
'tools/clang': {
'url': '{chromium_git}/chromium/src/tools/clang.git@566877f1ff1a5fa6beaca3ab4b47bd0b92eb614f',
},
'third_party/ninja': {
'packages': [
{
'package': 'infra/3pp/tools/ninja/${{platform}}',
'version': Var('ninja_version'),
}
],
'dep_type': 'cipd',
},
}
hooks = [
{
'name': 'sysroot_x64',
'pattern': '.',
'condition': 'checkout_linux and checkout_x64',
'action': ['python3', 'build/linux/sysroot_scripts/install-sysroot.py',
'--arch=x64'],
},
{
'name': 'clang',
'pattern': '.',
'action': ['python3', 'tools/clang/scripts/update.py'],
},
]

56
scripts/gn/gn.py Normal file
View file

@ -0,0 +1,56 @@
#!/usr/bin/env python3
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
import os
import subprocess
import sys
# helper to define paths relative to the repo root
def RepoRelative(path):
return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../', path))
def BuildGn():
if not os.path.exists(RepoRelative("depot_tools")):
print("Cloning Chromium depot_tools\n", flush=True)
clone_cmd = 'git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools'.split(" ")
subprocess.call(clone_cmd)
os.environ['PATH'] = os.environ.get('PATH') + ":" + RepoRelative("depot_tools")
print("Updating Repo Dependencies and GN Toolchain\n", flush=True)
update_cmd = './scripts/gn/update_deps.sh'
subprocess.call(update_cmd)
print("Checking Header Dependencies\n", flush=True)
gn_check_cmd = 'gn gen --check out/Debug'.split(" ")
subprocess.call(gn_check_cmd)
print("Generating Ninja Files\n", flush=True)
gn_gen_cmd = 'gn gen out/Debug'.split(" ")
subprocess.call(gn_gen_cmd)
print("Running Ninja Build\n", flush=True)
ninja_build_cmd = 'ninja -C out/Debug'.split(" ")
subprocess.call(ninja_build_cmd)
#
# Module Entrypoint
def main():
try:
BuildGn()
except subprocess.CalledProcessError as proc_error:
print('Command "%s" failed with return code %s' % (' '.join(proc_error.cmd), proc_error.returncode))
sys.exit(proc_error.returncode)
except Exception as unknown_error:
print('An unkown error occured: %s', unknown_error)
sys.exit(1)
sys.exit(0)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,10 @@
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
build_with_chromium = false
ignore_elf32_limitations = true
linux_use_bundled_binutils_override = false
use_system_xcode = true

View file

@ -0,0 +1,7 @@
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
vulkan_use_x11 = true

View file

@ -0,0 +1,7 @@
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
vulkan_headers_dir = "//external/Vulkan-Headers"

39
scripts/gn/update_deps.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/sh
# Copyright 2023 The Khronos Group Inc.
# Copyright 2023 Valve Corporation
# Copyright 2023 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Execute at repo root
cd "$(dirname $0)/../../"
# Use update_deps.py to update source dependencies from /scripts/known_good.json
scripts/update_deps.py --dir="external" --no-build
cat << EOF > .gn
buildconfig = "//build/config/BUILDCONFIG.gn"
secondary_source = "//scripts/gn/secondary/"
default_args = {
clang_use_chrome_plugins = false
use_custom_libcxx = false
}
EOF
# Use gclient to update toolchain dependencies from /scripts/gn/DEPS (from chromium)
cat << EOF > .gclient
solutions = [
{ "name" : ".",
"url" : "https://github.com/KhronosGroup/Vulkan-Utility-Libraries",
"deps_file" : "scripts/gn/DEPS",
"managed" : False,
"custom_deps" : {
},
"custom_vars": {},
},
]
EOF
gclient sync

0
scripts/update_deps.py Normal file → Executable file
View file