#@--------------------------------------------------------------------
#@TYPE: Distribution
#@NAME: KaeilOS 
#@DESCRIPTION: KaeilOS Linux Distribution for Kernel 2.6 based devices
#@MAINTAINER: Marco Cavallini <m.cavallini@koansoftware.com>
#@--------------------------------------------------------------------

#DISTRO_VERSION = "2008.1"
DISTRO_VERSION = "2008.1-test-${DATE}"
DISTRO_REVISION = "1"
DISTRO_PR = ".1"

#build staging from packages
INHERIT += "packaged-staging"

require conf/distro/include/sane-srcdates.inc
require conf/distro/include/sane-srcrevs.inc
require conf/distro/include/angstrom-2008-preferred-versions.inc
require conf/distro/include/preferred-opie-versions-1.2.4.inc

PREFERRED_VERSION_xserver-kdrive = "1.3.0.0"
PREFERRED_VERSION_busybox        = "1.13.2"

IMAGE_DEV_MANAGER = "busybox-mdev"

#Images built can have to modes:
# 'debug': empty rootpassword, strace included
# 'release' no root password, no strace and gdb by default
DISTRO_TYPE ?= "debug"
#DISTRO_TYPE = "release"

# Ship just basic locale by default. Locales are big (~1Mb uncompr.), so
# shipping some adhoc subset will be still useless and size burden for
# users of all other languages/countries. Instead, worth to make it easy
# to install additional languages: installer/wizard + metapackages which
# will RRECOMMEND as much as possible content for a given language
# (locales, UI transalations, help, etc. - useless for pros, but really 
# helpful for common users).
# Also, it appears that no locales fit in 16Mb for now. "C" locale rules!
IMAGE_LINGUAS = '${@base_less_or_equal("ROOT_FLASH_SIZE", "16", "", "en-us", d)}'


# set feed path variables
FEED_BASEPATH = "feeds/2008/${ANGSTROM_PKG_FORMAT}/${ANGSTROMLIBC}/"


#The angstrom-mirrors.bbclass should have everything, but we can use this as a fallback
CVS_TARBALL_STASH ?= "\
             http://www.angstrom-distribution.org/unstable/sources/ \
            "

PCMCIA_MANAGER = "pcmciautils"

#This is unrelated to the kernel version, but userspace apps (e.g. HAL) require a recent version to build against
PREFERRED_VERSION_linux-libc-headers    = "2.6.23"

#Prefer glibc 2.6 and uclibc 0.9.30, these have had the most testing.
PREFERRED_VERSION_glibc         ?= "2.6.1"
PREFERRED_VERSION_glibc-initial     ?= "2.6.1"
PREFERRED_VERSION_uclibc            ?= "0.9.30"
PREFERRED_VERSION_uclibc-initial    ?= "0.9.30"

PREFERRED_PROVIDER_avahi = "avahi"

#Small machines prefer kdrive, but we might ship full Xorg in other images
PREFERRED_PROVIDER_virtual/xserver  ?= "xserver-kdrive"
PREFERRED_PROVIDER_xserver          ?= "xserver-kdrive"

#powerpc needs additional patches to gcc
ANGSTROM_GCC_VERSION_ppc405         ?= "4.1.1"
ANGSTROM_GCC_VERSION_xilinx-ml403   ?= "4.1.1"
ANGSTROM_GCC_VERSION_xilinx-ml403   ?= "4.1.1"

# Blackfin has its own gcc
ANGSTROM_GCC_VERSION_bfin           = "4.1.2"

#for proper NEON support we need a CSL toolchain 
#ANGSTROM_GCC_VERSION_armv7a         = "4.2.1+csl-arm-2007q3-53"
ANGSTROM_GCC_VERSION_armv7a     = "4.3.1" 

#Horrible workaround for armv7a follows:
# gcc 4.3.1 builds a kernel that oopses with a null-pointer in the rcu-update function
# gcc 4.2.1 (the one from *gasp* csl) builds a working kernel, but non-working userspace

KERNEL_CCSUFFIX_armv7a= "-4.2.1+csl-arm-2007q3-53"

#avr32 only has support for gcc 4.2.2
ANGSTROM_GCC_VERSION_avr32      ?= "4.2.2"

#Everybody else can just use this: 
ANGSTROM_GCC_VERSION            ?= "4.2.4"
PREFERRED_VERSION_binutils              ?= "2.18.50.0.7"
PREFERRED_VERSION_binutils-cross        ?= "2.18.50.0.7"
PREFERRED_VERSION_binutils-cross-sdk    ?= "2.18.50.0.7"

PREFERRED_VERSION_gcc                    ?= "${ANGSTROM_GCC_VERSION}"
PREFERRED_VERSION_gcc-cross              ?= "${ANGSTROM_GCC_VERSION}"
PREFERRED_VERSION_gcc-cross-sdk          ?= "${ANGSTROM_GCC_VERSION}"
PREFERRED_VERSION_gcc-cross-initial      ?= "${ANGSTROM_GCC_VERSION}"
PREFERRED_VERSION_gcc-cross-intermediate ?= "${ANGSTROM_GCC_VERSION}"

#Loads preferred versions from files, these have weak assigments (?=), so put them at the bottom
require conf/distro/include/preferred-e-versions.inc
require conf/distro/include/preferred-xorg-versions-X11R7.4-updates.inc
require conf/distro/include/preferred-xorg-versions-X11R7.4.inc

#avr32 only has patches for binutils 2.17 in OE
PREFERRED_VERSION_binutils_avr32 = "2.17"
PREFERRED_VERSION_binutils-cross_avr32 = "2.17"
PREFERRED_VERSION_binutils-cross-sdk_avr32 = "2.17"

# Virtuals:
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "binutils-cross"
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "gcc-cross-initial"
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "gcc-cross-intermediate"
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "gcc-cross"
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "gcc-cross"

# hostap stuff, we prefer the in-kernel modules, but those don't work for all machines
PREFERRED_PROVIDER_hostap-conf                      ?= "hostap-conf"

PREFERRED_PROVIDER_virtual/db           ?= "db"
PREFERRED_PROVIDER_virtual/db-native    ?= "db-native"
PREFERRED_PROVIDER_virtual/libsdl       ?= "libsdl-x11"
PREFERRED_PROVIDER_virtual/libx11       ?= "libx11"
PREFERRED_PROVIDER_virtual/xserver      ?= "xserver-kdrive"

# Others:
PREFERRED_PROVIDER_linux-libc-headers     = "linux-libc-headers"
PREFERRED_PROVIDER_dbus-glib              = "dbus-glib"
PREFERRED_PROVIDER_esound                ?= "pulseaudio"
PREFERRED_PROVIDER_gconf                 ?= "gconf-dbus"
PREFERRED_PROVIDER_gnome-vfs             ?= "gnome-vfs"
PREFERRED_PROVIDER_gnome-vfs-plugin-file ?= "gnome-vfs"
PREFERRED_PROVIDER_tslib                 ?= "tslib"
PREFERRED_PROVIDER_tslib-conf            ?= "tslib"
PREFERRED_PROVIDER_libgpewidget          ?= "libgpewidget"
PREFERRED_PROVIDER_ntp                   ?= "ntp"
PREFERRED_PROVIDER_hotplug                = "udev"
PREFERRED_PROVIDER_libxss                 = "libxss"
PREFERRED_PROVIDER_bluez-utils-dbus       = "bluez-utils"

# we don't ship gtk-directfb by default
PREFERRED_PROVIDER_gtk+                   ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-ani  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-bmpg ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-gif  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-ico  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-jpeg ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-pcx  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-png  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-pnm  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-ras  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-tga  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-wbmp ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-xbm  ?= "gtk+"
PREFERRED_PROVIDER_gdk-pixbuf-loader-xpm  ?= "gtk+"

#Silence a warning during parsing
PREFERRED_PROVIDER_task-bootstrap = "task-bootstrap"

require conf/distro/include/kaeilos.inc

# do some task-base stuff here

# We want to ship extra debug utils in the rootfs when doing a debug build 
DEBUG_APPS ?= ""
DEBUG_APPS += '${@base_conditional("DISTRO_TYPE", "release", "", "strace procps",d)}'

# KaeilOS want to ship some extra stuff. This should be moved into task-base eventually
# contains ipkg specific stuff as well :(
DISTRO_EXTRA_RDEPENDS += "\
    update-modules \
    ${@base_contains("MACHINE_FEATURES", "screen", "psplash", "",d)} \   
    kaeilos-version \
    opkg-nogpg opkg-collateral ${ANGSTROM_FEED_CONFIGS} \
    util-linux-ng-mount util-linux-ng-umount \
    ${DEBUG_APPS} angstrom-libc-fixup-hack \
    "

DISTRO_EXTRA_RRECOMMENDS += " \
    kernel-module-vfat \
    kernel-module-ext2 \
    kernel-module-af-packet \
    openssh-sftp-server \
    "