# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have a recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
	${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "riscv-layer"
BBFILE_PATTERN_riscv-layer = "^${LAYERDIR}/"
BBFILE_PRIORITY_riscv-layer = "6"

BBFILES_DYNAMIC += " \
    virtualization-layer:${LAYERDIR}/dynamic-layers/virt-layer/*/*/*.bb \
    virtualization-layer:${LAYERDIR}/dynamic-layers/virt-layer/*/*/*.bbappend \
    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/*/*/*.bb \
    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/*/*/*.bbappend \
    gnome-layer:${LAYERDIR}/dynamic-layers/gnome-layer/*/*/*.bb \
    gnome-layer:${LAYERDIR}/dynamic-layers/gnome-layer/*/*/*.bbappend \
    meta-python:${LAYERDIR}/dynamic-layers/meta-python/*/*/*.bb \
    meta-python:${LAYERDIR}/dynamic-layers/meta-python/*/*/*.bbappend \
    multimedia-layer:${LAYERDIR}/dynamic-layers/multimedia-layer/*/*/*.bb \
    multimedia-layer:${LAYERDIR}/dynamic-layers/multimedia-layer/*/*/*.bbappend \
    \
"

LAYERSERIES_COMPAT_riscv-layer = "mickledore"

INSANE_SKIP:append:pn-eudev:riscv64 = " textrel"
INSANE_SKIP:append:pn-gdb:riscv64 = " textrel"
INSANE_SKIP:append:pn-perf:riscv64 = " textrel"
INSANE_SKIP:append:pn-qtbase:riscv64 = " textrel"
INSANE_SKIP:append:pn-qtbase-tools:riscv64 = " textrel"
INSANE_SKIP:append:pn-dracut:riscv64 = " textrel"
INSANE_SKIP:append:pn-qemu:riscv64 = " textrel"
INSANE_SKIP:append:pn-qemu-ptest:riscv64 = " textrel"
INSANE_SKIP:append:pn-rt-tests:riscv64 = " textrel"
INSANE_SKIP:append:pn-tvheadend:riscv64 = " textrel"
INSANE_SKIP:append:pn-tipcutils:riscv64 = " textrel"
INSANE_SKIP:append:pn-zabbix:riscv64 = " textrel"
INSANE_SKIP:append:pn-xfsdump:riscv64 = " textrel"
INSANE_SKIP:append:pn-capnproto:riscv64 = " textrel"
INSANE_SKIP:append:pn-netdata:riscv64 = " textrel"
INSANE_SKIP:append:pn-ltp:riscv64 = " textrel"
INSANE_SKIP:append:pn-opensaf:riscv64 = " textrel"
INSANE_SKIP:append:pn-rdma-core:riscv64 = " textrel"
INSANE_SKIP:append:pn-doxygen:riscv64 = " textrel"
INSANE_SKIP:append:pn-poppler:riscv64 = " textrel"
INSANE_SKIP:append:pn-tgt:riscv64 = " textrel"
# Only seen when build with gcc
INSANE_SKIP:append:pn-util-linux:riscv64 = " textrel"
# Only seen when build with gcc
INSANE_SKIP:append:pn-cmocka:riscv64 = " textrel"
INSANE_SKIP:append:pn-rust-hello-world:riscv64 = " textrel"
INSANE_SKIP:append:pn-fish:riscv64 = " textrel"
INSANE_SKIP:append:pn-lttng-tools:riscv64 = " textrel"
INSANE_SKIP:append:pn-gn:riscv64 = " textrel"
INSANE_SKIP:append:pn-apitrace:riscv64 = " textrel"
INSANE_SKIP:append:pn-apache2:riscv64 = " textrel"
INSANE_SKIP:append:pn-go:riscv64 = " textrel"
# Seen with musl+clang13
INSANE_SKIP:append:pn-jemalloc:toolchain-clang:riscv64 = " textrel"
INSANE_SKIP:append:pn-libcereal:riscv64 = " textrel"
INSANE_SKIP:append:pn-minio:riscv64 = " textrel"
# QA Issue: libnl-ptest: ELF binary /usr/lib/libnl/ptest/check-all has relocations in .text [textrel]
INSANE_SKIP:append:pn-libnl:riscv64 = " textrel"
# ELF binary /usr/lib/vulkan-cts/deqp-vksc has relocations in .text [textrel]
INSANE_SKIP:append:pn-vulkan-cts:riscv64 = " textrel"
# ERROR: QA Issue: pcsc-lite: ELF binary /usr/sbin/pcscd has relocations in .text [textrel]
INSANE_SKIP:append:pn-pcsc-lite:riscv64 = " textrel"
# ELF binary /usr/lib/systemd/systemd-coredump has relocations in .text
# ELF binary /usr/bin/journalctl has relocations in .text [textrel]
INSANE_SKIP:append:pn-systemd:riscv64 = " textrel"
# ERROR: QA Issue: plocate: ELF binary /usr/bin/plocate has relocations in .text [textrel]
INSANE_SKIP:append:pn-plocate:riscv64 = " textrel"
# ERROR: procps-4.0.3-r0 do_package_qa: QA Issue: procps: ELF binary /usr/bin/top.procps has relocations in .text [textrel]
INSANE_SKIP:append:pn-procps:riscv64 = " textrel"
# ERROR: QA Issue: glib-networking-ptest: ELF binary /usr/libexec/installed-tests/glib-networking/connection-openssl has relocations in .text [textrel]
INSANE_SKIP:append:pn-glib-networking:riscv64 = " textrel"

INSANE_SKIP:append:pn-xfsdump:riscv32 = " textrel"
INSANE_SKIP:append:pn-zabbix:riscv32 = " textrel"
INSANE_SKIP:append:pn-netdata:riscv32 = " textrel"
INSANE_SKIP:append:pn-tipcutils:riscv32 = " textrel"
INSANE_SKIP:append:pn-tvheadend:riscv32 = " textrel"
INSANE_SKIP:append:pn-eudev:riscv32 = " textrel"
INSANE_SKIP:append:pn-dracut:riscv32 = " textrel"
INSANE_SKIP:append:pn-rt-tests:riscv32 = " textrel"
INSANE_SKIP:append:pn-gdb:riscv32 = " textrel"
INSANE_SKIP:append:pn-capnproto:riscv32 = " textrel"
INSANE_SKIP:append:pn-rdma-core:riscv32 = " textrel"
INSANE_SKIP:append:pn-ltp:riscv32 = " textrel"
INSANE_SKIP:append:pn-poppler:riscv32 = " textrel"
INSANE_SKIP:append:pn-qtbase:riscv32 = " textrel"
INSANE_SKIP:append:pn-opensaf:riscv32 = " textrel"
INSANE_SKIP:append:pn-doxygen:riscv32 = " textrel"
INSANE_SKIP:append:pn-opengl-es-cts:riscv32 = " textrel"
INSANE_SKIP:append:pn-perf:riscv32 = " textrel"
INSANE_SKIP:append:pn-rust-hello-world:riscv32 = " textrel"
INSANE_SKIP:append:pn-fish:riscv32 = " textrel"
INSANE_SKIP:append:pn-tgt:riscv32 = " textrel"
# Only seen when build with gcc
INSANE_SKIP:append:pn-cmocka:riscv32 = " textrel"
# Only seen when build with gcc
INSANE_SKIP:append:pn-util-linux:riscv32 = " textrel"
INSANE_SKIP:append:pn-apitrace:riscv32 = " textrel"
INSANE_SKIP:append:pn-jemalloc:toolchain-clang:riscv32 = " textrel"
INSANE_SKIP:append:pn-apache2:riscv32 = " textrel"
INSANE_SKIP:append:pn-go:riscv32 = " textrel"
INSANE_SKIP:append:pn-libcereal:riscv32 = " textrel"
INSANE_SKIP:append:pn-minio:riscv32 = " textrel"
# QA Issue: libnl-ptest: ELF binary /usr/lib/libnl/ptest/check-all has relocations in .text [textrel]
INSANE_SKIP:append:pn-libnl:riscv32 = " textrel"
# ELF binary /usr/lib/vulkan-cts/deqp-vksc has relocations in .text [textrel]
INSANE_SKIP:append:pn-vulkan-cts:riscv32 = " textrel"
# ERROR: QA Issue: pcsc-lite: ELF binary /usr/sbin/pcscd has relocations in .text [textrel]
INSANE_SKIP:append:pn-pcsc-lite:riscv32 = " textrel"
# ELF binary /usr/lib/systemd/systemd-coredump has relocations in .text
# ELF binary /usr/bin/journalctl has relocations in .text [textrel]
INSANE_SKIP:append:pn-systemd:riscv32 = " textrel"
# ERROR: QA Issue: plocate: ELF binary /usr/bin/plocate has relocations in .text [textrel]
INSANE_SKIP:append:pn-plocate:riscv32 = " textrel"
# ERROR: procps-4.0.3-r0 do_package_qa: QA Issue: procps: ELF binary /usr/bin/top.procps has relocations in .text [textrel]
INSANE_SKIP:append:pn-procps:riscv32 = " textrel"
# ERROR: QA Issue: glib-networking-ptest: ELF binary /usr/libexec/installed-tests/glib-networking/connection-openssl has relocations in .text [textrel]
INSANE_SKIP:append:pn-glib-networking:riscv32 = " textrel"

# These recipe dont _yet_ build for rv32
COMPATIBLE_HOST:pn-openh264:riscv32 = "null"
# needs SYS_ppoll and SYS_pselect6
COMPATIBLE_HOST:pn-lttng-tools:riscv32 = "null"
# LTTng-modules requires CONFIG_KPROBES on kernels >= 5.7.0
COMPATIBLE_HOST:pn-lttng-modules:riscv32 = "null"
# Needs porting to rv32
COMPATIBLE_HOST:pn-android-tools:riscv32 = "null"
# Needs porting to rv32
COMPATIBLE_HOST:pn-strace:riscv32 = "null"
COMPATIBLE_HOST:pn-ostree:riscv32 = "null"
# Klibc needs porting in usr/klibc/arch/riscv32
COMPATIBLE_HOST:pn-klibc:riscv32 = "null"
COMPATIBLE_HOST:pn-klibc-static-utils:riscv32 = "null"
COMPATIBLE_HOST:pn-klibc-utils:riscv32 = "null"
COMPATIBLE_HOST:pn-klcc-cross:riscv32 = "null"
COMPATIBLE_HOST:pn-kexecboot-klibc:riscv32 = "null"
COMPATIBLE_HOST:pn-ubi-utils-klibc:riscv32 = "null"

# |   Unknown CPU 'riscv32'
COMPATIBLE_HOST:pn-qtwebkit:riscv32 = "null"
# Fails to configure
COMPATIBLE_HOST:pn-samba:riscv32 = "null"
COMPATIBLE_HOST:pn-smbnetfs:riscv32 = "null"
COMPATIBLE_HOST:pn-gnome-control-center:riscv32 = "null"
COMPATIBLE_HOST:pn-thunar-shares-plugin:riscv32 = "null"

# sipe-mime.c:129:30: error: cast from 'GTypeInstance *' (aka 'struct _GTypeInstance *') to 'GMimeStreamFilter *' (aka 'struct _GMimeStreamFilter *') increases required al ignment from 4 to 8 [-Werror,-Wcast-align]
COMPATIBLE_HOST:pn-pidgin-sipe:riscv32 = "null"

# needs swapcontext/makecontext/getcontext which are
# not yet implemented in linucontext for rv32
COMPATIBLE_HOST:pn-capnproto:libc-musl:riscv32 = "null"
