summaryrefslogtreecommitdiff
path: root/conf/bitbake.conf
blob: ee93cd485b68109214be33b0309639ac3c728e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
##################################################################
# Recipe Parsing
##################################################################
BBMASK = "/(nonworking|obsolete)/"

##################################################################
# Standard target filesystem layout.
##################################################################

# Path prefixes
layout_prefix = "${prefix}"
layout_exec_prefix = "${exec_prefix}"
layout_base_prefix = "${base_prefix}"

# Base paths
layout_base_bindir = "${base_bindir}"
layout_base_sbindir = "${base_sbindir}"
layout_base_libdir = "${base_libdir}"

# Architecture independent paths
layout_sysconfdir = "${sysconfdir}"
layout_localstatedir = "${localstatedir}"
layout_servicedir = "${servicedir}"
layout_sharedstatedir = "${sharedstatedir}"
layout_datadir = "${datadir}"
layout_infodir = "${infodir}"
layout_mandir = "${mandir}"
layout_docdir = "${docdir}"

# Architecture dependent paths
layout_bindir = "${bindir}"
layout_sbindir = "${sbindir}"
layout_libdir = "${libdir}"
layout_includedir = "${includedir}"
layout_libexecdir = "${libexecdir}"

##################################################################
# Standard target filesystem paths.
##################################################################

# Path prefixes
export base_prefix = ""
export prefix = "/usr"
export exec_prefix = "/usr"

# Base paths
export base_bindir = "${base_prefix}/bin"
export base_sbindir = "${base_prefix}/sbin"
export base_libdir = "${base_prefix}/lib"

# Architecture independent paths
export datadir = "${prefix}/share"
export sysconfdir = "${base_prefix}/etc"
export servicedir = "${base_prefix}/srv"
export sharedstatedir = "${base_prefix}/com"
export localstatedir = "${base_prefix}/var"
export infodir = "${datadir}/info"
export mandir = "${datadir}/man"
export docdir = "${datadir}/doc"

# Architecture dependent paths
export bindir = "${exec_prefix}/bin"
export sbindir = "${exec_prefix}/sbin"
export libexecdir = "${exec_prefix}/libexec"
export libdir = "${exec_prefix}/lib"
export includedir = "${exec_prefix}/include"
export oldincludedir = "${exec_prefix}/include"

#
# These must match the various bbclass layout definitions
#
base_bindir_native = "/bin"
base_sbindir_native = "/sbin"
sysconfdir_native = "/etc"
prefix_native = "/usr"
bindir_native = "${prefix_native}/bin"
sbindir_native = "${prefix_native}/sbin"
includedir_native = "${prefix_native}/include"
libdir_native = "${prefix_native}/lib"
datadir_native = "${prefix_native}/share"
bindir_cross = "/bin"

#
# Cross recipes need to know about the target layout
# := is used carefully here
#
target_datadir := "${datadir}"

##################################################################
# Architecture-dependent build variables.
##################################################################

BUILD_ARCH := "${@os.uname()[4]}"
BUILD_OS := "${@os.uname()[0].lower()}"
BUILD_VENDOR = ""
BUILD_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
BUILD_PREFIX = ""
BUILD_CC_ARCH = ""
BUILD_EXEEXT = ""

HOST_ARCH = "${TARGET_ARCH}"
HOST_OS = "${TARGET_OS}"
HOST_VENDOR = "${TARGET_VENDOR}"
HOST_SYS = "${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}"
HOST_PREFIX = "${TARGET_PREFIX}"
HOST_CC_ARCH = "${TARGET_CC_ARCH}"
HOST_EXEEXT = ""

TARGET_ARCH ?= "INVALID"
TARGET_OS = "INVALID"
TARGET_VENDOR = "${BUILD_VENDOR}"
TARGET_SYS = "${TARGET_ARCH}${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d, 1) == ('' or 'custom')]}"
TARGET_PREFIX = "${TARGET_SYS}-"
TARGET_CC_ARCH = ""
TARGET_EXEEXT = ""

SDK_ARCH ?= "${BUILD_ARCH}"
SDK_OS ?= "${BUILD_OS}"
SDK_VENDOR ?= "${BUILD_VENDOR}"
SDK_SYS = "${SDK_ARCH}${SDK_VENDOR}${@['-' + bb.data.getVar('SDK_OS', d, 1), ''][bb.data.getVar('SDK_OS', d, 1) == ('' or 'custom')]}"
SDK_PREFIX = "${SDK_SYS}-"
SDK_CC_ARCH ?= "${BUILD_CC_ARCH}"
SDK_EXEEXT = ""

# A shortcut for the commonly used value
EXEEXT = "${HOST_EXEEXT}"

BASE_PACKAGE_ARCH = "${HOST_ARCH}"
PACKAGE_ARCH = "${BASE_PACKAGE_ARCH}"
PACKAGE_EXTRA_ARCHS ?= ""
MACHINE_ARCH = "${@[bb.data.getVar('BASE_PACKAGE_ARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))]}"
PACKAGE_ARCHS = "all any noarch ${TARGET_ARCH} ${PACKAGE_EXTRA_ARCHS} ${MACHINE}"

MULTIMACH_ARCH = "${PACKAGE_ARCH}"
MULTIMACH_TARGET_SYS = "${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
MULTIMACH_HOST_SYS = "${MULTIMACH_ARCH}${HOST_VENDOR}-${HOST_OS}"
BASEPKG_HOST_SYS = "${BASE_PACKAGE_ARCH}${HOST_VENDOR}-${HOST_OS}"
BASEPKG_TARGET_SYS = "${BASE_PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}"

# select proper CPU to get binary locales generated
QEMU_OPTIONS = ""
QEMU_OPTIONS_iwmmxt  = "-cpu pxa270-c5"
QEMU_OPTIONS_armv6   = "-cpu arm1136"
QEMU_OPTIONS_armv6-novfp = "-cpu arm1136"
QEMU_OPTIONS_armv7a   = "-cpu cortex-a8"

##################################################################
# Date/time variables.
##################################################################

DATE := "${@time.strftime('%Y%m%d',time.gmtime())}"
TIME := "${@time.strftime('%H%M%S',time.gmtime())}"
DATETIME = "${DATE}${TIME}"

##################################################################
# Openembedded Software Prerequisites.
##################################################################

# python-native should be here but python relies on building 
# its own in staging
ASSUME_PROVIDED = "\
    bc-native \
    bzip2-native \
    cvs-native \
    diffstat-native \
    patch-native \
    perl-native-runtime \
    python-native-runtime \
    svn-native \
    texinfo-native \
    util-linux-native \
    "

##################################################################
# Package default variables.
##################################################################
PN = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0] or 'defaultpkgname'}"
PV = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1] or '1.0'}"
PR = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2] or 'r0'}"
PF = "${PN}-${EXTENDPE}${PV}-${PR}"
EXTENDPE = "${@['','${PE\x7d_'][bb.data.getVar('PE',d,1) > 0]}"
EXTENDPEVER = "${@['','${PE\x7d:'][bb.data.getVar('PE',d,1) > 0]}"
EXTENDPV = "${EXTENDPEVER}${PV}-${PR}${DISTRO_PR}"
P = "${PN}-${PV}"

# Define a PR for kernels that machines can override so things like
# modules get rebuilt
MACHINE_KERNEL_PR = ""

# Base package name
# Automatically derives "foo" from "foo-native", "foo-cross" or "foo-initial"
# otherwise it is the same as PN and P
SPECIAL_PKGSUFFIX = "-native -cross -initial -intermediate -nativesdk -crosssdk -cross-canadian -sdk"
BPN = "${@base_prune_suffix(bb.data.getVar('PN', d, True), bb.data.getVar('SPECIAL_PKGSUFFIX', d, True).split(), d)}"
BP = "${BPN}-${PV}"

# Package info.

SECTION = "base"
PRIORITY = "optional"
DESCRIPTION = "Version ${PV}-${PR} of package ${PN}"
LICENSE = "unknown"
MAINTAINER = "OpenEmbedded Team <openembedded-devel@lists.openembedded.org>"
HOMEPAGE = "unknown"

# Package dependencies and provides.

# Ensure that -dev packages recommend the corresponding -dev packages of their
# deps, and the same for -dbg.
DEPCHAIN_PRE  = ""
DEPCHAIN_POST = "-dev -dbg"

DEPENDS = ""
RDEPENDS = ""
PROVIDES = ""
PROVIDES_prepend = "${P} ${PF} ${PN} "
RPROVIDES = ""

MULTI_PROVIDER_WHITELIST = "virtual/libintl"

SOLIBS = ".so.*"
SOLIBS_darwin = ".*.dylib"
SOLIBS_darwin8 = ".*.dylib"
SOLIBS_darwin9 = ".*.dylib"

SOLIBSDEV = ".so"
SOLIBSDEV_darwin = ".dylib"
SOLIBSDEV_darwin8 = ".dylib"
SOLIBSDEV_darwin9 = ".dylib"

PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-dev ${PN}-static ${PN}-locale"
#enable this when bitbake is upgraded to cope with ++ values in the field
PACKAGES_DYNAMIC = "${PN}-locale-*"
FILES = ""

FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*${SOLIBS} \
            ${sysconfdir} ${sharedstatedir} ${localstatedir} \
            ${base_bindir}/* ${base_sbindir}/* \
            ${base_libdir}/*${SOLIBS} \
            ${datadir}/${PN} ${libdir}/${PN}/* \
            ${datadir}/pixmaps ${datadir}/applications \
            ${datadir}/idl ${datadir}/omf ${datadir}/sounds \
            ${libdir}/bonobo/servers"

FILES_${PN}-doc = "${docdir} ${mandir} ${infodir} ${datadir}/gtk-doc \
            ${datadir}/gnome/help"
SECTION_${PN}-doc = "doc"

FILES_${PN}-static = "${libdir}/*.a ${base_libdir}/*.a"

FILES_${PN}-dev = "${includedir} ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la \
                ${libdir}/*.o ${libdir}/pkgconfig \
                ${base_libdir}/*.o ${datadir}/aclocal ${datadir}/pkgconfig"
SECTION_${PN}-dev = "devel"
ALLOW_EMPTY_${PN}-dev = "1"
RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPV})"

FILES_${PN}-dbg = "${bindir}/.debug ${sbindir}/.debug ${libexecdir}/.debug ${libdir}/.debug \
            ${base_bindir}/.debug ${base_sbindir}/.debug ${base_libdir}/.debug ${libdir}/${PN}/.debug \
            ${libdir}/matchbox-panel/.debug ${datadir}/gdb/autoload"
SECTION_${PN}-dbg = "devel"
ALLOW_EMPTY_${PN}-dbg = "1"
RRECOMMENDS_${PN}-dbg = "${PN} (= ${EXTENDPV})"

FILES_${PN}-locale = "${datadir}/locale"

# File manifest

export MANIFEST = "${FILESDIR}/manifest"

# file:// search paths
FILE_DIRNAME = "${@os.path.dirname(bb.data.getVar('FILE', d))}"
FILESPATHBASE = "${FILE_DIRNAME}"
FILESPATHPKG = "${PF}:${P}:${PN}:${BP}:${BPN}:files:."
FILESPATH = "${@':'.join([os.path.normpath(os.path.join(fp, p, o)) for fp in d.getVar('FILESPATHBASE', 1).split(':') for p in d.getVar('FILESPATHPKG', 1).split(':') for o in (d.getVar('OVERRIDES', 1) + ':').split(':') if os.path.exists(os.path.join(fp, p, o))])}"
FILESDIR = "${@bb.which(d.getVar('FILESPATH', 1), '.')}"

##################################################################
# General work and output directories for the build system.
##################################################################

TMPDIR = "${TOPDIR}/tmp"
CACHE = "${TMPDIR}/cache${@['', '/' + str(bb.data.getVar('MACHINE', d, 1))][bool(bb.data.getVar('MACHINE', d, 1))]}"
CO_DIR = "${DL_DIR}"
CVSDIR = "${CO_DIR}/cvs"
SVNDIR = "${CO_DIR}/svn"
GITDIR = "${CO_DIR}/git"
BZRDIR = "${CO_DIR}/bzr"
HGDIR = "${CO_DIR}/hg"

STAMP = "${TMPDIR}/stamps/${MULTIMACH_TARGET_SYS}/${PF}"
WORKDIR = "${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PF}"
T = "${WORKDIR}/temp"
D = "${WORKDIR}/image"
S = "${WORKDIR}/${BP}"
B = "${S}"

STAGING_DIR = "${TMPDIR}/sysroots"

STAGING_DIR_JAVA = "${STAGING_DIR}/java"
STAGING_DIR_NATIVE = "${STAGING_DIR}/${BUILD_SYS}"
STAGING_BINDIR_NATIVE = "${STAGING_DIR_NATIVE}${bindir_native}"
STAGING_SBINDIR_NATIVE = "${STAGING_DIR_NATIVE}${sbindir_native}"
STAGING_BINDIR_CROSS  = "${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"
STAGING_BINDIR_CROSS_BASEPKG = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_TARGET_SYS}"
STAGING_LIBDIR_NATIVE = "${STAGING_DIR_NATIVE}${libdir_native}"
STAGING_INCDIR_NATIVE = "${STAGING_DIR_NATIVE}${includedir_native}"
STAGING_ETCDIR_NATIVE = "${STAGING_DIR_NATIVE}${sysconfdir_native}"
STAGING_DATADIR_NATIVE = "${STAGING_DIR_NATIVE}${datadir_native}"

# This should really be MULTIMACH_HOST_SYS but that breaks "all" and machine 
# specific packages - hack around it for now.
STAGING_DIR_HOST = "${STAGING_DIR}/${BASEPKG_HOST_SYS}"
STAGING_BINDIR = "${STAGING_DIR_HOST}${bindir}"
STAGING_LIBDIR = "${STAGING_DIR_HOST}${libdir}"
STAGING_INCDIR = "${STAGING_DIR_HOST}${includedir}"
STAGING_ETCDIR = "${STAGING_DIR_HOST}${sysconfdir}"
STAGING_DATADIR = "${STAGING_DIR_HOST}${datadir}"
STAGING_EXECPREFIXDIR = "${STAGING_DIR_HOST}${exec_prefix}"
STAGING_LOADER_DIR = "${STAGING_DIR_HOST}/loader"
STAGING_FIRMWARE_DIR = "${STAGING_DIR_HOST}/firmware"
STAGING_PYDIR = "${STAGING_DIR}/lib/python2.4"

# This should really be MULTIMACH_TARGET_SYS but that breaks "all" and machine 
# specific packages - hack around it for now.
STAGING_DIR_TARGET = "${STAGING_DIR}/${BASEPKG_TARGET_SYS}"

STAGING_DIR_SDK = "${STAGING_DIR}/${SDK_SYS}"

# Setting DEPLOY_DIR outside of TMPDIR is helpful, when you are using
# packaged staging and/or multimachine.
DEPLOY_DIR ?= "${TMPDIR}/deploy"
DEPLOY_DIR_TAR = "${DEPLOY_DIR}/tar"
DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk"
DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm"
DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb"
DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images"
DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools"

PKGDATA_DIR = "${TMPDIR}/pkgdata/${MULTIMACH_TARGET_SYS}"

SDK_NAME = "${DISTRO}/${TARGET_ARCH}"
SDK_PATH = "/usr/local/${SDK_NAME}"
SDKPATH = "${SDK_PATH}"

##################################################################
# Kernel info.
##################################################################

STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_TARGET_SYS}/kernel"

##################################################################
# Specific image creation and rootfs population info.
##################################################################

IMAGE_ROOTFS = "${TMPDIR}/rootfs/${PN}"
IMAGE_BASENAME = "${PN}"
IMAGE_NAME = "${IMAGE_BASENAME}-${MACHINE}-${DATETIME}"
IMAGE_LINK_NAME = "${IMAGE_BASENAME}-${MACHINE}"
IMAGE_EXTRA_SPACE = 10240

UBI_VOLNAME ?= "${MACHINE}-rootfs"

IMAGE_CMD = ""
IMAGE_CMD_jffs2 = "mkfs.jffs2 -x lzo --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}"
IMAGE_CMD_yaffs2 = "mkyaffs2image ${EXTRA_IMAGECMD} ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.yaffs2"
IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}"
IMAGE_CMD_ext2 = "genext2fs -b ${ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}"
IMAGE_CMD_ext2.gz = "install -d ${DEPLOY_DIR_IMAGE}/tmp.gz ; genext2fs -b ${ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz"
IMAGE_CMD_ext3 = "genext2fs -b ${ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD}; tune2fs -j ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3"
IMAGE_CMD_ext3.gz = "install -d ${DEPLOY_DIR_IMAGE}/tmp.gz ; genext2fs -b ${ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD}; tune2fs -j ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3.gz"
IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend"
IMAGE_CMD_squashfs-lzma = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${EXTRA_IMAGECMD} -noappend -comp lzma"
IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ."
IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ."
IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ."
IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio) ${EXTRA_IMAGECMD}"
IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz) ${EXTRA_IMAGECMD}"
IMAGE_CMD_cpio.gz.u-boot = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz) ${EXTRA_IMAGECMD}; mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C gzip -n ${IMAGE_NAME} -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz.u-boot"
IMAGE_CMD_cpio.lzma = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | lzma -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.lzma) ${EXTRA_IMAGECMD}"
IMAGE_CMD_ubi = "echo \[ubifs\] > ubinize.cfg ; echo mode=ubi >> ubinize.cfg ; echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg ; echo vol_id=0 >> ubinize.cfg ; echo vol_type=dynamic >> ubinize.cfg ; echo vol_name=${UBI_VOLNAME} >> ubinize.cfg ; echo vol_flags=autoresize >> ubinize.cfg;mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS} && ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg"
IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}"

EXTRA_IMAGECMD = ""
EXTRA_IMAGECMD_jffs2 = ""
EXTRA_IMAGECMD_yaffs2 = "1"
EXTRA_IMAGECMD_squashfs = ""
EXTRA_IMAGECMD_squashfs-lzma = ""
EXTRA_IMAGECMD_cpio = ""
EXTRA_IMAGECMD_cpio.gz = ""
EXTRA_IMAGECMD_cpio.lzma = ""
EXTRA_IMAGECMD_ubi = ""
EXTRA_IMAGECMD_ubifs = ""

IMAGE_DEPENDS = ""
IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
IMAGE_DEPENDS_yaffs2 = "yaffs2-utils-native"
IMAGE_DEPENDS_cramfs = "cramfs-native"
IMAGE_DEPENDS_ext2 = "genext2fs-native"
IMAGE_DEPENDS_ext2.gz = "genext2fs-native"
IMAGE_DEPENDS_ext3 = "genext2fs-native e2fsprogs-native"
IMAGE_DEPENDS_ext3.gz = "genext2fs-native e2fsprogs-native"
IMAGE_DEPENDS_cpio.gz.u-boot = "u-boot-mkimage-native"
IMAGE_DEPENDS_cpio.lzma = "lzma-native"
IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
IMAGE_DEPENDS_squashfs-lzma = "squashfs-tools-native"
IMAGE_DEPENDS_ubi = "mtd-utils-native"
IMAGE_DEPENDS_ubifs = "mtd-utils-native"

EXTRA_IMAGEDEPENDS = ""

##################################################################
# Toolchain info.
##################################################################

CROSS_DIR = "${TMPDIR}/cross/${BASE_PACKAGE_ARCH}"
CROSS_DATADIR = "${CROSS_DIR}/share"
PATH_prepend = "${STAGING_BINDIR_CROSS}:${STAGING_BINDIR_CROSS_BASEPKG}:${STAGING_SBINDIR_NATIVE}:${STAGING_BINDIR_NATIVE}:${CROSS_DIR}/${bindir_cross}:${STAGING_DIR_NATIVE}${base_sbindir_native}:${STAGING_DIR_NATIVE}${base_bindir_native}:"
export PATH

##################################################################
# Build utility info.
##################################################################

CCACHE = "${@bb.which(bb.data.getVar('PATH', d, 1), 'ccache') and 'ccache '}"
TOOLCHAIN_OPTIONS = ""
TOOLCHAIN_PATH ?= "${CROSS_DIR}"
TOOLCHAIN_SYSPATH ?= "${TOOLCHAIN_PATH}/${TARGET_SYS}"

export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
export CPP = "${HOST_PREFIX}gcc -E${TOOLCHAIN_OPTIONS}"
export LD = "${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS}"
export CCLD = "${CC}"
export AR = "${HOST_PREFIX}ar"
export AS = "${HOST_PREFIX}as"
export RANLIB = "${HOST_PREFIX}ranlib"
export STRIP = "${HOST_PREFIX}strip"
export OBJCOPY = "${HOST_PREFIX}objcopy"
export OBJDUMP = "${HOST_PREFIX}objdump"
export NM = "${HOST_PREFIX}nm"
PYTHON = "${@sys.executable}"

export BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc ${BUILD_CC_ARCH}"
export BUILD_CXX = "${CCACHE}${BUILD_PREFIX}g++ ${BUILD_CC_ARCH}"
export BUILD_F77 = "${CCACHE}${BUILD_PREFIX}g77 ${BUILD_CC_ARCH}"
export BUILD_CPP = "${BUILD_PREFIX}cpp"
export BUILD_LD = "${BUILD_PREFIX}ld"
export BUILD_CCLD = "${BUILD_PREFIX}gcc"
export BUILD_AR = "${BUILD_PREFIX}ar"
export BUILD_RANLIB = "${BUILD_PREFIX}ranlib"
export BUILD_STRIP = "${BUILD_PREFIX}strip"

export MAKE = "make"
EXTRA_OEMAKE = "-e MAKEFLAGS="

##################################################################
# Patch handling.
##################################################################
PATCHTOOL = 'quilt'
PATCHRESOLVE = 'noop'

##################################################################
# Build flags and options.
##################################################################

export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
export CPPFLAGS = "${TARGET_CPPFLAGS}"
export TARGET_CPPFLAGS = "-isystem${STAGING_DIR_TARGET}${includedir}"
export SDK_CPPFLAGS = "-isystem${STAGING_DIR_SDK}${includedir} -isystem${STAGING_DIR_HOST}${includedir}"

export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
export CFLAGS = "${TARGET_CFLAGS}"
export TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
export SDK_CFLAGS = "${SDK_CPPFLAGS} ${SELECTED_OPTIMIZATION}"

export BUILD_CXXFLAGS = "${BUILD_CFLAGS} -fpermissive"
export CXXFLAGS = "${TARGET_CXXFLAGS}"
export TARGET_CXXFLAGS = "${TARGET_CFLAGS} -fpermissive"
export SDK_CXXFLAGS = "${SDK_CFLAGS} -fpermissive"

export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \
                        -Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} \
                        -Wl,-rpath,${STAGING_LIBDIR_NATIVE} -Wl,-O1"

export LDFLAGS = "${TARGET_LDFLAGS}"
export TARGET_LDFLAGS = "-L${STAGING_DIR_TARGET}${libdir} \
                         -Wl,-rpath-link,${STAGING_DIR_TARGET}${libdir} \
                         -Wl,-O1 \
                         ${TARGET_LINK_HASH_STYLE}"
export SDK_LDFLAGS = "-L${STAGING_DIR_SDK}${libdir} \
                         -Wl,-rpath-link,${STAGING_DIR_SDK}${libdir} \
                         -Wl,-O1"

# Which flags to leave by strip-flags() in bin/build/oebuild.sh ?
ALLOWED_FLAGS = "-O -mcpu -march -pipe"

# Pass parallel make options to the compile task only
EXTRA_OEMAKE_prepend_task_do_compile = "${PARALLEL_MAKE} "
EXTRA_OEMAKE_prepend_task-compile = "${PARALLEL_MAKE} "

##################################################################
# Optimization flags.
##################################################################

FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2"
DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer -g"
SELECTED_OPTIMIZATION = "${@bb.data.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][bb.data.getVar('DEBUG_BUILD', d, 1) == '1'], d, 1)}"
BUILD_OPTIMIZATION = "-O2 -g"

##################################################################
# Bootstrap stuff.
##################################################################

BOOTSTRAP_EXTRA_RDEPENDS = ""
BOOTSTRAP_EXTRA_RRECOMMENDS = ""

##################################################################
# Palmtop stuff.
##################################################################

export QTDIR = "${STAGING_DIR_HOST}/qt2"
export QPEDIR = "${STAGING_DIR_HOST}"
export OPIEDIR = "${STAGING_DIR_HOST}"
export palmtopdir = "${libdir}/opie"
export palmqtdir = "${palmtopdir}"

##################################################################
# Download locations and utilities.
##################################################################

OE_STRICT_CHECKSUMS ?= "1"

ADOBE_MIRROR = "http://fpdownload.macromedia.com/get/flashplayer/current/"
APACHE_MIRROR = "http://www.apache.org/dist"
DEBIAN_MIRROR = "ftp://ftp.debian.org/debian/pool"
E_CVS = "cvs://anonymous@anoncvs.enlightenment.org/var/cvs/e" 
E_URI = "http://enlightenment.freedesktop.org/files"
FREEBSD_MIRROR = "ftp://ftp.freebsd.org/pub/FreeBSD/"
FREEDESKTOP_CVS = "cvs://anoncvs:anoncvs@anoncvs.freedesktop.org/cvs"
FREESMARTPHONE_GIT = "git://git.freesmartphone.org"
GENTOO_MIRROR = "http://distfiles.gentoo.org/distfiles"
GNOME_GIT = "git://git.gnome.org"
GNOME_MIRROR = "http://ftp.gnome.org/pub/GNOME/sources"
GNU_MIRROR = "ftp://ftp.gnu.org/gnu"
GPE_MIRROR = "http://gpe.linuxtogo.org/download/source"
GPE_EXTRA_SVN = "svn://projects.linuxtogo.org/svn/gpe/trunk/extra;module=${PN}"
GPE_SVN = "svn://projects.linuxtogo.org/svn/gpe/trunk/base;module=${PN}"
GPEPHONE_MIRROR = "http://gpephone.linuxtogo.org/download/gpephone"
GPEPHONE_SVN = "svn://projects.linuxtogo.org/svn/gpephone/trunk/source;module=${PN}"
HANDHELDS_CVS = "cvs://anoncvs:anoncvs@anoncvs.handhelds.org/cvs"
KERNELORG_MIRROR = "http://kernel.org"
SOURCEFORGE_MIRROR = "http://downloads.sourceforge.net"
XLIBS_MIRROR = "http://xlibs.freedesktop.org/release"
XORG_MIRROR = "http://xorg.freedesktop.org/releases"

# You can use the mirror of your country to get faster downloads by putting
#  export DEBIAN_MIRROR = "ftp://ftp.de.debian.org/debian/pool"
#     into your local.conf

FETCHCMD_svn = "/usr/bin/env svn"
FETCHCMD_cvs = "/usr/bin/env cvs"
FETCHCMD_wget = "/usr/bin/env wget -t 5 --no-check-certificate"
FETCHCMD_bzr = "/usr/bin/env bzr"
FETCHCMD_hg = "/usr/bin/env hg"

FETCHCOMMAND = "ERROR, this must be a BitBake bug"
FETCHCOMMAND_wget = "/usr/bin/env 'PATH=${PATH}' wget -t 5 --passive-ftp --no-check-certificate -P ${DL_DIR} '${URI}'"
FETCHCOMMAND_cvs = "/usr/bin/env 'PATH=${PATH}' cvs '-d${CVSROOT}' co ${CVSCOOPTS} ${CVSMODULE}"
FETCHCOMMAND_svn = "/usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT} ${SVNMODULE}"
RESUMECOMMAND = "ERROR, this must be a BitBake bug"
RESUMECOMMAND_wget = "/usr/bin/env 'PATH=${PATH}' wget -c -t 5 --passive-ftp --no-check-certificate -P ${DL_DIR} '${URI}'"
UPDATECOMMAND = "ERROR, this must be a BitBake bug"
UPDATECOMMAND_cvs = "/usr/bin/env 'PATH=${PATH}' cvs -d${CVSROOT} update -d -P ${CVSCOOPTS}"
UPDATECOMMAND_svn = "/usr/bin/env svn update ${SVNCOOPTS}"
SRCDATE = "${DATE}"
SRCREV = "1"
SRCPV = "${@bb.fetch.get_srcrev(d)}"
AUTOREV = "${SRCPV}"

# For now disable autoincrement of revision counter in SRCPV, whoever wants it, should enable it in local.conf or distro config
# Revision counter is incremented only locally (bad for multiple builders filling shared feeds), LOCALCOUNT can be used to maintain
# counter globally in OE metadata (LOCALCOUNT value set in recipe).
# Make sure you disable it, if you want always upgradable paths for git recipes without bumping LOCALCOUNT with every SRCREV change
# or if you're using AUTOREV feature.
BB_LOCALCOUNT_OVERRIDE = "1"

# Value for revision counter in GIT recipes (NNNN in PV="1.0+gitrNNNN+a7401084a72285c8d3485bacf4eed593f303b1b7-r4.4")
LOCALCOUNT = "0"

SRC_URI = "file://${FILE}"

##################################################################
# UI/Interaction Configuration
##################################################################

SHELLRCCMD = "bash --rcfile $TERMRCFILE"
export SHELLCMDS = "${SHELLRCCMD}"
# Some common terminal programs to choose from
GNOME_TERMCMD = 'gnome-terminal --disable-factory -t "$TERMWINDOWTITLE"'
GNOME_TERMCMDRUN = '${GNOME_TERMCMD} -x $SHELLCMDS'
SCREEN_TERMCMD = 'screen -D -m -t "$TERMWINDOWTITLE"'
SCREEN_TERMCMDRUN = '${SCREEN_TERMCMD} $SHELLCMDS'
XTERM_TERMCMD = 'xterm -T "$TERMWINDOWTITLE"'
XTERM_TERMCMDRUN = '${XTERM_TERMCMD} -e $SHELLCMDS'
KONSOLE_TERMCMD = 'konsole -T "$TERMWINDOWTITLE"'
KONSOLE_TERMCMDRUN = '${KONSOLE_TERMCMD} -e $SHELLCMDS'

# Set a default
TERMCMD ?= "${GNOME_TERMCMD}"
TERMCMDRUN ?= "${GNOME_TERMCMDRUN}"

##################################################################
# Miscellaneous utilities.
##################################################################

MKTEMPDIRCMD = "mktemp -d -q ${TMPBASE}"
MKTEMPCMD = "mktemp -q ${TMPBASE}"

# GNU patch tries to be intellgent about checking out read-only files from
# a RCS, which freaks out those special folks with active Perforce clients
# the following makes patch ignore RCS:

export PATCH_GET="0"

# Program to be used to build ipkg packages

IPKGBUILDCMD = "ipkg-build -o 0 -g 0"

##################################################################
# Not sure about the rest of this yet.
##################################################################

# slot - currently unused by OE. portage remnants
SLOT = "0"

# Other

export PKG_CONFIG_DIR = "${STAGING_DIR}/${BASE_PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}${libdir}/pkgconfig"
export PKG_CONFIG_PATH = "${PKG_CONFIG_DIR}:${STAGING_DATADIR}/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR}/${BASE_PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
export PKG_CONFIG_DISABLE_UNINSTALLED = "yes"

export XDG_DATA_DIRS = "${STAGING_DATADIR}"

export QMAKE_MKSPEC_PATH = "${STAGING_DATADIR_NATIVE}/qmake"
export STAGING_SIPDIR = "${STAGING_DATADIR_NATIVE}/sip"
export STAGING_IDLDIR = "${STAGING_DATADIR}/idl"

# library package naming
AUTO_LIBNAME_PKGS = "${PACKAGES}"

# Globally toggle certain dependencies
ENTERPRISE_DISTRO ?= "0"

# Pre-build configuration output

BUILDCFG_HEADER = "Build Configuration:"
BUILDCFG_VARS ?= "BB_VERSION METADATA_BRANCH METADATA_REVISION TARGET_ARCH TARGET_OS MACHINE DISTRO DISTRO_VERSION"
BUILDCFG_VARS_append_arm = " TARGET_FPU"
BUILDCFG_VARS_append_armeb = " TARGET_FPU"
BUILDCFG_NEEDEDVARS ?= "TARGET_ARCH TARGET_OS"

###
### Config file processing
###

# Overrides are processed left to right, so the ones that are named later take precedence.
# You generally want them to go from least to most specific.
# 
# This means that an envionment variable named '<foo>_arm' overrides an
# environment variable '<foo>' (when ${TARGET_ARCH} is arm).
# an environment variable '<foo>_ramses' overrides '<foo>' but doesn't override
# '<foo>_arm' when ${MACHINE} is 'ramses'. 
# If you use combination ie '<foo>_arm_ramses', then '<foo>_arm_ramses' will override 
# '<foo>_arm' and then '<foo>' will be overriden with that value from '<foo>_arm'.
# And finally '<foo>_local' overrides anything, but with lowest priority.
#
# This works for  functions as well, they are really just environment variables.
# Default OVERRIDES to make compilation fail fast in case of build system misconfiguration.
OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:fail-fast:pn-${PN}"
# Alternative OVERRIDES definition without "fail fast", usually only for native building and Scratchbox toolchains.
#OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:pn-${PN}"

##################################################################
# Include the rest of the config files.
##################################################################

include conf/site.conf
include conf/auto.conf
include conf/local.conf
# USERDISTRO should always contain original DISTRO value as set by user
# If a distro config overrides DISTRO for whatever reason (e.g. to get
# overrides like it wants), USERDISTRO must be reassigned with := first
USERDISTRO = "${DISTRO}"
include conf/build/${BUILD_SYS}.conf
include conf/target/${TARGET_SYS}.conf
include conf/machine/${MACHINE}.conf
include conf/distro/${DISTRO}.conf
include conf/documentation.conf
require conf/sanity.conf
require conf/abi_version.conf
require conf/enterprise.conf
require conf/compatibility-providers.conf

##################################################################
# Weak variables (usually to retain backwards compatibility)
##################################################################

DL_DIR ?= "${TMPDIR}/downloads"
PSTAGE_DIR ?= "${TMPDIR}/pstage"
IMAGE_FSTYPES ?= "tar.gz"
PCMCIA_MANAGER ?= "pcmcia-cs"
DEFAULT_TASK_PROVIDER ?= "task-base"
MACHINE_TASK_PROVIDER ?= "${DEFAULT_TASK_PROVIDER}"
IMAGE_ROOTFS_SIZE ?= "65536"
IMAGE_ROOTFS_SIZE_ext2 ?= "65536"
IMAGE_ROOTFS_SIZE_ext2.gz ?= "65536"
IMAGE_ROOTFS_SIZE_ext3 ?= "65536"
IMAGE_ROOTFS_SIZE_ext3.gz ?= "65536"
DISTRO_PR ?= ""

# Forcefully set CACHE now so future changes to things like 
# MACHINE don't change the path to the cache
CACHE := "${CACHE}"

# Default to disabling packaged staging code
export PSTAGING_ACTIVE = "0"

##################################################################
# Magic Cookie for SANITY CHECK
##################################################################
OES_BITBAKE_CONF = "1"

##################################################################
# Machine properties and task-base stuff
##################################################################

MACHINE_FEATURES ?= "kernel26"
DISTRO_FEATURES ?= ""

# This is used to limit what packages goes into images built, so set big by default
ROOT_FLASH_SIZE ?= "256"

MACHINE_GUI_CLASS ?= "smallscreen"
# GUI_MACHINE_CLASS is deprecated, please use MACHINE_GUI_CLASS instead
GUI_MACHINE_CLASS ?= "${MACHINE_GUI_CLASS}"
MACHINE_DISPLAY_WIDTH_PIXELS ?= "240"
MACHINE_DISPLAY_HEIGHT_PIXELS ?= "320"
MACHINE_DISPLAY_ORIENTATION ?= "0"
MACHINE_DISPLAY_BPP ?= "16"

DISTRO_EXTRA_RDEPENDS ?= ""
DISTRO_EXTRA_RRECOMMENDS ?= ""
MACHINE_EXTRA_RDEPENDS ?= ""
MACHINE_EXTRA_RRECOMMENDS ?= ""
MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""

COMBINED_FEATURES = "\
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "alsa", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "bluetooth", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "ext2", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "vfat", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "irda", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "pcmcia", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "pci", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "usbgadget", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "usbhost", d)} \
    ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "wifi", d)}"

# We want madwifi if all of the following are true:
# - distro has pci, wifi, and madwifi in its features
# - machine has pci in its features
COMBINED_FEATURES += "${@base_ifelse( \
    base_contains('DISTRO_FEATURES', ('pci', 'wifi', 'madwifi'), True, False, d) and \
    base_contains('MACHINE_FEATURES', 'pci', True, False, d), \
    'madwifi', '')}"

# We want hostap if all of the following are true:
# - 'wifi' and 'hostap' are in distro features
# - either 'pci' or 'pcmcia' are in both distro and machine features
COMBINED_FEATURES += "${@base_ifelse( \
    base_contains('DISTRO_FEATURES', ('wifi', 'hostap'), True, False, d) and \
    ((base_contains('MACHINE_FEATURES', 'pci', True, False, d) and \
      base_contains('DISTRO_FEATURES', 'pci', True, False, d)) or \
     (base_contains('MACHINE_FEATURES', 'pcmcia', True, False, d) and \
      base_contains('DISTRO_FEATURES', 'pcmcia', True, False, d))), \
    'hostap', '')}"

# Make sure MACHINE isn't exported
# (breaks binutils at least)
MACHINE[unexport] = "1"

# Make sure TARGET_ARCH isn't exported
# (breaks Makefiles using implicit rules, e.g. quilt, as GNU make has this
# in them, undocumented)
TARGET_ARCH[unexport] = "1"

# Make sure DISTRO isn't exported
# (breaks sysvinit at least)
DISTRO[unexport] = "1"