DISTRO = "dey"
DISTRO_NAME = "Digi Embedded Yocto"
DISTRO_VERSION = "3.3-r1"
DISTRO_CODENAME = "hardknott"
SDK_VENDOR = "-deysdk"
SDK_VERSION := "${@d.getVar('DISTRO_VERSION')}"
SDK_VERSION[vardepvalue] = "${SDK_VERSION}"

MAINTAINER = "Digi Support <tech.support@digi.com>"

TARGET_VENDOR = "-dey"

LOCALCONF_VERSION = "1"

# Override these in poky based distros
POKY_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland bluez5 cellular"
POKY_DEFAULT_EXTRA_RDEPENDS = "packagegroup-dey-core"
POKY_DEFAULT_EXTRA_RRECOMMENDS = ""

DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${POKY_DEFAULT_DISTRO_FEATURES}"

# Removed DISTRO_FEATURES
#   'wayland' -> only supported on the i.MX8 QXP
#   'ptest'   -> fails to build QT5 toolchain
DISTRO_FEATURES_DEFAULT_remove = "3g nfc nfs zeroconf"
POKY_DEFAULT_DISTRO_FEATURES_remove = "ptest wayland"

GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', \
                        bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d), d)}"

# Recovery initramfs image name.
RECOVERY_INITRAMFS_IMAGE ?= "dey-image-recovery-initramfs"

# DEY image features (alphabetical order)
FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio"
FEATURE_PACKAGES_dey-bluetooth = "packagegroup-dey-bluetooth"
FEATURE_PACKAGES_dey-debug = "packagegroup-dey-debug"
FEATURE_PACKAGES_dey-examples = "packagegroup-dey-examples"
FEATURE_PACKAGES_dey-gstreamer = "packagegroup-dey-gstreamer"
FEATURE_PACKAGES_dey-network = "packagegroup-dey-network"
FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt"
FEATURE_PACKAGES_dey-trustfence = "packagegroup-dey-trustfence"
FEATURE_PACKAGES_dey-webkit = "packagegroup-dey-webkit"
FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless"

# Our layer only provides version 5.41, which we want to keep because
# it was used for Bluetooth certification. However by default the newer
# 5.56 version should be used, which is provided by the poky layer.
PREFERRED_VERSION_bluez5 ?= "5.56"

# Use NXP's forks of packages when possible
PREFERRED_VERSION_weston ?= "9.0.0.imx"
PREFERRED_VERSION_wayland-protocols = "1.22.imx"
PREFERRED_VERSION_libdrm ?= "2.4.107.imx"
PREFERRED_VERSION_opencv ?= "4.5.2.imx"
PREFERRED_VERSION_optee-client = "3.15.0.imx"
PREFERRED_VERSION_optee-os = "3.15.0.imx"
PREFERRED_VERSION_optee-test = "3.15.0.imx"

# Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE
# architecture.  For armv7a devices libjpeg-turbo should be used to take
# advantage of the SIMD instructions.
PREFERRED_PROVIDER_jpeg ?= "jpeg"
PREFERRED_PROVIDER_jpeg_armv7a ?= "libjpeg-turbo"

PREFERRED_VERSION_linux-yocto ?= "5.10%"
PREFERRED_VERSION_linux-yocto-rt ?= "5.10%"

# Use git recipe for libsoc
PREFERRED_VERSION_libsoc = "git"

# There's a generic opencl-headers recipe in the thud branch of
# meta-openembedded, but we should use the package provided by the imx-gpu-viv
# recipe in case there are NXP-specific changes in it
PREFERRED_PROVIDER_opencl-headers ?= "imx-gpu-viv"

# Use the FDO backend for WPE WebKit
PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"

# Use recipe from our meta-digi layer
PREFERRED_VERSION_tensorflow-lite ?= "2.5.0"

SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
SDKPATHINSTALL = "/opt/${DISTRO}/${SDK_VERSION}/${MACHINE}"

DISTRO_EXTRA_RDEPENDS += " ${POKY_DEFAULT_EXTRA_RDEPENDS}"
DISTRO_EXTRA_RRECOMMENDS += " ${POKY_DEFAULT_EXTRA_RRECOMMENDS}"

TCLIBCAPPEND = ""

# Some packages need this (e.g. gstreamer1.0-plugins-ugly)
LICENSE_FLAGS_WHITELIST += "commercial"

PREMIRRORS ??= "\
bzr://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
cvs://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
git://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
gitsm://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
hg://.*/.*    http://downloads.yoctoproject.org/mirror/sources/ \n \
osc://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
p4://.*/.*    http://downloads.yoctoproject.org/mirror/sources/ \n \
svn://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n"

SANITY_TESTED_DISTROS ?= " \
            poky-3.2 \n \
            poky-3.3 \n \
            ubuntu-16.04 \n \
            ubuntu-18.04 \n \
            ubuntu-20.04 \n \
            fedora-31 \n \
            fedora-32 \n \
            fedora-33 \n \
            centos-7 \n \
            centos-8 \n \
            debian-8 \n \
            debian-9 \n \
            debian-10 \n \
            opensuseleap-15.1 \n \
            opensuseleap-15.2 \n \
            "
# add poky sanity bbclass
INHERIT += "poky-sanity"

# QA check settings - a little stricter than the OE-Core defaults
# (none currently necessary as we now match OE-Core)
#WARN_TO_ERROR_QA = "X"
#WARN_QA_remove = "${WARN_TO_ERROR_QA}"
#ERROR_QA_append = " ${WARN_TO_ERROR_QA}"

require conf/distro/include/poky-world-exclude.inc
require conf/distro/include/no-static-libs.inc
require conf/distro/include/yocto-uninative.inc
require conf/distro/include/security_flags.inc
INHERIT += "uninative"

INHERIT += "reproducible_build"

BB_SIGNATURE_HANDLER ?= "OEEquivHash"
BB_HASHSERVE ??= "auto"

# Enable removal of libtool '*.la' files (this is the default starting in 2.3)
INHERIT += "remove-libtool"
