diff options
author | Khem Raj <raj.khem@gmail.com> | 2025-09-29 08:36:47 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-02 11:28:03 +0100 |
commit | f5fdf6ed3f2a7b1b086d2e41b855d03e76e3b4d7 (patch) | |
tree | 8d626324613f5b822ef638749adc80e67514126c | |
parent | 743a9983247e7d0ad1460adb1e984f66c9be25b2 (diff) | |
download | poky-f5fdf6ed3f2a7b1b086d2e41b855d03e76e3b4d7.tar.gz |
gn: Add recipe
gn is a commonly used build tool to generate ninja files, used
in a lot of recipes e.g. chromium, qtwebengine, perfetto, hafnium etc.
these recipes come from different layers e.g. meta-qt6/meta-arm/meta-oe
since not all layers depend on meta-oe ( meta-arm does not ), its not
a possible option.
Given the usecases, putting it in core will benefit the ecosystem
and reduce some duplication. This recipe is taken from meta-arm
Disable maybe-initialized is a gcc specific option as error
Disable format warnings as errors, it adds -Wno-format explictly in
its build system
(From OE-Core rev: e8dbf41f1f40ae3a5f9641429cad974f716f1f3e)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/conf/distro/include/maintainers.inc | 1 | ||||
-rw-r--r-- | meta/conf/distro/include/security_flags.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/gn/gn_git.bb | 52 |
3 files changed, 54 insertions, 0 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index c6c1de6b5a..b48c53ef11 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
@@ -223,6 +223,7 @@ RECIPE_MAINTAINER:pn-glibc-scripts = "Khem Raj <raj.khem@gmail.com>" | |||
223 | RECIPE_MAINTAINER:pn-glibc-testsuite = "Khem Raj <raj.khem@gmail.com>" | 223 | RECIPE_MAINTAINER:pn-glibc-testsuite = "Khem Raj <raj.khem@gmail.com>" |
224 | RECIPE_MAINTAINER:pn-gmp = "Khem Raj <raj.khem@gmail.com>" | 224 | RECIPE_MAINTAINER:pn-gmp = "Khem Raj <raj.khem@gmail.com>" |
225 | RECIPE_MAINTAINER:pn-glslang = "Jose Quaresma <quaresma.jose@gmail.com>" | 225 | RECIPE_MAINTAINER:pn-glslang = "Jose Quaresma <quaresma.jose@gmail.com>" |
226 | RECIPE_MAINTAINER:pn-gn = "Khem Raj <raj.khem@gmail.com>" | ||
226 | RECIPE_MAINTAINER:pn-gnome-desktop-testing = "Ross Burton <ross.burton@arm.com>" | 227 | RECIPE_MAINTAINER:pn-gnome-desktop-testing = "Ross Burton <ross.burton@arm.com>" |
227 | RECIPE_MAINTAINER:pn-gnu-config = "Robert Yang <liezhi.yang@windriver.com>" | 228 | RECIPE_MAINTAINER:pn-gnu-config = "Robert Yang <liezhi.yang@windriver.com>" |
228 | RECIPE_MAINTAINER:pn-gnu-efi = "Yi Zhao <yi.zhao@windriver.com>" | 229 | RECIPE_MAINTAINER:pn-gnu-efi = "Yi Zhao <yi.zhao@windriver.com>" |
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc index f713a99465..824ba2c0e3 100644 --- a/meta/conf/distro/include/security_flags.inc +++ b/meta/conf/distro/include/security_flags.inc | |||
@@ -46,6 +46,7 @@ SECURITY_LDFLAGS:pn-sysklogd = "" | |||
46 | # Recipes which fail to compile when elevating -Wformat-security to an error | 46 | # Recipes which fail to compile when elevating -Wformat-security to an error |
47 | SECURITY_STRINGFORMAT:pn-busybox = "" | 47 | SECURITY_STRINGFORMAT:pn-busybox = "" |
48 | SECURITY_STRINGFORMAT:pn-gcc = "" | 48 | SECURITY_STRINGFORMAT:pn-gcc = "" |
49 | SECURITY_STRINGFORMAT:pn-gn = "" | ||
49 | 50 | ||
50 | TARGET_CC_ARCH:append:class-target = " ${SECURITY_CFLAGS}" | 51 | TARGET_CC_ARCH:append:class-target = " ${SECURITY_CFLAGS}" |
51 | TARGET_LDFLAGS:append:class-target = " ${SECURITY_LDFLAGS}" | 52 | TARGET_LDFLAGS:append:class-target = " ${SECURITY_LDFLAGS}" |
diff --git a/meta/recipes-devtools/gn/gn_git.bb b/meta/recipes-devtools/gn/gn_git.bb new file mode 100644 index 0000000000..d8896609b1 --- /dev/null +++ b/meta/recipes-devtools/gn/gn_git.bb | |||
@@ -0,0 +1,52 @@ | |||
1 | SUMMARY = "GN is a meta-build system that generates build files for Ninja" | ||
2 | HOMEPAGE = "https://gn.googlesource.com/gn/" | ||
3 | LICENSE = "BSD-3-Clause" | ||
4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d" | ||
5 | |||
6 | DEPENDS += "ninja-native" | ||
7 | UPSTREAM_CHECK_COMMITS = "1" | ||
8 | |||
9 | SRC_URI = "git://gn.googlesource.com/gn;protocol=https;branch=main" | ||
10 | SRCREV = "81b24e01531ecf0eff12ec9359a555ec3944ec4e" | ||
11 | PV = "0+git" | ||
12 | |||
13 | BB_GIT_SHALLOW = "" | ||
14 | |||
15 | B = "${WORKDIR}/build" | ||
16 | |||
17 | # Map from our _OS strings to the GN's platform values. | ||
18 | def gn_platform(variable, d): | ||
19 | os = d.getVar(variable) | ||
20 | if "linux" in os: | ||
21 | return "linux" | ||
22 | elif "mingw" in os: | ||
23 | return "mingw" | ||
24 | else: | ||
25 | return os | ||
26 | |||
27 | do_configure[cleandirs] += "${B}" | ||
28 | do_configure() { | ||
29 | python3 ${S}/build/gen.py \ | ||
30 | --platform=${@gn_platform("TARGET_OS", d)} \ | ||
31 | --out-path=${B} \ | ||
32 | --no-static-libstdc++ \ | ||
33 | --no-strip | ||
34 | } | ||
35 | |||
36 | # Catch build progress from ninja | ||
37 | do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" | ||
38 | |||
39 | do_compile() { | ||
40 | ninja -C ${B} --verbose | ||
41 | } | ||
42 | |||
43 | do_install() { | ||
44 | install -d ${D}${bindir} | ||
45 | install ${B}/gn ${D}${bindir} | ||
46 | } | ||
47 | |||
48 | BBCLASSEXTEND = "native" | ||
49 | |||
50 | COMPATIBLE_HOST = "^(?!riscv32).*" | ||
51 | |||
52 | CFLAGS:append:toolchain-gcc = " -Wno-error=maybe-uninitialized" | ||