<commit_before>SUMMARY = "USB Gadget neXt Configfs Library"
LICENSE = "GPL-2.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                    file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c"

DEPENDS = "libconfig"

inherit autotools pkgconfig systemd update-rc.d update-alternatives

PV = "0.2.0+git${SRCPV}"
SRCREV = "45c14ef4d5d7ced0fbf984208de44ced6d5ed898"
SRCBRANCH = "master"
SRC_URI = " \
    git://github.com/libusbgx/libusbgx.git;branch=${SRCBRANCH};protocol=https \
    file://gadget-start \
    file://usbgx.initd \
    file://usbgx.service \
"

S = "${WORKDIR}/git"

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = "usbgx.service"

INITSCRIPT_NAME = "usbgx"
INITSCRIPT_PARAMS = "defaults"

EXTRA_OECONF = "--includedir=${includedir}/usbgx"

do_install:append() {
    install -Dm 0755 ${WORKDIR}/gadget-start ${D}/${bindir}/gadget-start
    if ${<EMAIL>.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
        install -Dm 0644 ${WORKDIR}/usbgx.service ${D}${systemd_system_unitdir}/usbgx.service
    fi
    if ${<EMAIL>.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
		install -Dm 0755 ${WORKDIR}/usbgx.initd ${D}${sysconfdir}/init.d/usbgx
	fi
}

RDEPENDS:${PN} += "libusbgx-config"

ALTERNATIVE_PRIORITY = "90"
ALTERNATIVE:${PN} = "gadget-acm-ecm show-gadgets"
ALTERNATIVE_LINK_NAME[gadget-acm-ecm] = "${bindir}/gadget-acm-ecm"
ALTERNATIVE_LINK_NAME[show-gadgets] = "${bindir}/show-gadgets"<commit_msg>libusbgx: add PACKAGECONFIG to make build predicable<commit_after>SUMMARY = "USB Gadget neXt Configfs Library"
LICENSE = "GPL-2.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                    file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c"

inherit autotools pkgconfig systemd update-rc.d update-alternatives

PV = "0.2.0+git${SRCPV}"
SRCREV = "45c14ef4d5d7ced0fbf984208de44ced6d5ed898"
SRCBRANCH = "master"
SRC_URI = " \
    git://github.com/libusbgx/libusbgx.git;branch=${SRCBRANCH};protocol=https \
    file://gadget-start \
    file://usbgx.initd \
    file://usbgx.service \
"

S = "${WORKDIR}/git"

PACKAGECONFIG ??= "examples gadget-schemes libconfig"
PACKAGECONFIG[libconfig] = "--with-libconfig=yes,--without-libconfig,libconfig"
PACKAGECONFIG[examples] = "--enable-examples,--disable-examples"
PACKAGECONFIG[gadget-schemes] = "--enable-gadget-schemes,--disable-gadget-schemes"
PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,cmocka"

PACKAGE_BEFORE_PN = "${PN}-examples"

SYSTEMD_PACKAGES = "${PN}-examples"
SYSTEMD_SERVICE:${PN}-examples = "usbgx.service"
SYSTEMD_AUTO_ENABLE:${PN}-examples = "${<EMAIL>('PACKAGECONFIG', 'examples', 'enable', 'disable', d)}"

INITSCRIPT_PACKAGES = "${PN}-examples"
INITSCRIPT_NAME = "usbgx"
INITSCRIPT_PARAMS = "defaults"
INHIBIT_UPDATERCD_BBCLASS = <EMAIL>('PACKAGECONFIG', 'examples', '1', '0', d)}"

do_install:append() {
    install -Dm 0755 ${WORKDIR}/gadget-start ${D}/${bindir}/gadget-start
    if ${<EMAIL>('DISTRO_FEATURES','systemd','true','false',d)}; then
        install -Dm 0644 ${WORKDIR}/usbgx.service ${D}${systemd_system_unitdir}/usbgx.service
    fi

    if ${<EMAIL>('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
        install -Dm 0755 ${WORKDIR}/usbgx.initd ${D}${sysconfdir}/init.d/usbgx
    fi
}

FILES:${PN}-examples = "${bindir}/* ${sysconfdir}/*"
RDEPENDS:${PN}-examples += "${<EMAIL>('PACKAGECONFIG', 'examples', 'libusbgx-config', '', d)}"

ALTERNATIVE_PRIORITY = "90"
ALTERNATIVE:${PN}-examples = "${<EMAIL>('PACKAGECONFIG', 'examples', 'gadget-acm-ecm show-gadgets', '', d)}"
ALTERNATIVE_LINK_NAME[gadget-acm-ecm] = "${bindir}/gadget-acm-ecm"
ALTERNATIVE_LINK_NAME[show-gadgets] = "${bindir}/show-gadgets"
{'fraction_non_alphanumeric': 0.18157755426151403, 'fraction_numerical': 0.04605611434621493, 'mean_word_length': 5.225700164744646, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1684354', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1563, 'n_words': 202}