aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb
blob: 4feb2a669b3a959ce204410c059239534e438803 (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
SUMMARY = "C library and tools for interacting with the linux GPIO character device"
AUTHOR = "Bartosz Golaszewski <bgolaszewski@baylibre.com>"

LICENSE = "LGPLv2.1+"
LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"

SRC_URI = " \
    https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz \
    file://run-ptest \
"

SRC_URI[md5sum] = "28e79f6f70fee1da9079558d8b7b3736"
SRC_URI[sha256sum] = "841be9d788f00bab08ef22c4be5c39866f0e46cb100a3ae49ed816ac9c5dddc7"

inherit autotools pkgconfig python3native ptest

PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev glib-2.0 catch2,bats python3-packaging"
PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"

# Enable cxx bindings by default.
PACKAGECONFIG ?= "cxx"

# Always build tools - they don't have any additional
# requirements over the library.
EXTRA_OECONF = "--enable-tools"

DEPENDS += "autoconf-archive-native"

PACKAGES =+ "${PN}-tools libgpiodcxx ${PN}-python"
FILES_${PN}-tools = " \
    ${bindir}/gpiodetect \
    ${bindir}/gpioinfo \
    ${bindir}/gpioget \
    ${bindir}/gpioset \
    ${bindir}/gpiofind \
    ${bindir}/gpiomon \
"
FILES_${PN}-ptest += " \
    ${bindir}/gpiod-test \
    ${bindir}/gpio-tools-test \
    ${bindir}/gpio-tools-test.bats \
    ${bindir}/gpiod-cxx-test \
    ${bindir}/gpiod_py_test.py \
    ${libdir}/libgpiomockup.so.* \
"
FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*.so"
FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"

RRECOMMENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '', d)}"
RRECOMMENDS_${PN}-ptest += "kernel-module-gpio-mockup"

PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests', '', d)}"

do_install_ptest() {
    if [ "${PREFERRED_PROVIDER_virtual/kernel}" = "linux-yocto" ] && \
       ${@bb.utils.contains('KERNEL_FEATURES', 'features/gpio/mockup.scc', 'false', 'true',d)}; then
        bbwarn "libgpiod test-suites need the gpio-mockup
module and will not work without it. Consider adding
'features/gpio/mockup.scc' to KERNEL_FEATURES"
    fi

    install -d ${D}${PTEST_PATH}/tests

    # These are the core C library tests
    install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/

    # Tools are always built so let's always install them for ptest even if
    # we're not selecting libgpiod-tools.
    install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/
    install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/
    for tool in ${FILES_${PN}-tools}; do
        install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/
    done

    if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then
        install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/
    fi

    if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then
        install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/
    fi
}