summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mtac_4.0.0.bb
blob: e6038a92382dde2a035d0cc0184c9127b3964519 (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
DESCRIPTION = "mtac drivers"
HOMEPAGE = "http://www.multitech.net/"
SECTION = "base"
PRIORITY = "optional"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
DEPENDS = "virtual/kernel mts-io"
INC_PR = "r0"

SRCREV = "${PV}"

PR = "${INC_PR}.0-${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}"

SRC_URI = " \
    git://git.multitech.net/mtac.git;protocol=git \
"
S = "${WORKDIR}/git"

inherit module

EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \
                KBUILD_VERBOSE=1 \
                M=${S} \
                modules \
                "

do_compile () {
    bbnote make   "$@"
    make   "$@"
    unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
    oe_runmake
}

L1 = "${STAGING_KERNEL_DIR}/include/linux/"

# Bitbake/Yocto automatically installs in to L2.
L2 = "${STAGING_INCDIR}/linux/"

L3 = "${D}/usr/include/linux/"

PACKAGES = "kernel-module-${PN} ${PN}-dev"

FILES_kernel-module-${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mtac.ko"

FILES_${PN}-dev += "/usr/include/linux/mtac.h"

PARALLEL_MAKE = ""

fakeroot do_install () {
    install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra
    install -d ${D}/usr/include/linux/
    # use cp instead of install so the driver doesn't get stripped
    cp ${S}/mtac.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra
    install -m 0644 ${S}/mtac.h ${L1}
    install -m 0644 ${S}/mtac.h ${L3}
}

# Yocto seems to insist on Python for this function
# This function is to make debugging easier, so the package
# can be built a 2nd time.
fakeroot do_cleansstate_prepend() {
    L1 = d.getVar("L1",True)
    L2 = d.getVar("L2",True)
    bb.note("L1 is " + L1)
    bb.note("L2 is " + L2)

    F1 = L1 + "/mtac.h"
    F2 = L2 + "/mtac.h"
    if os.path.exists(F1):
        os.remove(F1)
    if os.path.exists(F2):
        os.remove(F2)
}