RECIPE_MAINTAINER:pn-glibc-testsuite = "Khem Raj <raj.khem@gmail.com>"
RECIPE_MAINTAINER:pn-gmp = "Khem Raj <raj.khem@gmail.com>"
RECIPE_MAINTAINER:pn-glslang = "Jose Quaresma <quaresma.jose@gmail.com>"
+RECIPE_MAINTAINER:pn-gn = "Khem Raj <raj.khem@gmail.com>"
RECIPE_MAINTAINER:pn-gnome-desktop-testing = "Ross Burton <ross.burton@arm.com>"
RECIPE_MAINTAINER:pn-gnu-config = "Robert Yang <liezhi.yang@windriver.com>"
RECIPE_MAINTAINER:pn-gnu-efi = "Yi Zhao <yi.zhao@windriver.com>"
# Recipes which fail to compile when elevating -Wformat-security to an error
SECURITY_STRINGFORMAT:pn-busybox = ""
SECURITY_STRINGFORMAT:pn-gcc = ""
+SECURITY_STRINGFORMAT:pn-gn = ""
TARGET_CC_ARCH:append:class-target = " ${SECURITY_CFLAGS}"
TARGET_LDFLAGS:append:class-target = " ${SECURITY_LDFLAGS}"
--- /dev/null
+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"