Files
poky/meta/recipes-devtools/gn/gn_git.bb
Khem Raj f5fdf6ed3f 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>
2025-10-02 11:28:03 +01:00

53 lines
1.2 KiB
BlitzBasic

SUMMARY = "GN is a meta-build system that generates build files for Ninja"
HOMEPAGE = "https://gn.googlesource.com/gn/"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d"
DEPENDS += "ninja-native"
UPSTREAM_CHECK_COMMITS = "1"
SRC_URI = "git://gn.googlesource.com/gn;protocol=https;branch=main"
SRCREV = "81b24e01531ecf0eff12ec9359a555ec3944ec4e"
PV = "0+git"
BB_GIT_SHALLOW = ""
B = "${WORKDIR}/build"
# Map from our _OS strings to the GN's platform values.
def gn_platform(variable, d):
os = d.getVar(variable)
if "linux" in os:
return "linux"
elif "mingw" in os:
return "mingw"
else:
return os
do_configure[cleandirs] += "${B}"
do_configure() {
python3 ${S}/build/gen.py \
--platform=${@gn_platform("TARGET_OS", d)} \
--out-path=${B} \
--no-static-libstdc++ \
--no-strip
}
# Catch build progress from ninja
do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
do_compile() {
ninja -C ${B} --verbose
}
do_install() {
install -d ${D}${bindir}
install ${B}/gn ${D}${bindir}
}
BBCLASSEXTEND = "native"
COMPATIBLE_HOST = "^(?!riscv32).*"
CFLAGS:append:toolchain-gcc = " -Wno-error=maybe-uninitialized"