add broken ass source for now

This commit is contained in:
2026-07-28 22:28:01 +02:00
commit 3176370951
174 changed files with 53679 additions and 0 deletions
@@ -0,0 +1,5 @@
This directory contains private internal scripts used by the libusb
project maintainers.
These scripts are not intended for general usage and will not be
exported when producing release archives.
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -eu
buildsys="${1}-${Platform}"
if [ "${buildsys}" == "MinGW-Win32" ]; then
export PATH="/c/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin:${PATH}"
elif [ "${buildsys}" == "MinGW-x64" ]; then
export PATH="/c/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin:${PATH}"
fi
builddir="build-${buildsys}"
installdir="${PWD}/libusb-${buildsys}"
cd libusb
echo "Bootstrapping ..."
./bootstrap.sh
echo ""
extra_args=""
if [ "${Configuration}" == "Release" ]; then
extra_args="--no-asan"
fi
exec .private/ci-build.sh --build-dir "${builddir}" --install ${extra_args} -- "--prefix=${installdir}"
+54
View File
@@ -0,0 +1,54 @@
#!/bin/sh
# produce the MinGW binary files for snapshots
# !!!THIS SCRIPT IS FOR INTERNAL DEVELOPER USE ONLY!!!
PWD=`pwd`
cd ..
date=`date +%Y.%m.%d`
target=e:/dailies/$date
mkdir -p $target/include/libusb-1.0
cp -v libusb/libusb-1.0.def $target
cp -v libusb/libusb.h $target/include/libusb-1.0
#
# 32 bit binaries
#
target=e:/dailies/$date/MinGW32
git clean -fdx
# Not using debug (-g) in CFLAGS DRAMATICALLY reduces the size of the binaries
export CFLAGS="-O2 -m32"
export LDFLAGS="-m32"
export RCFLAGS="--target=pe-i386"
export DLLTOOLFLAGS="-m i386 -f --32"
echo `pwd`
(glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize
$LIBTOOLIZE --copy --force || exit 1
aclocal || exit 1
autoheader || exit 1
autoconf || exit 1
automake -a -c || exit 1
./configure
make -j2
mkdir -p $target/static
mkdir -p $target/dll
cp -v libusb/.libs/libusb-1.0.a $target/static
cp -v libusb/.libs/libusb-1.0.dll $target/dll
cp -v libusb/.libs/libusb-1.0.dll.a $target/dll
make clean -j2
#
# 64 bit binaries
#
target=e:/dailies/$date/MinGW64
export CFLAGS="-O2"
export LDFLAGS=""
export RCFLAGS=""
export DLLTOOLFLAGS=""
./configure
make -j2
mkdir -p $target/static
mkdir -p $target/dll
cp -v libusb/.libs/libusb-1.0.a $target/static
cp -v libusb/.libs/libusb-1.0.dll $target/dll
cp -v libusb/.libs/libusb-1.0.dll.a $target/dll
cd $PWD
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
set -e
builddir=
scriptdir=$(dirname $(readlink -f "$0"))
install=no
test=yes
asan=yes
while [ $# -gt 0 ]; do
case "$1" in
--build-dir)
if [ $# -lt 2 ]; then
echo "ERROR: missing argument for --build-dir option" >&2
exit 1
fi
builddir=$2
shift 2
;;
--install)
install=yes
shift
;;
--no-test)
test=no
shift
;;
--no-asan)
asan=no
shift
;;
--werror)
cflags+=" -Werror"
shift
;;
--)
shift
break;
;;
*)
echo "ERROR: Unexpected argument: $1" >&2
exit 1
esac
done
if [ -z "${builddir}" ]; then
echo "ERROR: --build-dir option not specified" >&2
exit 1
fi
if [ -e "${builddir}" ]; then
echo "ERROR: directory entry named '${builddir}' already exists" >&2
exit 1
fi
mkdir "${builddir}"
cd "${builddir}"
cflags+=" -O2"
# enable extra warnings
cflags+=" -Winline"
cflags+=" -Wmissing-include-dirs"
cflags+=" -Wnested-externs"
cflags+=" -Wpointer-arith"
cflags+=" -Wredundant-decls"
cflags+=" -Wswitch-enum"
# enable address sanitizer
if [ "${asan}" = "yes" ]; then
cflags+=" -fsanitize=address"
fi
echo ""
echo "Configuring ..."
CFLAGS="${cflags}" CXXFLAGS="${cflags}" ../configure --enable-examples-build --enable-tests-build "$@"
echo ""
echo "Building ..."
make -j4 -k
if [ "${test}" = "yes" ]; then
# Load custom shim for WebUSB tests that simulates Web environment.
export NODE_OPTIONS="--require ${scriptdir}/../tests/webusb-test-shim/"
if ! make check ; then
cat tests/test-suite.log
exit 1
fi
fi
if [ "${install}" = "yes" ]; then
echo ""
echo "Installing ..."
make install
fi
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
set -eu
# keep container around if $DEBUG is set
[ -n "${DEBUG:-}" ] || OPTS="--rm"
if type podman >/dev/null 2>&1; then
RUNC=podman
else
RUNC="sudo docker"
fi
MOUNT_MODE=":ro"
$RUNC run --interactive ${RUNC_OPTIONS:-} ${OPTS:-} --volume `pwd`:/source${MOUNT_MODE:-} ${1:-docker.io/amd64/ubuntu:rolling} /bin/bash << EOF
set -ex
# avoid meson exit code 125; https://github.com/containers/podman/issues/11540
trap '[ \$? -eq 0 ] || exit 1' EXIT
# go-faster apt
echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages
# upgrade
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y eatmydata
eatmydata apt-get -y --purge dist-upgrade
# install build and test dependencies
eatmydata apt-get install -y make libtool libudev-dev pkg-config umockdev libumockdev-dev
# run build as user
useradd build
su -s /bin/bash - build << EOG
set -ex
mkdir "/tmp/builddir"
cd "/tmp/builddir"
CFLAGS="-O2"
# enable extra warnings
CFLAGS+=" -Winline"
CFLAGS+=" -Wmissing-include-dirs"
CFLAGS+=" -Wnested-externs"
CFLAGS+=" -Wpointer-arith"
CFLAGS+=" -Wredundant-decls"
CFLAGS+=" -Wswitch-enum"
export CFLAGS
export CXXFLAGS="\${CFLAGS}"
echo ""
echo "Configuring ..."
/source/configure --enable-examples-build --enable-tests-build
echo ""
echo "Building ..."
make -j4 -k
echo ""
echo "Running umockdev tests ..."
tests/umockdev
EOG
EOF
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
#
# Detect amended commits and warn user if .amend is missing
#
# To have git run this script on commit, create a "post-rewrite" text file in
# .git/hooks/ with the following content:
# #!/bin/sh
# if [ -x .private/post-rewrite.sh ]; then
# . .private/post-rewrite.sh
# fi
#
# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the
# libusb development team and are NOT intended to solve versioning for any
# derivative branch, such as one you would create for private development.
#
if [ -n "$LIBUSB_SKIP_NANO" ]; then
exit 0
fi
case "$1" in
amend)
# Check if a .amend exists. If none, create one and warn user to re-commit.
if [ -f .amend ]; then
rm .amend
else
echo "Amend commit detected, but no .amend file - One has now been created."
echo "Please re-commit as is (amend), so that the version number is correct."
touch .amend
fi ;;
*) ;;
esac
+52
View File
@@ -0,0 +1,52 @@
#!/bin/sh
#
# Sets the nano version according to the number of commits on this branch, as
# well as the branch offset.
#
# To have git run this script on commit, first make sure you change
# BRANCH_OFFSET to 60000 or higher, then create a "pre-commit" text file in
# .git/hooks/ with the following content:
# #!/bin/sh
# if [ -x .private/pre-commit.sh ]; then
# . .private/pre-commit.sh
# fi
#
# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the
# libusb development team and are NOT intended to solve versioning for any
# derivative branch, such as one you would create for private development.
#
# Should you wish to reuse these scripts for your own versioning, in your own
# private branch, we kindly ask you to first set BRANCH_OFFSET to 60000, or
# higher, as any offset below below 60000 is *RESERVED* for libusb official
# usage.
################################################################################
## YOU *MUST* SET THE FOLLOWING TO 60000 OR HIGHER IF YOU REUSE THIS SCRIPT ##
################################################################################
BRANCH_OFFSET=10000
################################################################################
if [ -n "$LIBUSB_SKIP_NANO" ]; then
exit 0
fi
if [ "$BASH_VERSION" = '' ]; then
TYPE_CMD="type git >/dev/null 2>&1"
else
TYPE_CMD="type -P git &>/dev/null"
fi
eval $TYPE_CMD || { echo "git command not found. Aborting." >&2; exit 1; }
NANO=`git log --oneline | wc -l`
NANO=`expr $NANO + $BRANCH_OFFSET`
# Amended commits need to have the nano corrected. Current versions of git hooks
# only allow detection of amending post commit, so we require a .amend file,
# which will be created post commit with a user warning if none exists when an
# amend is detected.
if [ -f .amend ]; then
NANO=`expr $NANO - 1`
fi
echo "setting nano to $NANO"
echo "#define LIBUSB_NANO $NANO" > libusb/version_nano.h
git add libusb/version_nano.h
+43
View File
@@ -0,0 +1,43 @@
libusb 1.0 Windows binary snapshot - README
*********************************************************************
* The latest version of this snapshot can always be downloaded at: *
* https://github.com/libusb/libusb/releases *
*********************************************************************
o Visual Studio:
- Open existing or create a new project for your application
- Copy libusb.h, from the include\libusb-1.0\ directory, into your project and
make sure that the location where the file reside appears in the 'Additional
Include Directories' section (Configuration Properties -> C/C++ -> General).
- Copy the relevant .lib file from MS32\ or MS64\ and add 'libusb-1.0.lib' to
your 'Additional Dependencies' (Configuration Properties -> Linker -> Input)
Also make sure that the directory where libusb-1.0.lib resides is added to
'Additional Library Directories' (Configuration Properties -> Linker
-> General)
- By default, static libusb statically links against the CRT and the dll build
dynamically links against CRT. You need to rebuild libusb from source to
change this if required by your application.
- Compile and run your application. If you use the DLL version of libusb-1.0,
remember that the DLL needs to be in the DLL search path of your application.
o MinGW/cygwin
- Copy libusb.h, from include/libusb-1.0/ to your default include directory,
and copy the MinGW32/ or MinGW64/ .a files to your default library directory.
Or, if you don't want to use the default locations, make sure that you feed
the relevant -I and -L options to the compiler.
- Add the '-lusb-1.0' linker option when compiling.
o Additional information:
- The libusb 1.0 API documentation can be accessed at:
http://api.libusb.info
- For some libusb samples (including source), please have a look in examples/
- For additional information on the libusb 1.0 Windows backend please visit:
http://windows.libusb.info
- Using the UsbDk backend is now a run-time choice rather than a compile-time
choice. For additional information, including example usage, please visit:
http://windows.libusb.info/#Driver_Installation
- The MinGW and MS generated DLLs are fully interchangeable, provided that you
use the import libs provided or generate one from the .def also provided.
- If you find any issue, please visit https://libusb.info/ and check the
Support section