1DESCRIPTION = "Package that provides access to GPIO and other IO\
2functions on the Broadcom BCM 2835 chip, allowing access to the\
3GPIO pins on the 26 pin IDE plug on the RPi board"
4SECTION = "base"
5HOMEPAGE = "http://www.open.com.au/mikem/bcm2835"
6AUTHOR = "Mike McCauley (mikem@open.com.au)"
7
8LICENSE = "GPL-3.0-only"
9LIC_FILES_CHKSUM = "file://COPYING;md5=e49f4652534af377a713df3d9dec60cb"
10
11COMPATIBLE_MACHINE = "^rpi$"
12
13SRC_URI = "http://www.airspayce.com/mikem/bcm2835/bcm2835-${PV}.tar.gz"
14
15SRC_URI[sha256sum] = "e67a986462618988a5a86752e36e3ebdd7c5cae66940ff7330aea243b2762525"
16
17inherit autotools
18
19do_compile:append() {
20    # Now compiling the examples provided by the package
21    mkdir -p ${B}/examples/spiram
22    for file in `ls ${S}/examples`; do
23        example="$file"
24        if [ "$file" = "spiram" ]; then
25	    # This includes a tiny library
26            EXAMPLE_LDFLAGS="-L${B}/examples/spiram -lspiram"
27            example="spiram_test"
28            ${CC} ${CFLAGS} -c ${S}/examples/spiram/spiram.c -o ${B}/examples/spiram/libspiram.o -I${S}/src -I${S}/examples/spiram
29            rm -f ${B}/examples/spiram/libspiram.a && ${BUILD_AR} crD ${B}/examples/spiram/libspiram.a ${B}/examples/spiram/libspiram.o
30	fi
31        ${CC} ${LDFLAGS} ${S}/examples/${file}/${example}.c -o ${B}/examples/${example} -Bstatic -L${B}/src -lbcm2835 ${EXAMPLE_LDFLAGS} -I${S}/src
32    done
33}
34
35do_install:append() {
36    install -d ${D}/${libdir}/${BPN}
37    for example in $(find ${B}/examples -type f -maxdepth 1)
38    do
39        install -m 0755 ${example} ${D}/${libdir}/${BPN}
40    done
41}
42
43PACKAGES += "${PN}-tests"
44
45RDEPENDS:${PN}-dev = ""
46
47FILES:${PN} = ""
48FILES:${PN}-tests = "${libdir}/${BPN}"
49FILES:${PN}-dbg += "${libdir}/${BPN}/.debug"
50