1require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
4require conf/image-uefi.conf
5
6DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native"
7
8inherit meson pkgconfig gettext
9inherit deploy
10
11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12
13EFI_LD = "bfd"
14LDFLAGS:append = " -fuse-ld=${EFI_LD}"
15
16do_write_config[vardeps] += "EFI_LD"
17do_write_config:append() {
18    cat >${WORKDIR}/meson-${PN}.cross <<EOF
19[binaries]
20c_ld = ${@meson_array('EFI_LD', d)}
21EOF
22}
23
24MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross"
25
26MESON_TARGET = "systemd-boot"
27
28EXTRA_OEMESON += "-Defi=true \
29                  -Dbootloader=true \
30                  -Dman=false \
31                  "
32
33# install to the image as boot*.efi if its the EFI_PROVIDER,
34# otherwise install as the full name.
35# This allows multiple bootloaders to coexist in a single image.
36python __anonymous () {
37    import re
38    target = d.getVar('TARGET_ARCH')
39    prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
40    systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
41    d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
42    prefix = "systemd-" if prefix == "" else ""
43    d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
44}
45
46FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
47
48RDEPENDS:${PN} += "virtual-systemd-bootconf"
49
50CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t"
51
52COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
53COMPATIBLE_HOST:x86-x32 = "null"
54
55do_install() {
56	install -d ${D}${EFI_FILES_PATH}
57	install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
58}
59
60do_deploy () {
61	install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
62	install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
63	install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR}
64}
65
66addtask deploy before do_build after do_compile
67
68