blob: 4b021bbe4e3aa61556cf27124f01938309eaf959 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001SUMMARY = "GN is a meta-build system that generates build files for Ninja"
2DEPENDS += "ninja-native"
3
4LICENSE = "BSD-3-Clause"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d"
6
Andrew Geissler517393d2023-01-13 08:55:19 -06007SRC_URI = "git://gn.googlesource.com/gn;protocol=https;branch=main \
8 file://0001-Replace-lstat64-stat64-functions-on-linux.patch"
Patrick Williams520786c2023-06-25 16:20:36 -05009SRCREV = "4bd1a77e67958fb7f6739bd4542641646f264e5d"
Andrew Geissler80d41842023-09-11 08:36:15 -040010PV = "0+git${SRCPV}"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040011
12S = "${WORKDIR}/git"
13B = "${WORKDIR}/build"
14
Patrick Williams520786c2023-06-25 16:20:36 -050015# Work around this fatal warning:
16# ../git/src/gn/desc_builder.cc: In member function 'base::Value {anonymous}::BaseDescBuilder::ToBaseValue(const Scope*)':
17# ../git/src/gn/desc_builder.cc:179:21: error: redundant move in return statement [-Werror=redundant-move]
18# 179 | return std::move(res);
Andrew Geissler23e02792023-07-21 09:06:10 -050019CXXFLAGS += "-Wno-error=redundant-move"
Patrick Williams520786c2023-06-25 16:20:36 -050020
Brad Bishopbec4ebc2022-08-03 09:55:16 -040021# Map from our _OS strings to the GN's platform values.
22def gn_platform(variable, d):
23 os = d.getVar(variable)
24 if "linux" in os:
25 return "linux"
26 elif "mingw" in os:
27 return "mingw"
28 else:
29 return os
30
31do_configure[cleandirs] += "${B}"
32do_configure() {
33 python3 ${S}/build/gen.py \
34 --platform=${@gn_platform("TARGET_OS", d)} \
35 --out-path=${B} \
36 --no-static-libstdc++ \
37 --no-strip
38}
39
40do_compile() {
41 ninja -C ${B} --verbose
42}
43
44do_install() {
45 install -d ${D}${bindir}
46 install ${B}/gn ${D}${bindir}
47}
48
49BBCLASSEXTEND = "native"
50
51COMPATIBLE_HOST = "^(?!riscv32).*"