#@--------------------------------------------------------------------
#@TYPE: Distribution
#@NAME: Angstrom <http://www.angstrom-distribution.org>
#@DESCRIPTION: The Linux Distribution for Kernel 2.6 based devices
#@MAINTAINER: Koen Kooi <koen@dominion.kabel.utwente.nl>
#@MAINTAINER: Michael 'Mickey' Lauer <mickey@Vanille.de>
#@--------------------------------------------------------------------

#DISTRO_VERSION = "2007.9"
DISTRO_VERSION = "2007.9-test-${DATE}"
DISTRO_REVISION = "46"

require conf/distro/include/sane-srcdates.inc
require conf/distro/include/sane-srcrevs.inc

#Images built can have to modes:
# 'debug': empty rootpassword, strace and gdb 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-gb", d)}'

#Set the right arch for the feeds
#Alphabetically sorted

FEED_ARCH ?= "${TARGET_ARCH}"

#blackfin machines
FEED_ARCH_bfin          = "blackfin"

#armv4t machines

FEED_ARCH_acern30 	= "armv4t"
FEED_ARCH_amsdelta 	= "armv4t"
FEED_ARCH_ep93xx 	= "armv4t"
FEED_ARCH_eteng500 	= "armv4t"
FEED_ARCH_fic-gta01 	= "armv4t"
FEED_ARCH_fic-gta02 	= "armv4t"
FEED_ARCH_h1940 	= "armv4t"
FEED_ARCH_h6300 	= "armv4t"
FEED_ARCH_kb9202 	= "armv4t"
FEED_ARCH_ks8695 	= "armv4t"
FEED_ARCH_rx1950 	= "armv4t"
FEED_ARCH_rx3000 	= "armv4t"
FEED_ARCH_sarge-at91 	= "armv4t"
FEED_ARCH_smdk2440 	= "armv4t"
FEED_ARCH_smdk2443 	= "armv4t"

#armv5t machines

FEED_ARCH_a1200 	= "armv5te"
FEED_ARCH_a780 		= "armv5te"
FEED_ARCH_akita 	= "armv5te"
FEED_ARCH_asus620 	= "armv5te"
FEED_ARCH_asus730 	= "armv5te"
FEED_ARCH_at91sam9263ek = "armv5te"
FEED_ARCH_aximx50 	= "armv5te"
FEED_ARCH_aximx50v 	= "armv5te"
FEED_ARCH_c7x0 		= "armv5te"
FEED_ARCH_compulab-pxa270 = "armv5te"
FEED_ARCH_davinci-dvevm = "armv5te"
FEED_ARCH_devkitidp-pxa255 = "armv5te"
FEED_ARCH_e680 		= "armv5te"
FEED_ARCH_er0100 	= "armv5te"
FEED_ARCH_gumstix 	= "armv5te"
FEED_ARCH_gumstix-verdex = "armv5te"
FEED_ARCH_gumstix-connex = "armv5te"
FEED_ARCH_h1910 	= "armv5te"
FEED_ARCH_h2200 	= "armv5te"
FEED_ARCH_h3900 	= "armv5te"
FEED_ARCH_h4000 	= "armv5te"
FEED_ARCH_h5000 	= "armv5te"
FEED_ARCH_htcalpine 	= "armv5te"
FEED_ARCH_htcapache 	= "armv5te"
FEED_ARCH_htcblueangel 	= "armv5te"
FEED_ARCH_htchimalaya 	= "armv5te"
FEED_ARCH_htcsable 	= "armv5te"
FEED_ARCH_htctornado 	= "armv5te"
FEED_ARCH_htcuniversal 	= "armv5te"
FEED_ARCH_hx2000 	= "armv5te"
FEED_ARCH_hx4700 	= "armv5te"
FEED_ARCH_ixp4xxle 	= "armv5te"
FEED_ARCH_logicpd-pxa270 = "armv5te"
FEED_ARCH_looxc550 	= "armv5te"
FEED_ARCH_lsarm 	= "armv5te"
FEED_ARCH_magician 	= "armv5te"
FEED_ARCH_mainstone 	= "armv5te"
FEED_ARCH_mnci 		= "armv5te"
FEED_ARCH_mtx-3 	= "armv5te"
FEED_ARCH_mx21ads 	= "armv5te"
FEED_ARCH_n2100 	= "armv5te"
FEED_ARCH_navman-icn330 = "armv5te"
FEED_ARCH_netbook-pro 	= "armv5te"
FEED_ARCH_nokia770 	= "armv5te"
FEED_ARCH_rokre2 	= "armv5te"
FEED_ARCH_nslu2le 	= "armv5te"
FEED_ARCH_omap1510inn 	= "armv5te"
FEED_ARCH_omap1610h2 	= "armv5te"
FEED_ARCH_omap1710h3 	= "armv5te"
FEED_ARCH_omap5912osk 	= "armv5te"
FEED_ARCH_palmld 	= "armv5te"
FEED_ARCH_palmt650 	= "armv5te"
FEED_ARCH_palmt680 	= "armv5te"
FEED_ARCH_palmtc 	= "armv5te"
FEED_ARCH_palmtt 	= "armv5te"
FEED_ARCH_palmtt3 	= "armv5te"
FEED_ARCH_palmtt5 	= "armv5te"
FEED_ARCH_palmtx 	= "armv5te"
FEED_ARCH_palmz31 	= "armv5te"
FEED_ARCH_palmz71 	= "armv5te"
FEED_ARCH_palmz72 	= "armv5te"
FEED_ARCH_poodle 	= "armv5te"
FEED_ARCH_qemuarm 	= "armv5te"
FEED_ARCH_spitz 	= "armv5te"
FEED_ARCH_tosa 		= "armv5te"
FEED_ARCH_triton 	= "armv5te"

FEED_ARCH_ixp4xxbe 	= "armv5teb"
FEED_ARCH_nslu2be 	= "armv5teb"

# armv6

FEED_ARCH_mx31ads 	= "armv6"
FEED_ARCH_nokia800	= "armv6"  
FEED_ARCH_omap2420h4	= "armv6"
FEED_ARCH_omap2430sdp   = "armv6"

#i486 machines
FEED_ARCH_geodegx 	= "i486"
FEED_ARCH_geodelx 	= "i486"
FEED_ARCH_netvista 	= "i486"
FEED_ARCH_wrap 		= "i486"
FEED_ARCH_x86 		= "i486"

#i586 machines
FEED_ARCH_epia 		= "i586"
FEED_ARCH_i586-generic 	= "i586"
FEED_ARCH_qemux86 	= "i586"

#i686 machines

FEED_ARCH_alix 		= "i686"
FEED_ARCH_colinux	= "i686"
FEED_ARCH_guinness 	= "i686"
FEED_ARCH_i686-generic 	= "i686"
FEED_ARCH_progear 	= "i686"

#powerpc machines

FEED_ARCH_dht-walnut 	= "ppc405"
FEED_ARCH_magicbox 	= "ppc405"
FEED_ARCH_xilinx-ml403 	= "ppc405"
FEED_ARCH_xilinx-ml410 	= "ppc405"
FEED_ARCH_sequoia 	= "ppc440e"
FEED_ARCH_efika 	= "ppc603e"
FEED_ARCH_lite5200 	= "ppc603e"
FEED_ARCH_lsppchd 	= "ppc603e"
FEED_ARCH_lsppchg 	= "ppc603e"
FEED_ARCH_storcenter 	= "ppc603e"
FEED_ARCH_turbostation 	= "ppc603e"


#strongarm machines, no EABI

FEED_ARCH_collie 	= "arm-oabi"
FEED_ARCH_h3600 	= "arm-oabi"
FEED_ARCH_h3800 	= "arm-oabi"
FEED_ARCH_htcwallaby 	= "arm-oabi"
FEED_ARCH_jornada56x 	= "arm-oabi"
FEED_ARCH_jornada7xx 	= "arm-oabi"
FEED_ARCH_shark 	= "arm-oabi"
FEED_ARCH_simpad 	= "arm-oabi"


#Tweak packaging for strongarm machines since they can't use EABI

PACKAGE_EXTRA_ARCHS_collie = "arm-oabi"
PACKAGE_EXTRA_ARCHS_h3600  = "arm-oabi"
PACKAGE_EXTRA_ARCHS_h3800  = "arm-oabi"
PACKAGE_EXTRA_ARCHS_simpad = "arm-oabi"
PACKAGE_EXTRA_ARCHS_htcwallaby = "arm-oabi"

FEED_URIS += " \
		no-arch##${ANGSTROM_URI}/unstable/feed/all \
		base##${ANGSTROM_URI}/unstable/feed/${FEED_ARCH}/base \
		perl##${ANGSTROM_URI}/unstable/feed/${FEED_ARCH}/perl \
		python##${ANGSTROM_URI}/unstable/feed/${FEED_ARCH}/python \
		debug##${ANGSTROM_URI}/unstable/feed/${FEED_ARCH}/debug \
		gstreamer##${ANGSTROM_URI}/unstable/feed/${FEED_ARCH}/gstreamer \
		${MACHINE}##${ANGSTROM_URI}/unstable/feed/${FEED_ARCH}/machine/${MACHINE}"
#        base##${ANGSTROM_URI}/releases/${DISTRO_VERSION}/feed/${FEED_ARCH}/base \
#        ${MACHINE}##${ANGSTROM_URI}/releases/${DISTRO_VERSION}/feed/${FEED_ARCH}/machine/${MACHINE} \
#        updates##${ANGSTROM_URI}/releases/${DISTRO_VERSION}/feed/${FEED_ARCH}/updates"

#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/ \
		     http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4/sources/ \
		    "


# We will lock down a SRCDATE when we go into release mode
#SRCDATE = "20070703"

#Make sure we use 2.6 on machines with a 2.4/2.6 selector
KERNEL = "kernel26"
MACHINE_KERNEL_VERSION = "2.6"
PCMCIA_MANAGER = "pcmciautils"

#Preferred version for the kernel on various machines
PREFERRED_VERSION_linux-handhelds-2.6               ?= "2.6.21-hh16"
RDEPENDS_kernel-base_hx4700 = ""
RDEPENDS_kernel-base_htcuniversal = ""

# Needed for crappy ipaqs with broken hostap in the kernel
PREFERRED_VERSION_hostap-modules                    ?= "0.4.7"
PREFERRED_VERSION_hostap-utils                      ?= "0.4.7"

PREFERRED_VERSION_file         = "4.18"
PREFERRED_VERSION_file_native  = "4.18"

PREFERRED_VERSION_fontconfig       = "2.4.1"
PREFERRED_VERSION_freetype         = "2.3.4"
PREFERRED_VERSION_freetype-native  = "2.2.1"
PREFERRED_VERSION_cairo            = "1.4.10"
PREFERRED_VERSION_glib-2.0         = "2.12.12"
PREFERRED_VERSION_pango            = "1.16.4"
PREFERRED_VERSION_atk              = "1.10.3"
PREFERRED_VERSION_gtk+             = "2.10.14"

# newer poppler cvs breaks some apps, fix until popper 6 and apps
# catch up with api changes
# PREFERRED_VERSION_poppler          = "0.5.4"

# older gtk-webcore releases don't work on ARM/EABI
# We need to switch to a fixed SRCDATE or release as soon as possible 
PREFERRED_VERSION_osb-browser      = "0.5.0+svn${SRCDATE}"
PREFERRED_VERSION_osb-jscore       = "0.5.2+svn${SRCDATE}"
PREFERRED_VERSION_osb-nrcit        = "0.5.2+svn${SRCDATE}"
PREFERRED_VERSION_osb-nrcore       = "0.5.2+svn${SRCDATE}"

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"

PREFERRED_VERSION_xserver-kdrive    ?= "1.3.0.0"
PREFERRED_VERSION_libxrandr         ?= "1.2.1"
PREFERRED_VERSION_xrandr            ?= "1.2.0" 
PREFERRED_VERSION_randrproto        ?= "1.2.1"

PREFERRED_VERSION_libgnomeui         = "2.18.1"
PREFERRED_VERSION_prismstumbler      = "0.7.3"

#use EABI ready toolchain
PREFERRED_VERSION_gcc               ?= "4.1.2"
PREFERRED_VERSION_gcc-cross         ?= "4.1.2"
PREFERRED_VERSION_gcc-cross-sdk     ?= "4.1.2"
PREFERRED_VERSION_gcc-cross-initial ?= "4.1.2"

PREFERRED_VERSION_binutils          ?= "2.18"
PREFERRED_VERSION_binutils-cross    ?= "2.18"
PREFERRED_VERSION_binutils-cross-sdk ?= "2.18"

#avr32 only has patches for binutils 2.17 and gcc 4.1.2 in OE
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc_avr32 = "avr32-gcc-cross"
PREFERRED_VERSION_avr32-gcc               = "4.1.2"
PREFERRED_VERSION_avr32-gcc-cross         = "4.1.2"
PREFERRED_VERSION_gcc-cross-sdk_avr32     = "4.0.2"
PREFERRED_VERSION_gcc-cross-initial_avr32 = "4.0.2"

PREFERRED_VERSION_binutils_avr32 = "2.17"
PREFERRED_VERSION_binutils-cross_avr32 = "2.17"
PREFERRED_VERSION_binutils-cross-sdk_avr32 = "2.17"

#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.20"
PREFERRED_VERSION_linux-libc-headers_bfin = "2.6.21"

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

#there's is no avr32 patch for 0.9.29
PREFERRED_VERSION_uclibc_avr32 = "0.9.28"
PREFERRED_VERSION_uclibc-initial_avr32 = "0.9.28"

PREFERRED_VERSION_glibc-intermediate_i686 ?= "2.4"
PREFERRED_VERSION_glibc-intermediate ?= "2.5"

PREFERRED_VERSION_glibc-initial ?= "2.5"

# To use an EABI compatible version 3 series gcc, either uncomment 
# the lines below or set them in local.conf: 
#
# PREFERRED_VERSION_gcc-cross = "3.4.4+csl-arm-2005q3"
# PREFERRED_VERSION_gcc-cross-initial = "3.4.4+csl-arm-2005q3"


# Busybox <1.1.0 doesn't have EABI support
PREFERRED_VERSION_busybox = "1.2.1"

PREFERRED_VERSION_dbus ?= "1.0.2"
PREFERRED_VERSION_dbus-glib ?= "0.72"

PREFERRED_VERSION_wpa-supplicant = "0.5.5"


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


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

#Set preferred provider for the C library that is used to build the crosscompiler (NPTL voodoo)
PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc               = "glibc-intermediate"
PREFERRED_PROVIDER_virtual/arm-angstrom-linux-gnueabi-libc-for-gcc    = "glibc-intermediate"
PREFERRED_PROVIDER_virtual/armeb-angstrom-linux-gnueabi-libc-for-gcc  = "glibc-intermediate"
PREFERRED_PROVIDER_virtual/arm-angstrom-linux-libc-for-gcc            = "glibc-intermediate"
PREFERRED_PROVIDER_virtual/powerpc-angstrom-linux-libc-for-gcc        = "glibc-intermediate"
PREFERRED_PROVIDER_virtual/mipsel-angstrom-linux-libc-for-gcc         = "glibc-intermediate"
PREFERRED_PROVIDER_virtual/sparc-angstrom-linux-libc-for-gcc          = "glibc-intermediate"

PREFERRED_PROVIDER_virtual/arm-angstrom-linux-uclibcgnueabi-libc-for-gcc    = "uclibc-initial"
PREFERRED_PROVIDER_virtual/armeb-angstrom-linux-uclibcgnueabi-libc-for-gcc  = "uclibc-initial"

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

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/libxine      ?= "libxine-x11"
PREFERRED_PROVIDER_virtual/xserver      ?= "xserver-kdrive"

# Others:
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"

# 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"

#This is needed to get a correct PACKAGE_ARCH for packages that have PACKAGE_ARCH = ${MACHINE_ARCH}
ARM_ABI ?= "${@['','oabi'][bb.data.getVar('MACHINE',d) in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']]}"
require conf/distro/include/angstrom${ARM_ABI}.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", "", "tslib-tests tslib-calibrate gdb strace procps",d)}'

#this should go away soon
EXTRA_STUFF ?= ""


# Angstrom 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)} \   
    angstrom-version \
    ipkg ipkg-collateral \
    util-linux-mount util-linux-umount \
    avahi-daemon \
    avahi-autoipd \
    ${EXTRA_STUFF} \
    ${DEBUG_APPS} \
    "

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