Skip to content

Instantly share code, notes, and snippets.

@dir-ableton
Created March 8, 2020 14:45
Show Gist options
  • Save dir-ableton/7ad9045e242165a9e4707c84e6df754b to your computer and use it in GitHub Desktop.
Save dir-ableton/7ad9045e242165a9e4707c84e6df754b to your computer and use it in GitHub Desktop.
pigpio yocto recipe
DESCRIPTION = "pigpio "
SECTION = "devtools"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://UNLICENSED"
SRC_URI = "git://github.com/joan2937/pigpio.git;protocol=https;tag=v74"
S = "${WORKDIR}/git"
DEPENDS = "curl glib-2.0 openssl attr gpgme libxml2"
inherit pkgconfig cmake
do_install() {
install -d ${D}${bindir}
install -m 0755 pigpiod ${D}${bindir}
}
@ramok
Copy link

ramok commented Jul 5, 2022

In case someone need it:
pigpio_v79.bb

SUMMARY = "pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO)"
DESCRIPTION = "pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO)"
AUTHOR = "<komar@evologics.de>"

# FIXME: find out right license
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://UNLICENCE;md5=61287f92700ec1bdf13bc86d8228cd13"

SECTION = "utils"

SRC_URI = "git://github.com/joan2937/pigpio.git;protocol=https;tag=${PV}"

S = "${WORKDIR}/git"

EXTRA_OEMAKE += "CC='${CC}'"
EXTRA_OEMAKE += "CROSS_PREFIX=${TARGET_PREFIX}"
# we don't need to strip, it will be stripped by build system
EXTRA_OEMAKE += "STRIP=echo"
EXTRA_OEMAKE += "PYINSTALLARGS='--root=$(DESTDIR) --prefix=${prefix}'"
TARGET_CC_ARCH += "${LDFLAGS}"

# gpio package will be empty with depends from all packages
ALLOW_EMPTY_${PN} = "1"
ALLOW_EMPTY_${PN}-dbg = "0"
ALLOW_EMPTY_${PN}-dev = "0"

FILES_${PN}-bin-pigs    = "${bindir}/pigs"
FILES_${PN}-bin-pig2vcd = "${bindir}/pig2vcd"

FILES_${PN}-bin-pigpiod    = "${bindir}/pigpiod"
RDEPENDS_${PN}-bin-pigpiod = "lib${PN}"

# *-bin package will be empty with depends from all *-bin-* packages
RDEPENDS_${PN}-bin = " ${PN}-bin-pigpiod ${PN}-bin-pigs ${PN}-bin-pig2vcd"
ALLOW_EMPTY_${PN}-bin = "1"

FILES_lib${PN}  = "${libdir}/lib${PN}.so.*"
FILES_lib${PN}  =+ "/opt/${PN}/cgi"

FILES_lib${PN}_if  = "${libdir}/lib${PN}_if.so.*"
FILES_lib${PN}_if2 = "${libdir}/lib${PN}_if2.so.*"

#FILES_${PN}-dev = "${includedir}/*.h"
FILES_${PN}-dev += "${libdir}/lib${PN}*.so"
FILES_${PN}-doc = "${mandir}"

FILES_${PN}-python2 = "${libdir}/python2*/*"
FILES_${PN}-python3 = "${libdir}/python3*/*"

PACKAGES =+ " ${PN}-bin-pigpiod ${PN}-bin-pigs ${PN}-bin-pig2vcd \
              lib${PN} lib${PN}_if lib${PN}_if2 \
              ${PN}-python2 ${PN}-python3"

do_install() {
    oe_runmake install DESTDIR=${D} prefix=${prefix} mandir=${mandir}
}

inherit lib_package

@IvanVeloz
Copy link

Thanks for sharing! The license is this:

LICENSE = "Unlicense"
LIC_FILES_CHKSUM = "file://UNLICENSE;md5=61287f92700ec1bdf13bc86d8228cd13"

And kirkstone changed the way it works with git. It doesn't like using tags (not deterministic) and asks for the branch. So I changed it to this:

SRC_URI = "git://github.com/joan2937/pigpio.git;protocol=https;branch=master"
SRCREV = "c33738a320a3e28824af7807edafda440952c05d"

@IvanVeloz
Copy link

IvanVeloz commented May 19, 2024

Updated the syntax (was causing "Yocto Files/directories were installed but not shipped in any package issue").

SUMMARY = "pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO)."
DESCRIPTION = "pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO)."
SECTION = "utils"
LICENSE = "Unlicense"
LIC_FILES_CHKSUM = "file://UNLICENCE;md5=61287f92700ec1bdf13bc86d8228cd13"

SRC_URI = "git://github.com/joan2937/pigpio.git;protocol=https;branch=master"
SRCREV = "c33738a320a3e28824af7807edafda440952c05d"

S = "${WORKDIR}/git"

EXTRA_OEMAKE += "CC='${CC}'"
EXTRA_OEMAKE += "CROSS_PREFIX=${TARGET_PREFIX}"
# we don't need to strip, it will be stripped by build system
EXTRA_OEMAKE += "STRIP=echo"
EXTRA_OEMAKE += "PYINSTALLARGS='--root=$(DESTDIR) --prefix=${prefix}'"
TARGET_CC_ARCH += "${LDFLAGS}"

# gpio package will be empty with depends from all packages
ALLOW_EMPTY:${PN} = "1"
ALLOW_EMPTY:${PN}-dbg = "0"
ALLOW_EMPTY:${PN}-dev = "0"

FILES:${PN}-bin-pigs    = "${bindir}/pigs"
FILES:${PN}-bin-pig2vcd = "${bindir}/pig2vcd"

FILES:${PN}-bin-pigpiod    = "${bindir}/pigpiod"
RDEPENDS:${PN}-bin-pigpiod = "lib${PN}"

# *-bin package will be empty with depends from all *-bin-* packages
RDEPENDS:${PN}-bin = " ${PN}-bin-pigpiod ${PN}-bin-pigs ${PN}-bin-pig2vcd"
ALLOW_EMPTY:${PN}-bin = "1"

FILES:lib${PN}  = "${libdir}/lib${PN}.so.*"
FILES:lib${PN}  =+ "/opt/${PN}/cgi"

FILES:lib${PN}_if  = "${libdir}/lib${PN}_if.so.*"
FILES:lib${PN}_if2 = "${libdir}/lib${PN}_if2.so.*"

#FILES:${PN}-dev = "${includedir}/*.h"
FILES:${PN}-dev += "${libdir}/lib${PN}*.so"
FILES:${PN}-doc = "${mandir}"

FILES:${PN}-python2 = "${libdir}/python2*/*"
FILES:${PN}-python3 = "${libdir}/python3*/*"

PACKAGES =+ " ${PN}-bin-pigpiod ${PN}-bin-pigs ${PN}-bin-pig2vcd \
              lib${PN} lib${PN}_if lib${PN}_if2 \
              ${PN}-python2 ${PN}-python3"

do_install() {
    oe_runmake install DESTDIR=${D} prefix=${prefix} mandir=${mandir}
}

inherit lib_package

@IvanVeloz
Copy link

I also added the systemd unit file (but have not tested on a configuration without systemd). See below:

https://gist.github.com/IvanVeloz/d2d9aaaf60218cc35335f05e2c344781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment