Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,46 @@
From 95e601ce116dd46ea7915c171976b85ea0905d58 Mon Sep 17 00:00:00 2001
From: Lonnie Abelbeck <lonnie@abelbeck.com>
Date: Sun, 8 May 2022 14:05:56 -0500
Subject: [PATCH] configure.ac: Link with -latomic only if no atomic builtins
Follow-up to 561dbda, a check of GCC atomic builtins needs to be done
first.
I'm no autoconf guru, but using this:
https://github.com/mesa3d/mesa/blob/0df485c285b73c34ba9062f0c27e55c3c702930d/configure.ac#L469
as inspiration, I created a pre-check before calling AC_SEARCH_LIBS(...)
Fixes #1135
Closes #1139
Upstream-Status: Backport [https://github.com/kraj/libusb/commit/95e601ce116dd46ea7915c171976b85ea0905d58]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 16 +++++++++++++++-
libusb/version_nano.h | 2 +-
2 files changed, 16 insertions(+), 2 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -153,7 +153,21 @@ if test "x$platform" = xposix; then
AC_SEARCH_LIBS([pthread_create], [pthread],
[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
[], [])
- AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
+ dnl Check for new-style atomic builtins. We first check without linking to -latomic.
+ AC_MSG_CHECKING(whether __atomic_load_n is supported)
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #include <stdint.h>
+ int main() {
+ struct {
+ uint64_t *v;
+ } x;
+ return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+ (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
+ }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
+ AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_SUPPORTED)
+ if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
+ AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
+ fi
elif test "x$platform" = xwindows; then
AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
else
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
echo
echo "---------------------------- libusb1 tests ---------------------------"
echo
./stress | { \
while read -r str
do
echo "$str"
if [ "${str#*Starting test run:}" != "$str" ]
then
name="${str#Starting test run: }"
name="${name%...}"
else
case "$str" in
"Success (0)")
echo "PASS: $name"
;;
"Failure (1)" | "Error (2)")
echo "FAIL: $name"
;;
"Skip (3)")
echo "SKIP: $name"
;;
esac
fi
done
}
@@ -0,0 +1,48 @@
SUMMARY = "Userspace library to access USB (version 1.0)"
DESCRIPTION = "A cross-platform library to access USB devices from Linux, \
macOS, Windows, OpenBSD/NetBSD, Haiku and Solaris userspace."
HOMEPAGE = "https://libusb.info"
BUGTRACKER = "http://www.libusb.org/report"
SECTION = "libs"
LICENSE = "LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
BBCLASSEXTEND = "native nativesdk"
SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libusb-${PV}.tar.bz2 \
file://0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch \
file://run-ptest \
"
GITHUB_BASE_URI = "https://github.com/libusb/libusb/releases"
SRC_URI[sha256sum] = "12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5"
S = "${WORKDIR}/libusb-${PV}"
inherit autotools pkgconfig ptest github-releases
PACKAGECONFIG:class-target ??= "udev"
PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
EXTRA_OECONF = "--libdir=${base_libdir}"
do_install:append() {
install -d ${D}${libdir}
if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
fi
}
do_compile_ptest() {
oe_runmake -C tests stress
}
do_install_ptest() {
install -m 755 ${B}/tests/.libs/stress ${D}${PTEST_PATH}
}
FILES:${PN} += "${base_libdir}/*.so.*"
FILES:${PN}-dev += "${base_libdir}/*.so ${base_libdir}/*.la"