blob: 11e88935ef839336127fca9917169a384dc96a06 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "USB Gadget neXt Configfs Library"
Andrew Geissler9aee5002022-03-30 16:27:02 +00002LICENSE = "GPL-2.0-only & LGPL-2.1-only"
Brad Bishop19323692019-04-05 15:28:33 -04003LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
4 file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c"
5
Andrew Geisslerd688a012020-09-18 13:36:00 -05006inherit autotools pkgconfig systemd update-rc.d update-alternatives
Brad Bishop19323692019-04-05 15:28:33 -04007
8PV = "0.2.0+git${SRCPV}"
9SRCREV = "45c14ef4d5d7ced0fbf984208de44ced6d5ed898"
10SRCBRANCH = "master"
11SRC_URI = " \
Andrew Geissler595f6302022-01-24 19:11:47 +000012 git://github.com/libusbgx/libusbgx.git;branch=${SRCBRANCH};protocol=https \
Brad Bishop19323692019-04-05 15:28:33 -040013 file://gadget-start \
14 file://usbgx.initd \
15 file://usbgx.service \
16"
17
18S = "${WORKDIR}/git"
19
Andrew Geissler87f5cff2022-09-30 13:13:31 -050020PACKAGECONFIG ??= "examples gadget-schemes libconfig"
21PACKAGECONFIG[libconfig] = "--with-libconfig=yes,--without-libconfig,libconfig"
22PACKAGECONFIG[examples] = "--enable-examples,--disable-examples"
23PACKAGECONFIG[gadget-schemes] = "--enable-gadget-schemes,--disable-gadget-schemes"
24PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,cmocka"
Brad Bishop19323692019-04-05 15:28:33 -040025
Patrick Williams975a06f2022-10-21 14:42:47 -050026PACKAGE_BEFORE_PN = "${@bb.utils.contains('PACKAGECONFIG', 'examples', '${PN}-examples', '', d)}"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050027
28SYSTEMD_PACKAGES = "${PN}-examples"
29SYSTEMD_SERVICE:${PN}-examples = "usbgx.service"
30SYSTEMD_AUTO_ENABLE:${PN}-examples = "${@bb.utils.contains('PACKAGECONFIG', 'examples', 'enable', 'disable', d)}"
31
Patrick Williams975a06f2022-10-21 14:42:47 -050032INITSCRIPT_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'examples', '${PN}-examples', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -040033INITSCRIPT_NAME = "usbgx"
34INITSCRIPT_PARAMS = "defaults"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050035INHIBIT_UPDATERCD_BBCLASS = "${@bb.utils.contains('PACKAGECONFIG', 'examples', '1', '0', d)}"
Brad Bishop19323692019-04-05 15:28:33 -040036
Patrick Williams213cb262021-08-07 19:21:33 -050037do_install:append() {
Brad Bishop19323692019-04-05 15:28:33 -040038 install -Dm 0755 ${WORKDIR}/gadget-start ${D}/${bindir}/gadget-start
39 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
40 install -Dm 0644 ${WORKDIR}/usbgx.service ${D}${systemd_system_unitdir}/usbgx.service
41 fi
Andrew Geissler87f5cff2022-09-30 13:13:31 -050042
Brad Bishop19323692019-04-05 15:28:33 -040043 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
Andrew Geissler87f5cff2022-09-30 13:13:31 -050044 install -Dm 0755 ${WORKDIR}/usbgx.initd ${D}${sysconfdir}/init.d/usbgx
45 fi
Brad Bishop19323692019-04-05 15:28:33 -040046}
47
Andrew Geissler87f5cff2022-09-30 13:13:31 -050048FILES:${PN}-examples = "${bindir}/* ${sysconfdir}/*"
49RDEPENDS:${PN}-examples += "${@bb.utils.contains('PACKAGECONFIG', 'examples', 'libusbgx-config', '', d)}"
Andrew Geisslerd688a012020-09-18 13:36:00 -050050
51ALTERNATIVE_PRIORITY = "90"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050052ALTERNATIVE:${PN}-examples = "${@bb.utils.contains('PACKAGECONFIG', 'examples', 'gadget-acm-ecm show-gadgets', '', d)}"
Andrew Geisslerd688a012020-09-18 13:36:00 -050053ALTERNATIVE_LINK_NAME[gadget-acm-ecm] = "${bindir}/gadget-acm-ecm"
54ALTERNATIVE_LINK_NAME[show-gadgets] = "${bindir}/show-gadgets"