summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/vk-gl-cts
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2024-12-09 17:26:26 +0000
committerKhem Raj <raj.khem@gmail.com>2024-12-10 08:39:05 -0800
commitaa8aecacce81970f48f8cf9fdbc17b168f1e0166 (patch)
tree4a47cccf7ac3c9d61613f99c2891bb57e91b32af /meta-oe/recipes-graphics/vk-gl-cts
parent7be0fe192d8eee5e4853d26de4dddd20c92c12c1 (diff)
downloadmeta-openembedded-aa8aecacce81970f48f8cf9fdbc17b168f1e0166.tar.gz
vk-gl-cts: don't require networking to configure
The CMakeLists in this package go and download a number of packages at configure time, which is bad practise for us. Instead, use a script to parse the fetching tool and generate SRC_URI fragments that can be included in the recipe. This refresh_srcuri task will need to be reran on upgrades to ensure that it is up to date: the fragment will warn if the version doesn't match and devtool will do that automatically. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-graphics/vk-gl-cts')
-rwxr-xr-xmeta-oe/recipes-graphics/vk-gl-cts/files/generate-srcuri.py131
-rw-r--r--meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc54
-rw-r--r--meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts-sources.inc23
-rw-r--r--meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts_3.2.11.0.bb15
-rw-r--r--meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts-sources.inc23
-rw-r--r--meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts_1.3.9.2.bb14
6 files changed, 205 insertions, 55 deletions
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/files/generate-srcuri.py b/meta-oe/recipes-graphics/vk-gl-cts/files/generate-srcuri.py
new file mode 100755
index 0000000000..c2756b592c
--- /dev/null
+++ b/meta-oe/recipes-graphics/vk-gl-cts/files/generate-srcuri.py
@@ -0,0 +1,131 @@
1#! /usr/bin/env python3
2
3import json
4import re
5import os
6import subprocess
7import sys
8import types
9import urllib.parse
10
11
12def resolve_commit(repo, ref):
13 # If it looks like a SHA, just return that
14 if re.match(r"[a-z0-9]{40}", ref):
15 return ref
16
17 # Otherwise it's probably a tag name so resolve it
18 cmd = ("git", "ls-remote", "--tags", "--exit-code", repo, ref)
19 ret = subprocess.run(cmd, check=True, text=True, capture_output=True)
20 sha = ret.stdout.split(maxsplit=1)[0]
21 assert len(sha) == 40
22 return sha
23
24
25def transform_git(repo_url, repo_ref, destination):
26 parts = urllib.parse.urlparse(repo_url)
27 protocol = parts.scheme
28 parts = parts._replace(scheme="git")
29 url = urllib.parse.urlunparse(parts)
30 # Resolve the commit reference to a SHA
31 sha = resolve_commit(repo_url, repo_ref)
32
33 return url + f";protocol={protocol};nobranch=1;destsuffix={destination};rev={sha}"
34
35
36def load_module(filename):
37 import importlib.util
38
39 spec = importlib.util.spec_from_file_location("fetchmodule", filename)
40 module = importlib.util.module_from_spec(spec)
41 spec.loader.exec_module(module)
42 return module
43
44
45def convert_fetch(basedir):
46 """
47 Convert the external/fetch_sources.py data
48 """
49 fetch = load_module(os.path.join(basedir, "fetch_sources.py"))
50 lines = []
51 for p in fetch.PACKAGES:
52 if isinstance(p, fetch.SourcePackage):
53 # Ignore these as so far we can use the system copies
54 pass
55 elif isinstance(p, fetch.SourceFile):
56 dest = "/".join(["git/external", p.baseDir, p.extractDir])
57 url = f"{p.url};subdir={dest};sha256sum={p.checksum}"
58 lines.append(f" {url} \\")
59 elif isinstance(p, fetch.GitRepo):
60 dest = "/".join(["git/external", p.baseDir, p.extractDir])
61 url = transform_git(p.httpsUrl, p.revision, dest)
62 lines.append(f" {url} \\")
63 else:
64 assert f"Unexpected {p=}"
65 return lines
66
67
68def convert_knowngood(basedir, destination):
69 """
70 Convert the """
71 filename = os.path.join(basedir, "vulkan-validationlayers/src/scripts/known_good.json")
72 try:
73 with open(filename) as fp:
74 data = json.load(fp, object_hook=lambda x: types.SimpleNamespace(**x))
75 except FileNotFoundError:
76 return []
77
78 lines = []
79 for repo in data.repos:
80 # Skip repositories that are not needed on Linux (TODO: assumes linux target)
81 if hasattr(repo, "build_platforms") and repo.build_platforms != "linux":
82 continue
83
84 # Switch the URL to use git: and save the original protocol
85 parts = urllib.parse.urlparse(repo.url)
86 protocol = parts.scheme
87 parts = parts._replace(scheme="git")
88 url = urllib.parse.urlunparse(parts)
89 # Resolve the commit reference to a SHA
90 sha = resolve_commit(repo.url, repo.commit)
91
92 destsuffix = destination + "/" + repo.sub_dir
93
94 url += f";protocol={protocol};nobranch=1;destsuffix={destsuffix};rev={sha}"
95 lines.append(f" {url} \\")
96 return lines
97
98
99def main():
100 pv = sys.argv[1]
101 basedir = sys.argv[2]
102
103 print("""
104#
105# Generated by generate-srcuri.py, don't update manually")
106#
107
108RECIPE_UPGRADE_EXTRA_TASKS += "do_refresh_srcuri"
109
110python __anonymous() {
111 if d.getVar("PV") != "%s":
112 bb.warn("-sources.inc out of date, run refresh_srcuri task")
113}
114""" % (pv))
115
116 print('SRC_URI += " \\')
117 lines = convert_fetch(basedir)
118 print("\n".join(lines))
119 print('"')
120
121 #lines = convert_knowngood(sys.argv[1], "git/external/validation")
122 #if lines:
123 # print('SRC_URI += " \\')
124 # print("\n".join(lines))
125 # print('"')
126 #else:
127 # print("# Re-run")
128
129
130if __name__ == "__main__":
131 main()
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc b/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc
index 0b347cf77e..02af1c6ed0 100644
--- a/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc
+++ b/meta-oe/recipes-graphics/vk-gl-cts/khronos-cts.inc
@@ -1,21 +1,16 @@
1LICENSE = "Apache-2.0" 1LICENSE = "Apache-2.0"
2LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" 2LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
3 3
4SRC_URI = "\ 4SRC_URI = "git://github.com/KhronosGroup/VK-GL-CTS.git;protocol=https;name=vk-gl-cts;nobranch=1 \
5 git://github.com/KhronosGroup/VK-GL-CTS.git;protocol=https;name=vk-gl-cts;nobranch=1 \ 5 file://0001-cmake-Define-WAYLAND_SCANNER-and-WAYLAND_PROTOCOLS_D.patch \
6 git://github.com/google/amber;protocol=https;destsuffix=git/external/amber/src;name=amber;nobranch=1 \ 6 file://0001-use-library-sonames-for-linking.patch \
7 git://github.com/KhronosGroup/glslang.git;protocol=https;destsuffix=git/external/glslang/src;name=glslang;nobranch=1 \ 7 file://generate-srcuri.py \
8 git://github.com/KhronosGroup/SPIRV-Headers.git;protocol=https;destsuffix=git/external/spirv-headers/src;name=spirv-headers;nobranch=1 \ 8 "
9 git://github.com/KhronosGroup/SPIRV-Tools.git;protocol=https;destsuffix=git/external/spirv-tools/src;name=spirv-tools;nobranch=1 \ 9
10 git://github.com/open-source-parsers/jsoncpp.git;protocol=https;destsuffix=git/external/jsoncpp/src;name=jsoncpp;nobranch=1 \ 10SRC_URI:append:libc-musl = "file://fix-musl.patch"
11 git://github.com/KhronosGroup/Vulkan-Docs.git;protocol=https;destsuffix=git/external/vulkan-docs/src;name=vulkan-docs;nobranch=1 \ 11SRC_URI:append:toolchain-clang = "file://fix-clang-private-operator.patch"
12 git://github.com/KhronosGroup/Vulkan-ValidationLayers.git;protocol=https;destsuffix=git/external/vulkan-validationlayers/src;name=vulkan-validationlayers;nobranch=1 \ 12
13 git://github.com/Igalia/ESExtractor.git;protocol=https;destsuffix=git/external/ESExtractor/src;name=ESExtractor;nobranch=1 \ 13SRCREV_FORMAT = "vk-gl-cts"
14 git://github.com/Igalia/vk_video_samples.git;protocol=https;destsuffix=git/external/nvidia-video-samples/src;name=video-parser;nobranch=1 \
15 https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h;subdir=git/external/renderdoc/src;name=renderdoc \
16"
17
18SRCREV_FORMAT = "vk-gl-cts_amber_glslang_spirv-headers_spirv-tools_jsoncpp_video-parser_vulkan-docs_vulkan-validationlayers"
19 14
20S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
21 16
@@ -26,22 +21,10 @@ UPSTREAM_CHECK_GITTAGREGEX = "${BPN}-(?P<pver>\d+(\.\d+)+)"
26ANY_OF_DISTRO_FEATURES += "opengl vulkan" 21ANY_OF_DISTRO_FEATURES += "opengl vulkan"
27 22
28DEPENDS += "python3-lxml-native libpng zlib virtual/libgles2 qemu-native" 23DEPENDS += "python3-lxml-native libpng zlib virtual/libgles2 qemu-native"
29
30SRC_URI += " \
31 file://0001-cmake-Define-WAYLAND_SCANNER-and-WAYLAND_PROTOCOLS_D.patch \
32 file://0001-use-library-sonames-for-linking.patch \
33"
34
35SRC_URI:append:libc-musl = "\
36 file://fix-musl.patch \
37"
38DEPENDS:append:libc-musl = " libexecinfo" 24DEPENDS:append:libc-musl = " libexecinfo"
39 25
40SRC_URI:append:toolchain-clang = "\
41 file://fix-clang-private-operator.patch \
42"
43
44EXTRA_OECMAKE += "-DAMBER_DISABLE_WERROR=ON \ 26EXTRA_OECMAKE += "-DAMBER_DISABLE_WERROR=ON \
27 -DUPDATE_DEPS_DIR=${S}/external/validation/ \
45 -DWAYLAND_SCANNER=${STAGING_BINDIR_NATIVE}/wayland-scanner \ 28 -DWAYLAND_SCANNER=${STAGING_BINDIR_NATIVE}/wayland-scanner \
46 -DWAYLAND_PROTOCOLS_DIR=${STAGING_DATADIR}/wayland-protocols" 29 -DWAYLAND_PROTOCOLS_DIR=${STAGING_DATADIR}/wayland-protocols"
47 30
@@ -78,6 +61,15 @@ FILES:${PN} += "${CTSDIR}"
78# error: implicit instantiation of undefined template 'std::char_traits<unsigned int>' 61# error: implicit instantiation of undefined template 'std::char_traits<unsigned int>'
79TOOLCHAIN = "gcc" 62TOOLCHAIN = "gcc"
80 63
81# Validation-layers requires access during configure as it fetches validation-headers 64# Prototype task to refresh the generated SRC_URI entries by parsing
82# and bunch of other packages from khronos github 65# the files in the source tree and writing a BPN-sources.inc file.
83do_configure[network] = "1" 66do_refresh_srcuri() {
67 ${UNPACKDIR}/generate-srcuri.py ${PV} ${S}/external/ \
68 > ${THISDIR}/${BPN}-sources.inc
69 # Don't convert ${S}/external/vulkan-validationlayers/src/scripts/known_good.json as we
70 # currently build without validation
71}
72
73addtask refresh_srcuri after do_patch
74do_refresh_srcuri[network] = "1"
75do_refresh_srcuri[nostamp] = "1"
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts-sources.inc b/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts-sources.inc
new file mode 100644
index 0000000000..9752c2d7d7
--- /dev/null
+++ b/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts-sources.inc
@@ -0,0 +1,23 @@
1
2#
3# Generated by generate-srcuri.py, don't update manually")
4#
5
6RECIPE_UPGRADE_EXTRA_TASKS += "do_refresh_srcuri"
7
8python __anonymous() {
9 if d.getVar("PV") != "3.2.11.0":
10 bb.warn("-sources.inc out of date, run refresh_srcuri task")
11}
12
13SRC_URI += " \
14 https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h;subdir=git/external/renderdoc/src;sha256sum=e7b5f0aa5b1b0eadc63a1c624c0ca7f5af133aa857d6a4271b0ef3d0bdb6868e \
15 git://github.com/KhronosGroup/SPIRV-Tools.git;protocol=https;nobranch=1;destsuffix=git/external/spirv-tools/src;rev=148c97f6876e427efd76d2328122c3075eab4b8f \
16 git://github.com/KhronosGroup/glslang.git;protocol=https;nobranch=1;destsuffix=git/external/glslang/src;rev=4da479aa6afa43e5a2ce4c4148c572a03123faf3 \
17 git://github.com/KhronosGroup/SPIRV-Headers.git;protocol=https;nobranch=1;destsuffix=git/external/spirv-headers/src;rev=ff2afc3afc48dff4eec2a10f0212402a80708e38 \
18 git://github.com/KhronosGroup/Vulkan-Docs.git;protocol=https;nobranch=1;destsuffix=git/external/vulkan-docs/src;rev=ed4ba0242beb89a1795d6084709fa9e713559c94 \
19 git://github.com/KhronosGroup/Vulkan-ValidationLayers.git;protocol=https;nobranch=1;destsuffix=git/external/vulkan-validationlayers/src;rev=f589bc456545fbab97caf49380b102b8aafe1f40 \
20 git://github.com/google/amber.git;protocol=https;nobranch=1;destsuffix=git/external/amber/src;rev=0f003c2785489f59cd01bb2440fcf303149100f2 \
21 git://github.com/open-source-parsers/jsoncpp.git;protocol=https;nobranch=1;destsuffix=git/external/jsoncpp/src;rev=9059f5cad030ba11d37818847443a53918c327b1 \
22 git://github.com/Igalia/vk_video_samples.git;protocol=https;nobranch=1;destsuffix=git/external/nvidia-video-samples/src;rev=6821adf11eb4f84a2168264b954c170d03237699 \
23"
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts_3.2.11.0.bb b/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts_3.2.11.0.bb
index 1a745c6cc1..9d07076951 100644
--- a/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts_3.2.11.0.bb
+++ b/meta-oe/recipes-graphics/vk-gl-cts/opengl-es-cts_3.2.11.0.bb
@@ -1,19 +1,10 @@
1DESCRIPTION = "OpenGL CTS" 1DESCRIPTION = "OpenGL CTS"
2 2
3require khronos-cts.inc 3require khronos-cts.inc
4# opengl-es-cts-3.2.11.0 4
5SRCREV_vk-gl-cts = "66956d195169596472e956e3aebf2df8e3bd960d" 5SRCREV_vk-gl-cts = "66956d195169596472e956e3aebf2df8e3bd960d"
6SRCREV_amber = "0f003c2785489f59cd01bb2440fcf303149100f2" 6
7SRCREV_glslang = "4da479aa6afa43e5a2ce4c4148c572a03123faf3" 7require opengl-es-cts-sources.inc
8SRCREV_spirv-headers = "ff2afc3afc48dff4eec2a10f0212402a80708e38"
9SRCREV_spirv-tools = "148c97f6876e427efd76d2328122c3075eab4b8f"
10SRCREV_ESExtractor = "ce5d7ebcf0ebb0d78385ee4cc34653eb6764bfc4"
11# Not yet needed
12SRCREV_jsoncpp = "9059f5cad030ba11d37818847443a53918c327b1"
13SRCREV_vulkan-docs = "ed4ba0242beb89a1795d6084709fa9e713559c94"
14SRCREV_vulkan-validationlayers = "a92629196a4fed15e59c74aa965dd47bd5ece3b7"
15SRCREV_video-parser = "6821adf11eb4f84a2168264b954c170d03237699"
16SRC_URI[renderdoc.sha256sum] = "e7b5f0aa5b1b0eadc63a1c624c0ca7f5af133aa857d6a4271b0ef3d0bdb6868e"
17 8
18EXTRA_OECMAKE += "-DSELECTED_BUILD_TARGETS="cts-runner deqp-egl deqp-gles2 deqp-gles3 deqp-gles31 deqp-gl-shared de-internal-tests glcts"" 9EXTRA_OECMAKE += "-DSELECTED_BUILD_TARGETS="cts-runner deqp-egl deqp-gles2 deqp-gles3 deqp-gles31 deqp-gl-shared de-internal-tests glcts""
19 10
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts-sources.inc b/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts-sources.inc
new file mode 100644
index 0000000000..1f54282fcb
--- /dev/null
+++ b/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts-sources.inc
@@ -0,0 +1,23 @@
1
2#
3# Generated by generate-srcuri.py, don't update manually")
4#
5
6RECIPE_UPGRADE_EXTRA_TASKS += "do_refresh_srcuri"
7
8python __anonymous() {
9 if d.getVar("PV") != "1.3.9.2":
10 bb.warn("-sources.inc out of date, run refresh_srcuri task")
11}
12
13SRC_URI += " \
14 https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h;subdir=git/external/renderdoc/src;sha256sum=e7b5f0aa5b1b0eadc63a1c624c0ca7f5af133aa857d6a4271b0ef3d0bdb6868e \
15 git://github.com/KhronosGroup/SPIRV-Tools.git;protocol=https;nobranch=1;destsuffix=git/external/spirv-tools/src;rev=4c7e1fa5c3d988cca0e626d359d30b117b9c2822 \
16 git://github.com/KhronosGroup/glslang.git;protocol=https;nobranch=1;destsuffix=git/external/glslang/src;rev=2b19bf7e1bc0b60cf2fe9d33e5ba6b37dfc1cc83 \
17 git://github.com/KhronosGroup/SPIRV-Headers.git;protocol=https;nobranch=1;destsuffix=git/external/spirv-headers/src;rev=db5a00f8cebe81146cafabf89019674a3c4bf03d \
18 git://github.com/KhronosGroup/Vulkan-Docs.git;protocol=https;nobranch=1;destsuffix=git/external/vulkan-docs/src;rev=7bb606eb87cde1d34f65f36f4d4c6f2c78f072c8 \
19 git://github.com/KhronosGroup/Vulkan-ValidationLayers.git;protocol=https;nobranch=1;destsuffix=git/external/vulkan-validationlayers/src;rev=f589bc456545fbab97caf49380b102b8aafe1f40 \
20 git://github.com/google/amber.git;protocol=https;nobranch=1;destsuffix=git/external/amber/src;rev=0f003c2785489f59cd01bb2440fcf303149100f2 \
21 git://github.com/open-source-parsers/jsoncpp.git;protocol=https;nobranch=1;destsuffix=git/external/jsoncpp/src;rev=9059f5cad030ba11d37818847443a53918c327b1 \
22 git://github.com/Igalia/vk_video_samples.git;protocol=https;nobranch=1;destsuffix=git/external/nvidia-video-samples/src;rev=6821adf11eb4f84a2168264b954c170d03237699 \
23"
diff --git a/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts_1.3.9.2.bb b/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts_1.3.9.2.bb
index bffec29e4d..6c0a07b873 100644
--- a/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts_1.3.9.2.bb
+++ b/meta-oe/recipes-graphics/vk-gl-cts/vulkan-cts_1.3.9.2.bb
@@ -2,19 +2,9 @@ DESCRIPTION = "Vulkan CTS"
2 2
3require khronos-cts.inc 3require khronos-cts.inc
4 4
5# vulkan-cts-1.3.9.2
6SRCREV_vk-gl-cts = "24c1b1498ba4f05777f47541968ffe686265c645" 5SRCREV_vk-gl-cts = "24c1b1498ba4f05777f47541968ffe686265c645"
7SRCREV_amber = "0f003c2785489f59cd01bb2440fcf303149100f2" 6
8SRCREV_glslang = "2b19bf7e1bc0b60cf2fe9d33e5ba6b37dfc1cc83" 7require vulkan-cts-sources.inc
9SRCREV_spirv-headers = "db5a00f8cebe81146cafabf89019674a3c4bf03d"
10SRCREV_spirv-tools = "4c7e1fa5c3d988cca0e626d359d30b117b9c2822"
11SRCREV_jsoncpp = "9059f5cad030ba11d37818847443a53918c327b1"
12SRCREV_vulkan-docs = "7bb606eb87cde1d34f65f36f4d4c6f2c78f072c8"
13SRCREV_vulkan-validationlayers = "a92629196a4fed15e59c74aa965dd47bd5ece3b7"
14SRC_URI[renderdoc.sha256sum] = "e7b5f0aa5b1b0eadc63a1c624c0ca7f5af133aa857d6a4271b0ef3d0bdb6868e"
15# Not yet needed
16SRCREV_ESExtractor = "75ffcaf55bb069f7a23764194742d2fb78c7f71f"
17SRCREV_video-parser = "6821adf11eb4f84a2168264b954c170d03237699"
18 8
19# Workaround an optimization bug that breaks createMeshShaderMiscTestsEXT 9# Workaround an optimization bug that breaks createMeshShaderMiscTestsEXT
20OECMAKE_CXX_FLAGS:remove:toolchain-gcc = "-O2" 10OECMAKE_CXX_FLAGS:remove:toolchain-gcc = "-O2"