blob: 7998b0c1555a9fdaa1868db98a7f604749bf74e8 [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}"
Andrew Geissler3eeda902023-05-19 10:14:02 -05009SRCREV = "721e3a1cbd7e2b6361bb439d3959e7403e4f0092"
Brad Bishop19323692019-04-05 15:28:33 -040010SRCBRANCH = "master"
11SRC_URI = " \
Andrew Geissler595f6302022-01-24 19:11:47 +000012 git://github.com/libusbgx/libusbgx.git;branch=${SRCBRANCH};protocol=https \
Andrew Geissler3eeda902023-05-19 10:14:02 -050013 file://0001-libusbgx-Add-interface-name-for-NCM-Feature-Descript.patch \
14 file://0001-fix-stack-buffer-overflow-in-usbg_f_foo_attr_val-pro.patch \
Brad Bishop19323692019-04-05 15:28:33 -040015 file://gadget-start \
16 file://usbgx.initd \
17 file://usbgx.service \
18"
19
20S = "${WORKDIR}/git"
21
Andrew Geissler87f5cff2022-09-30 13:13:31 -050022PACKAGECONFIG ??= "examples gadget-schemes libconfig"
23PACKAGECONFIG[libconfig] = "--with-libconfig=yes,--without-libconfig,libconfig"
24PACKAGECONFIG[examples] = "--enable-examples,--disable-examples"
25PACKAGECONFIG[gadget-schemes] = "--enable-gadget-schemes,--disable-gadget-schemes"
26PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,cmocka"
Brad Bishop19323692019-04-05 15:28:33 -040027
Patrick Williams975a06f2022-10-21 14:42:47 -050028PACKAGE_BEFORE_PN = "${@bb.utils.contains('PACKAGECONFIG', 'examples', '${PN}-examples', '', d)}"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050029
30SYSTEMD_PACKAGES = "${PN}-examples"
31SYSTEMD_SERVICE:${PN}-examples = "usbgx.service"
32SYSTEMD_AUTO_ENABLE:${PN}-examples = "${@bb.utils.contains('PACKAGECONFIG', 'examples', 'enable', 'disable', d)}"
33
Patrick Williams975a06f2022-10-21 14:42:47 -050034INITSCRIPT_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'examples', '${PN}-examples', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -040035INITSCRIPT_NAME = "usbgx"
36INITSCRIPT_PARAMS = "defaults"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050037INHIBIT_UPDATERCD_BBCLASS = "${@bb.utils.contains('PACKAGECONFIG', 'examples', '1', '0', d)}"
Brad Bishop19323692019-04-05 15:28:33 -040038
Patrick Williams213cb262021-08-07 19:21:33 -050039do_install:append() {
Andrew Geissler3eeda902023-05-19 10:14:02 -050040 install -Dm 0755 ${WORKDIR}/gadget-start ${D}${bindir}/gadget-start
41 sed -i -e 's,/usr/bin,${bindir},g' -e 's,/etc,${sysconfdir},g' ${D}${bindir}/gadget-start
42
Brad Bishop19323692019-04-05 15:28:33 -040043 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
44 install -Dm 0644 ${WORKDIR}/usbgx.service ${D}${systemd_system_unitdir}/usbgx.service
45 fi
Andrew Geissler87f5cff2022-09-30 13:13:31 -050046
Brad Bishop19323692019-04-05 15:28:33 -040047 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
Andrew Geissler87f5cff2022-09-30 13:13:31 -050048 install -Dm 0755 ${WORKDIR}/usbgx.initd ${D}${sysconfdir}/init.d/usbgx
49 fi
Brad Bishop19323692019-04-05 15:28:33 -040050}
51
Andrew Geissler87f5cff2022-09-30 13:13:31 -050052FILES:${PN}-examples = "${bindir}/* ${sysconfdir}/*"
53RDEPENDS:${PN}-examples += "${@bb.utils.contains('PACKAGECONFIG', 'examples', 'libusbgx-config', '', d)}"
Andrew Geisslerd688a012020-09-18 13:36:00 -050054
55ALTERNATIVE_PRIORITY = "90"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050056ALTERNATIVE:${PN}-examples = "${@bb.utils.contains('PACKAGECONFIG', 'examples', 'gadget-acm-ecm show-gadgets', '', d)}"
Andrew Geisslerd688a012020-09-18 13:36:00 -050057ALTERNATIVE_LINK_NAME[gadget-acm-ecm] = "${bindir}/gadget-acm-ecm"
58ALTERNATIVE_LINK_NAME[show-gadgets] = "${bindir}/show-gadgets"