Compare commits
21 Commits
nanosvg/v0
...
catch2/v2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
058ed3c076 | ||
|
|
9f9bc38a3e | ||
|
|
79fefe6558 | ||
|
|
2f5b981c19 | ||
|
|
54dafe6c1b | ||
|
|
0fc2d13e50 | ||
|
|
567fde8231 | ||
|
|
d1af35e660 | ||
|
|
5457e99bb7 | ||
|
|
0f28906d50 | ||
|
|
8b6c712f60 | ||
|
|
6ad06e2173 | ||
|
|
577b731299 | ||
|
|
6692e3d936 | ||
|
|
6bc1fe9a9a | ||
|
|
14d916d054 | ||
|
|
62afc9ea71 | ||
|
|
c55046f7f0 | ||
|
|
a78417ecd1 | ||
|
|
d14d45aef4 | ||
|
|
224cbbb783 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -27,3 +27,6 @@ gcc-arm-none-eabi/gcc_arm_none_eabi/toolchain/
|
|||||||
|
|
||||||
# downloaded git-lfs
|
# downloaded git-lfs
|
||||||
git-lfs/git_lfs/bin/
|
git-lfs/git_lfs/bin/
|
||||||
|
|
||||||
|
# downloaded mdbook
|
||||||
|
mdbook/mdbook/bin/
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ contributions welcome for other platforms!
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
dependencies = [
|
dependencies = [
|
||||||
# use the releases branch for pre-built wheels
|
# use per-package release branches for pre-built wheels
|
||||||
"capnproto @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=capnproto",
|
"capnproto @ git+https://github.com/commaai/dependencies.git@release-capnproto#subdirectory=capnproto",
|
||||||
"ffmpeg @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=ffmpeg",
|
"ffmpeg @ git+https://github.com/commaai/dependencies.git@release-ffmpeg#subdirectory=ffmpeg",
|
||||||
|
|
||||||
# use the master branch to build the package on pip install
|
# use the master branch to build the package on pip install
|
||||||
"capnproto @ git+https://github.com/commaai/dependencies.git@master#subdirectory=capnproto",
|
"capnproto @ git+https://github.com/commaai/dependencies.git@master#subdirectory=capnproto",
|
||||||
@@ -58,4 +58,4 @@ to add a new package:
|
|||||||
* start a new top-level directory as a new package
|
* start a new top-level directory as a new package
|
||||||
* `./test.sh` tests the building of all packages
|
* `./test.sh` tests the building of all packages
|
||||||
* on pushes to `master`, wheels are built for our target platforms and pushed to a GitHub release
|
* on pushes to `master`, wheels are built for our target platforms and pushed to a GitHub release
|
||||||
* the `releases` branch contains shim packages that allow pointing to a git branch and always getting the appropriate wheel for your platform
|
* each `release-<package>` branch contains a single shim package, so old lockfiles keep resolving even as new packages are added
|
||||||
|
|||||||
22
catch2/build.sh
Executable file
22
catch2/build.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="v2.13.10"
|
||||||
|
INSTALL_DIR="$DIR/catch2/install"
|
||||||
|
|
||||||
|
if [ ! -d "catch2-src/.git" ]; then
|
||||||
|
rm -rf catch2-src
|
||||||
|
git clone --depth 1 https://github.com/catchorg/Catch2.git catch2-src
|
||||||
|
fi
|
||||||
|
git -C catch2-src fetch --depth 1 origin "$VERSION"
|
||||||
|
git -C catch2-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/include"
|
||||||
|
cp -r catch2-src/single_include/catch2 "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
|
echo "Installed catch2 to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
9
catch2/catch2/__init__.py
Normal file
9
catch2/catch2/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
LIB_DIR = DIR # header-only; no libraries
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "catch2", "catch.hpp")), "catch2/catch.hpp not found"
|
||||||
16
catch2/pyproject.toml
Normal file
16
catch2/pyproject.toml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "catch2"
|
||||||
|
version = "2.13.10"
|
||||||
|
description = "Catch2 C++ test framework headers"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["catch2*"]
|
||||||
|
exclude = ["catch2-src*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
catch2 = ["install/**/*"]
|
||||||
28
catch2/setup.py
Normal file
28
catch2/setup.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
|
|
||||||
|
class BuildCatch2(build_py):
|
||||||
|
"""Run build.sh to download Catch2 headers before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildCatch2}
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
@@ -4,9 +4,12 @@ set -e
|
|||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
|
PLATFORM="$(uname -s)"
|
||||||
FFMPEG_VERSION="7.1"
|
FFMPEG_VERSION="7.1"
|
||||||
ZLIB_VERSION="da607da739fa6047df13e66a2af6b8bec7c2a498" # v1.3.2
|
ZLIB_VERSION="da607da739fa6047df13e66a2af6b8bec7c2a498" # v1.3.2
|
||||||
X264_BRANCH="stable"
|
X264_BRANCH="stable"
|
||||||
|
LIBDRM_VERSION="libdrm-2.4.124"
|
||||||
|
LIBVA_VERSION="2.22.0"
|
||||||
INSTALL_DIR="$DIR/ffmpeg/install"
|
INSTALL_DIR="$DIR/ffmpeg/install"
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
@@ -48,6 +51,59 @@ make -j"$NJOBS"
|
|||||||
make install
|
make install
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
|
# --- Build nv-codec-headers (Linux only, for CUDA/NVDEC) ---
|
||||||
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
|
if [ ! -d "nv-codec-headers-src/.git" ]; then
|
||||||
|
rm -rf nv-codec-headers-src
|
||||||
|
git clone --depth 1 https://git.videolan.org/git/ffmpeg/nv-codec-headers.git nv-codec-headers-src
|
||||||
|
fi
|
||||||
|
make -C nv-codec-headers-src PREFIX="$PREFIX" install
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Build Vulkan-Headers from source (Linux only, need >= 1.3.277 for FFmpeg 7.1) ---
|
||||||
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
|
if [ ! -d "vulkan-headers-src/.git" ]; then
|
||||||
|
rm -rf vulkan-headers-src
|
||||||
|
git clone --depth 1 https://github.com/KhronosGroup/Vulkan-Headers.git vulkan-headers-src
|
||||||
|
fi
|
||||||
|
cmake -S vulkan-headers-src -B vulkan-headers-src/build -DCMAKE_INSTALL_PREFIX="$PREFIX" >/dev/null
|
||||||
|
cmake --install vulkan-headers-src/build >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Build libdrm + libva statically (Linux only, for VAAPI without runtime deps) ---
|
||||||
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
|
if ! command -v meson &>/dev/null; then
|
||||||
|
pip3 install --quiet meson ninja 2>/dev/null || python3 -m pip install --quiet meson ninja 2>/dev/null || true
|
||||||
|
command -v meson &>/dev/null || { echo "error: meson is required (apt install meson or pip install meson)" >&2; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "libdrm-src/.git" ]; then
|
||||||
|
rm -rf libdrm-src
|
||||||
|
git clone --depth 1 --branch "$LIBDRM_VERSION" https://gitlab.freedesktop.org/mesa/drm.git libdrm-src
|
||||||
|
fi
|
||||||
|
rm -rf libdrm-src/builddir
|
||||||
|
meson setup libdrm-src/builddir libdrm-src \
|
||||||
|
--prefix="$PREFIX" --libdir=lib --default-library=static \
|
||||||
|
-Dintel=disabled -Dradeon=disabled -Damdgpu=disabled -Dnouveau=disabled \
|
||||||
|
-Dvmwgfx=disabled -Dtests=false -Dman-pages=disabled -Dcairo-tests=disabled \
|
||||||
|
-Dvalgrind=disabled
|
||||||
|
ninja -C libdrm-src/builddir install
|
||||||
|
|
||||||
|
if [ ! -d "libva-src/.git" ]; then
|
||||||
|
rm -rf libva-src
|
||||||
|
git clone --depth 1 --branch "$LIBVA_VERSION" https://github.com/intel/libva.git libva-src
|
||||||
|
fi
|
||||||
|
rm -rf libva-src/builddir
|
||||||
|
# libva hardcodes shared_library(); patch to library() so --default-library=static works
|
||||||
|
sed -i 's/shared_library(/library(/g' libva-src/va/meson.build
|
||||||
|
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
||||||
|
meson setup libva-src/builddir libva-src \
|
||||||
|
--prefix="$PREFIX" --libdir=lib --default-library=static \
|
||||||
|
-Ddisable_drm=false -Dwith_x11=no -Dwith_glx=no -Dwith_wayland=no \
|
||||||
|
-Dwith_win32=no -Denable_docs=false
|
||||||
|
ninja -C libva-src/builddir install
|
||||||
|
fi
|
||||||
|
|
||||||
# --- Build FFmpeg ---
|
# --- Build FFmpeg ---
|
||||||
if [ ! -d "ffmpeg-src/.git" ]; then
|
if [ ! -d "ffmpeg-src/.git" ]; then
|
||||||
rm -rf ffmpeg-src
|
rm -rf ffmpeg-src
|
||||||
@@ -57,6 +113,39 @@ git -C ffmpeg-src fetch --depth 1 origin "n${FFMPEG_VERSION}"
|
|||||||
git -C ffmpeg-src checkout --force FETCH_HEAD
|
git -C ffmpeg-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
cd ffmpeg-src
|
cd ffmpeg-src
|
||||||
|
|
||||||
|
# Platform-specific hardware acceleration flags
|
||||||
|
HW_FLAGS=()
|
||||||
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
|
HW_FLAGS+=(
|
||||||
|
# NVIDIA CUDA/NVDEC (uses dlopen at runtime)
|
||||||
|
--enable-ffnvcodec --enable-cuda --enable-cuvid --enable-nvdec
|
||||||
|
--enable-hwaccel=h264_nvdec,hevc_nvdec
|
||||||
|
--enable-decoder=h264_cuvid,hevc_cuvid
|
||||||
|
|
||||||
|
# VAAPI (Intel/AMD — libva linked statically, driver loaded via dlopen at runtime)
|
||||||
|
--enable-vaapi
|
||||||
|
--enable-hwaccel=h264_vaapi,hevc_vaapi
|
||||||
|
|
||||||
|
# V4L2 Memory-to-Memory (embedded: RPi, Qualcomm, Rockchip)
|
||||||
|
--enable-v4l2-m2m
|
||||||
|
--enable-decoder=h264_v4l2m2m,hevc_v4l2m2m
|
||||||
|
--enable-encoder=h264_v4l2m2m,hevc_v4l2m2m
|
||||||
|
|
||||||
|
# Vulkan video decode/encode (uses dlopen at runtime)
|
||||||
|
--enable-vulkan
|
||||||
|
--enable-hwaccel=h264_vulkan,hevc_vulkan
|
||||||
|
--enable-encoder=h264_vulkan,hevc_vulkan
|
||||||
|
)
|
||||||
|
elif [ "$PLATFORM" = "Darwin" ]; then
|
||||||
|
HW_FLAGS+=(
|
||||||
|
# VideoToolbox (Apple Silicon / macOS)
|
||||||
|
--enable-videotoolbox
|
||||||
|
--enable-hwaccel=h264_videotoolbox,hevc_videotoolbox
|
||||||
|
--enable-encoder=h264_videotoolbox,hevc_videotoolbox
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
||||||
./configure \
|
./configure \
|
||||||
--cc="${CC:-cc}" \
|
--cc="${CC:-cc}" \
|
||||||
@@ -70,6 +159,7 @@ PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
|||||||
--disable-doc \
|
--disable-doc \
|
||||||
--disable-ffplay \
|
--disable-ffplay \
|
||||||
--disable-autodetect \
|
--disable-autodetect \
|
||||||
|
--disable-x86asm \
|
||||||
--disable-everything \
|
--disable-everything \
|
||||||
--enable-encoder=libx264,aac,ffvhuff,rawvideo,png,mjpeg \
|
--enable-encoder=libx264,aac,ffvhuff,rawvideo,png,mjpeg \
|
||||||
--enable-decoder=h264,hevc,ffvhuff,aac,rawvideo,png,mjpeg,mp3,pcm_s16le \
|
--enable-decoder=h264,hevc,ffvhuff,aac,rawvideo,png,mjpeg,mp3,pcm_s16le \
|
||||||
@@ -80,7 +170,8 @@ PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
|||||||
--enable-filter=blend,vflip,format,scale,aformat,anull,aresample,null \
|
--enable-filter=blend,vflip,format,scale,aformat,anull,aresample,null \
|
||||||
--enable-bsf=extract_extradata,h264_mp4toannexb,hevc_mp4toannexb \
|
--enable-bsf=extract_extradata,h264_mp4toannexb,hevc_mp4toannexb \
|
||||||
--extra-cflags="-I$PREFIX/include" \
|
--extra-cflags="-I$PREFIX/include" \
|
||||||
--extra-ldflags="-L$PREFIX/lib"
|
--extra-ldflags="-L$PREFIX/lib" \
|
||||||
|
"${HW_FLAGS[@]}"
|
||||||
make -j"$NJOBS"
|
make -j"$NJOBS"
|
||||||
make install
|
make install
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
@@ -94,7 +185,11 @@ cp "$PREFIX/bin/ffmpeg" "$INSTALL_DIR/bin/"
|
|||||||
cp "$PREFIX/bin/ffprobe" "$INSTALL_DIR/bin/"
|
cp "$PREFIX/bin/ffprobe" "$INSTALL_DIR/bin/"
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
for lib in libavformat.a libavcodec.a libavutil.a libswresample.a libx264.a libz.a; do
|
LIBS="libavformat.a libavcodec.a libavutil.a libswresample.a libx264.a libz.a"
|
||||||
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
|
LIBS="$LIBS libva.a libva-drm.a libdrm.a"
|
||||||
|
fi
|
||||||
|
for lib in $LIBS; do
|
||||||
cp "$PREFIX/lib/$lib" "$INSTALL_DIR/lib/"
|
cp "$PREFIX/lib/$lib" "$INSTALL_DIR/lib/"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
189
git/build.sh
Executable file
189
git/build.sh
Executable file
@@ -0,0 +1,189 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="2.47.1"
|
||||||
|
OPENSSL_VERSION="openssl-3.4.1"
|
||||||
|
CURL_VERSION="curl-8_12_1"
|
||||||
|
ZLIB_VERSION="v1.3.1"
|
||||||
|
INSTALL_DIR="$DIR/git/install"
|
||||||
|
VERSION_FILE="$INSTALL_DIR/.version"
|
||||||
|
|
||||||
|
# Skip if already at correct version
|
||||||
|
if [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$VERSION" ]; then
|
||||||
|
echo "git $VERSION already present, skipping."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLATFORM="$(uname -s)"
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
PREFIX="$DIR/build/prefix"
|
||||||
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
|
# --- Build zlib (static) ---
|
||||||
|
if [ ! -d "zlib-src/.git" ]; then
|
||||||
|
rm -rf zlib-src
|
||||||
|
git clone --depth 1 https://github.com/madler/zlib.git zlib-src
|
||||||
|
fi
|
||||||
|
git -C zlib-src fetch --depth 1 origin "$ZLIB_VERSION"
|
||||||
|
git -C zlib-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
cd zlib-src
|
||||||
|
./configure --prefix="$PREFIX" --static
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# --- Build OpenSSL (static) ---
|
||||||
|
if [ ! -d "openssl-src/.git" ]; then
|
||||||
|
rm -rf openssl-src
|
||||||
|
git clone --depth 1 https://github.com/openssl/openssl.git openssl-src
|
||||||
|
fi
|
||||||
|
git -C openssl-src fetch --depth 1 origin "$OPENSSL_VERSION"
|
||||||
|
git -C openssl-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
cd openssl-src
|
||||||
|
./Configure \
|
||||||
|
--prefix="$PREFIX" \
|
||||||
|
--libdir=lib \
|
||||||
|
no-shared \
|
||||||
|
no-tests \
|
||||||
|
no-docs
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install_sw
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# --- Build curl (static, with openssl+zlib) ---
|
||||||
|
if [ ! -d "curl-src/.git" ]; then
|
||||||
|
rm -rf curl-src
|
||||||
|
git clone --depth 1 https://github.com/curl/curl.git curl-src
|
||||||
|
fi
|
||||||
|
git -C curl-src fetch --depth 1 origin "$CURL_VERSION"
|
||||||
|
git -C curl-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
cd curl-src
|
||||||
|
autoreconf -fi
|
||||||
|
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" \
|
||||||
|
./configure \
|
||||||
|
--prefix="$PREFIX" \
|
||||||
|
--with-openssl="$PREFIX" \
|
||||||
|
--with-zlib="$PREFIX" \
|
||||||
|
--disable-shared \
|
||||||
|
--enable-static \
|
||||||
|
--disable-ldap \
|
||||||
|
--disable-rtsp \
|
||||||
|
--disable-dict \
|
||||||
|
--disable-telnet \
|
||||||
|
--disable-tftp \
|
||||||
|
--disable-pop3 \
|
||||||
|
--disable-imap \
|
||||||
|
--disable-smb \
|
||||||
|
--disable-smtp \
|
||||||
|
--disable-gopher \
|
||||||
|
--disable-mqtt \
|
||||||
|
--disable-manual \
|
||||||
|
--disable-docs \
|
||||||
|
--without-libpsl \
|
||||||
|
--without-brotli \
|
||||||
|
--without-zstd \
|
||||||
|
--without-libidn2 \
|
||||||
|
--without-nghttp2 \
|
||||||
|
--without-librtmp
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# --- Build git (with static curl+openssl+zlib) ---
|
||||||
|
if [ ! -d "git-src/.git" ]; then
|
||||||
|
rm -rf git-src
|
||||||
|
git clone --depth 1 https://github.com/git/git.git git-src
|
||||||
|
fi
|
||||||
|
git -C git-src fetch --depth 1 origin "v${VERSION}"
|
||||||
|
git -C git-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
# Gather static link flags for curl and openssl dependencies
|
||||||
|
# CURL_LIBCURL: used by git-remote-http, git-http-fetch, git-http-push
|
||||||
|
# LIB_4_CRYPTO: used by git-imap-send and other direct openssl consumers
|
||||||
|
# Both need transitive deps (-ldl, -lpthread) since we link statically
|
||||||
|
CRYPTO_DEPS="-lpthread"
|
||||||
|
CURL_EXTRA=""
|
||||||
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
|
CRYPTO_DEPS="$CRYPTO_DEPS -ldl"
|
||||||
|
elif [ "$PLATFORM" = "Darwin" ]; then
|
||||||
|
CURL_EXTRA="-framework SystemConfiguration -framework Security -framework CoreFoundation"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd git-src
|
||||||
|
make prefix="$PREFIX" \
|
||||||
|
RUNTIME_PREFIX=YesPlease \
|
||||||
|
NO_GETTEXT=YesPlease \
|
||||||
|
NO_TCLTK=YesPlease \
|
||||||
|
NO_PERL=YesPlease \
|
||||||
|
NO_PYTHON=YesPlease \
|
||||||
|
NO_EXPAT=YesPlease \
|
||||||
|
INSTALL_SYMLINKS=1 \
|
||||||
|
CURLDIR="$PREFIX" \
|
||||||
|
CURL_LIBCURL="-L$PREFIX/lib -lcurl -lssl -lcrypto -lz $CRYPTO_DEPS $CURL_EXTRA" \
|
||||||
|
OPENSSL_LIBSSL="-L$PREFIX/lib -lssl" \
|
||||||
|
LIB_4_CRYPTO="-lcrypto $CRYPTO_DEPS" \
|
||||||
|
ZLIB_PATH="$PREFIX" \
|
||||||
|
-j"$NJOBS" \
|
||||||
|
all
|
||||||
|
make prefix="$PREFIX" \
|
||||||
|
RUNTIME_PREFIX=YesPlease \
|
||||||
|
NO_GETTEXT=YesPlease \
|
||||||
|
NO_TCLTK=YesPlease \
|
||||||
|
NO_PERL=YesPlease \
|
||||||
|
NO_PYTHON=YesPlease \
|
||||||
|
NO_EXPAT=YesPlease \
|
||||||
|
INSTALL_SYMLINKS=1 \
|
||||||
|
CURLDIR="$PREFIX" \
|
||||||
|
CURL_LIBCURL="-L$PREFIX/lib -lcurl -lssl -lcrypto -lz $CRYPTO_DEPS $CURL_EXTRA" \
|
||||||
|
OPENSSL_LIBSSL="-L$PREFIX/lib -lssl" \
|
||||||
|
LIB_4_CRYPTO="-lcrypto $CRYPTO_DEPS" \
|
||||||
|
ZLIB_PATH="$PREFIX" \
|
||||||
|
install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Assemble the package install directory
|
||||||
|
# Only copy real files from libexec to avoid bloating the wheel with
|
||||||
|
# copies of the main git binary (builtin commands are symlinks to git)
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/bin" "$INSTALL_DIR/libexec/git-core"
|
||||||
|
|
||||||
|
# Main binary
|
||||||
|
cp "$PREFIX/bin/git" "$INSTALL_DIR/bin/"
|
||||||
|
|
||||||
|
# libexec/git-core: copy real files, resolve non-git symlinks, skip git symlinks
|
||||||
|
cd "$PREFIX/libexec/git-core"
|
||||||
|
for f in *; do
|
||||||
|
if [ -L "$f" ]; then
|
||||||
|
target="$(readlink "$f")"
|
||||||
|
# Skip symlinks to the main git binary (these are builtins)
|
||||||
|
case "$target" in
|
||||||
|
git|../../bin/git) continue ;;
|
||||||
|
esac
|
||||||
|
# Resolve other symlinks (e.g., git-remote-https -> git-remote-http)
|
||||||
|
cp -L "$f" "$INSTALL_DIR/libexec/git-core/$f"
|
||||||
|
elif [ -f "$f" ]; then
|
||||||
|
cp "$f" "$INSTALL_DIR/libexec/git-core/$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Copy git binary into libexec for builtin resolution
|
||||||
|
cp "$PREFIX/bin/git" "$INSTALL_DIR/libexec/git-core/git"
|
||||||
|
|
||||||
|
# Templates
|
||||||
|
cp -r "$PREFIX/share" "$INSTALL_DIR/"
|
||||||
|
|
||||||
|
# Strip binaries
|
||||||
|
strip "$INSTALL_DIR/bin/git" "$INSTALL_DIR/libexec/git-core/git" 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/libexec/git-core" -maxdepth 1 -type f -perm /111 ! -name "*.sh" -exec strip {} \; 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "$VERSION" > "$VERSION_FILE"
|
||||||
|
|
||||||
|
echo "Installed git to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
17
git/git/__init__.py
Normal file
17
git/git/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
BIN_DIR = os.path.join(DIR, "bin")
|
||||||
|
|
||||||
|
|
||||||
|
def _run():
|
||||||
|
binary = os.path.join(BIN_DIR, "git")
|
||||||
|
os.execvp(binary, [binary] + sys.argv[1:])
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
import subprocess
|
||||||
|
binary = os.path.join(BIN_DIR, "git")
|
||||||
|
subprocess.run([binary, "--version"], check=True)
|
||||||
|
subprocess.run([binary, "ls-remote", "https://github.com/commaai/openpilot.git", "HEAD"], check=True)
|
||||||
18
git/pyproject.toml
Normal file
18
git/pyproject.toml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "git"
|
||||||
|
version = "2.47.1"
|
||||||
|
description = "Git distributed version control system"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
git = "git:_run"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["git*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
git = ["install/**/*"]
|
||||||
58
git/setup.py
Normal file
58
git/setup.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
|
try:
|
||||||
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
|
except ImportError:
|
||||||
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
|
class BuildGit(build_py):
|
||||||
|
"""Run build.sh to build git before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildGit}
|
||||||
|
|
||||||
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
|
class PlatformWheel(bdist_wheel):
|
||||||
|
"""Produce a platform-specific, Python-version-agnostic wheel."""
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
super().finalize_options()
|
||||||
|
self.root_is_pure = False
|
||||||
|
|
||||||
|
def get_tag(self):
|
||||||
|
system = platform.system()
|
||||||
|
machine = platform.machine()
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
plat = f"linux_{machine}"
|
||||||
|
elif system == "Darwin":
|
||||||
|
plat = "macosx_11_0_arm64"
|
||||||
|
else:
|
||||||
|
plat = f"{system.lower()}_{machine}"
|
||||||
|
|
||||||
|
return "py3", "none", plat
|
||||||
|
|
||||||
|
cmdclass["bdist_wheel"] = PlatformWheel
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
103
imgui/build.sh
103
imgui/build.sh
@@ -5,13 +5,15 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
INSTALL_DIR="$DIR/imgui/install"
|
INSTALL_DIR="$DIR/imgui/install"
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Dear ImGui (docking branch, version 1.92.7)
|
# Dear ImGui (docking branch, version 1.92.7)
|
||||||
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
||||||
# ImPlot
|
# ImPlot
|
||||||
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
||||||
# rlImGui
|
|
||||||
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
|
# GLFW 3.4
|
||||||
|
GLFW_COMMIT="7b6aead9fb88b3623e3b3725ebb42670cbe4c579"
|
||||||
|
|
||||||
# Clone/update imgui
|
# Clone/update imgui
|
||||||
if [ ! -d "imgui-src/.git" ]; then
|
if [ ! -d "imgui-src/.git" ]; then
|
||||||
@@ -29,39 +31,94 @@ fi
|
|||||||
git -C implot-src fetch --depth 1 origin "$IMPLOT_COMMIT"
|
git -C implot-src fetch --depth 1 origin "$IMPLOT_COMMIT"
|
||||||
git -C implot-src checkout --force "$IMPLOT_COMMIT"
|
git -C implot-src checkout --force "$IMPLOT_COMMIT"
|
||||||
|
|
||||||
# Clone/update rlimgui
|
# Clone/update GLFW
|
||||||
if [ ! -d "rlimgui-src/.git" ]; then
|
if [ ! -d "glfw-src/.git" ]; then
|
||||||
rm -rf rlimgui-src
|
rm -rf glfw-src
|
||||||
git clone --depth 1 https://github.com/raylib-extras/rlImGui.git rlimgui-src
|
git clone --depth 1 https://github.com/glfw/glfw.git glfw-src
|
||||||
fi
|
fi
|
||||||
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
|
git -C glfw-src fetch --depth 1 origin "$GLFW_COMMIT"
|
||||||
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
|
git -C glfw-src checkout --force "$GLFW_COMMIT"
|
||||||
|
|
||||||
# Install
|
# Install GLFW build dependencies
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
if command -v dnf &>/dev/null; then
|
||||||
|
dnf install -y libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel \
|
||||||
|
wayland-devel wayland-protocols-devel libxkbcommon-devel
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev \
|
||||||
|
libwayland-dev wayland-protocols libxkbcommon-dev
|
||||||
|
else
|
||||||
|
sudo apt-get update && sudo apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev \
|
||||||
|
libwayland-dev wayland-protocols libxkbcommon-dev
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build GLFW static library
|
||||||
|
cmake -B glfw-src/build -S glfw-src \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DGLFW_BUILD_EXAMPLES=OFF \
|
||||||
|
-DGLFW_BUILD_TESTS=OFF \
|
||||||
|
-DGLFW_BUILD_DOCS=OFF
|
||||||
|
cmake --build glfw-src/build --parallel "$NJOBS"
|
||||||
|
|
||||||
|
# Install headers
|
||||||
rm -rf "$INSTALL_DIR"
|
rm -rf "$INSTALL_DIR"
|
||||||
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src"
|
mkdir -p "$INSTALL_DIR/include" "$INSTALL_DIR/lib"
|
||||||
|
|
||||||
# imgui
|
# imgui headers
|
||||||
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
||||||
imgui-src/imstb_rectpack.h imgui-src/imstb_textedit.h imgui-src/imstb_truetype.h \
|
imgui-src/imstb_rectpack.h imgui-src/imstb_textedit.h imgui-src/imstb_truetype.h \
|
||||||
"$INSTALL_DIR/include/"
|
"$INSTALL_DIR/include/"
|
||||||
cp imgui-src/imgui.cpp imgui-src/imgui_draw.cpp imgui-src/imgui_tables.cpp \
|
|
||||||
imgui-src/imgui_widgets.cpp imgui-src/imgui_demo.cpp \
|
|
||||||
"$INSTALL_DIR/src/"
|
|
||||||
cp imgui-src/backends/imgui_impl_opengl3.h imgui-src/backends/imgui_impl_opengl3_loader.h \
|
cp imgui-src/backends/imgui_impl_opengl3.h imgui-src/backends/imgui_impl_opengl3_loader.h \
|
||||||
|
imgui-src/backends/imgui_impl_glfw.h \
|
||||||
"$INSTALL_DIR/include/"
|
"$INSTALL_DIR/include/"
|
||||||
cp imgui-src/backends/imgui_impl_opengl3.cpp "$INSTALL_DIR/src/"
|
|
||||||
|
|
||||||
# implot
|
# implot headers
|
||||||
cp implot-src/implot.h implot-src/implot_internal.h "$INSTALL_DIR/include/"
|
cp implot-src/implot.h implot-src/implot_internal.h "$INSTALL_DIR/include/"
|
||||||
cp implot-src/implot.cpp implot-src/implot_items.cpp "$INSTALL_DIR/src/"
|
|
||||||
|
|
||||||
# rlimgui
|
# glfw
|
||||||
cp rlimgui-src/rlImGui.h rlimgui-src/rlImGuiColors.h rlimgui-src/imgui_impl_raylib.h \
|
cp glfw-src/build/src/libglfw3.a "$INSTALL_DIR/lib/"
|
||||||
"$INSTALL_DIR/include/"
|
cp -r glfw-src/include/GLFW "$INSTALL_DIR/include/"
|
||||||
cp rlimgui-src/extras/FA6FreeSolidFontData.h rlimgui-src/extras/IconsFontAwesome6.h \
|
|
||||||
"$INSTALL_DIR/include/extras/"
|
# Build libimgui.a (imgui core + backends + implot)
|
||||||
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
|
IMGUI_SRCS=(
|
||||||
|
imgui-src/imgui.cpp
|
||||||
|
imgui-src/imgui_draw.cpp
|
||||||
|
imgui-src/imgui_tables.cpp
|
||||||
|
imgui-src/imgui_widgets.cpp
|
||||||
|
imgui-src/imgui_demo.cpp
|
||||||
|
imgui-src/backends/imgui_impl_opengl3.cpp
|
||||||
|
imgui-src/backends/imgui_impl_glfw.cpp
|
||||||
|
implot-src/implot.cpp
|
||||||
|
implot-src/implot_items.cpp
|
||||||
|
)
|
||||||
|
OBJ_DIR="$(mktemp -d)"
|
||||||
|
for src in "${IMGUI_SRCS[@]}"; do
|
||||||
|
obj="$OBJ_DIR/$(basename "${src%.cpp}.o")"
|
||||||
|
c++ -c -O2 -fPIC -I"$INSTALL_DIR/include" "$src" -o "$obj" &
|
||||||
|
done
|
||||||
|
wait
|
||||||
|
ar rcs "$INSTALL_DIR/lib/libimgui.a" "$OBJ_DIR"/*.o
|
||||||
|
rm -rf "$OBJ_DIR"
|
||||||
|
|
||||||
|
# Bundle GLVND dispatchers so Linux users don't need system libGL
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
MESA_DIR="$INSTALL_DIR/lib/mesa"
|
||||||
|
mkdir -p "$MESA_DIR"
|
||||||
|
ldconfig 2>/dev/null || true
|
||||||
|
for lib in libGL.so.1 libGLX.so.0 libEGL.so.1 libOpenGL.so.0 libGLdispatch.so.0; do
|
||||||
|
src="$(ldconfig -p 2>/dev/null | grep -F "$lib" | awk '{print $NF}' | head -1)"
|
||||||
|
if [ -n "$src" ] && [ -f "$src" ]; then
|
||||||
|
cp -L "$src" "$MESA_DIR/"
|
||||||
|
# Create unversioned symlink for the linker
|
||||||
|
base="${lib%%.so.*}"
|
||||||
|
ln -sf "$lib" "$MESA_DIR/${base}.so"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installed imgui to $INSTALL_DIR"
|
echo "Installed imgui to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
import os
|
import os
|
||||||
|
import platform as _platform
|
||||||
|
|
||||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
SRC_DIR = os.path.join(DIR, "src")
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
MESA_DIR = os.path.join(DIR, "lib", "mesa")
|
||||||
|
|
||||||
|
|
||||||
def smoketest():
|
def smoketest():
|
||||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
||||||
assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found"
|
assert os.path.isfile(os.path.join(LIB_DIR, "libimgui.a")), "libimgui.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libglfw3.a")), "libglfw3.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "GLFW", "glfw3.h")), "GLFW/glfw3.h not found"
|
||||||
|
if _platform.system() == "Linux":
|
||||||
|
assert os.path.isfile(os.path.join(MESA_DIR, "libGL.so.1")), "libGL.so.1 not found"
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ build-backend = "setuptools.build_meta"
|
|||||||
[project]
|
[project]
|
||||||
name = "imgui"
|
name = "imgui"
|
||||||
version = "1.92.7"
|
version = "1.92.7"
|
||||||
description = "Dear ImGui + ImPlot + rlImGui (source distribution)"
|
description = "Dear ImGui + ImPlot + GLFW 3.4 (static)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools]
|
||||||
include = ["imgui*"]
|
packages = ["imgui"]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
imgui = ["install/**/*"]
|
imgui = ["install/**/*"]
|
||||||
|
|||||||
52
libusb/build.sh
Executable file
52
libusb/build.sh
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="1.0.29"
|
||||||
|
ARCHIVE="libusb-${VERSION}.tar.bz2"
|
||||||
|
URL="https://github.com/libusb/libusb/releases/download/v${VERSION}/${ARCHIVE}"
|
||||||
|
INSTALL_DIR="$DIR/libusb/install"
|
||||||
|
SRC_DIR="$DIR/libusb-src"
|
||||||
|
VERSION_FILE="$SRC_DIR/.version"
|
||||||
|
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
export CC="ccache ${CC:-cc}"
|
||||||
|
|
||||||
|
if [ ! -f "$VERSION_FILE" ] || [ "$(cat "$VERSION_FILE")" != "$VERSION" ]; then
|
||||||
|
rm -rf "$SRC_DIR"
|
||||||
|
mkdir -p "$SRC_DIR"
|
||||||
|
curl -fSL "$URL" | tar xj --strip-components=1 -C "$SRC_DIR"
|
||||||
|
echo "$VERSION" > "$VERSION_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PREFIX="$DIR/build/prefix"
|
||||||
|
rm -rf "$DIR/build"
|
||||||
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
|
CONFIGURE_ARGS=(
|
||||||
|
--prefix="$PREFIX"
|
||||||
|
--disable-shared
|
||||||
|
--enable-static
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
|
CONFIGURE_ARGS+=(--disable-udev)
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$SRC_DIR"
|
||||||
|
CFLAGS="-O2 -fPIC" ./configure "${CONFIGURE_ARGS[@]}"
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/lib/pkgconfig" "$INSTALL_DIR/include/libusb-1.0"
|
||||||
|
|
||||||
|
cp "$PREFIX/lib/libusb-1.0.a" "$INSTALL_DIR/lib/"
|
||||||
|
cp "$PREFIX/lib/pkgconfig/libusb-1.0.pc" "$INSTALL_DIR/lib/pkgconfig/"
|
||||||
|
cp "$PREFIX/include/libusb-1.0/libusb.h" "$INSTALL_DIR/include/libusb-1.0/"
|
||||||
|
|
||||||
|
echo "Installed libusb to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
12
libusb/libusb/__init__.py
Normal file
12
libusb/libusb/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
PKGCONFIG_DIR = os.path.join(LIB_DIR, "pkgconfig")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libusb-1.0.a")), "libusb-1.0.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "libusb-1.0", "libusb.h")), "libusb.h not found"
|
||||||
|
assert os.path.isfile(os.path.join(PKGCONFIG_DIR, "libusb-1.0.pc")), "libusb-1.0.pc not found"
|
||||||
15
libusb/pyproject.toml
Normal file
15
libusb/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "libusb"
|
||||||
|
version = "1.0.29"
|
||||||
|
description = "libusb USB device access library (static build)"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["libusb*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
libusb = ["install/**/*"]
|
||||||
58
libusb/setup.py
Normal file
58
libusb/setup.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
|
try:
|
||||||
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
|
except ImportError:
|
||||||
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
|
class BuildLibusb(build_py):
|
||||||
|
"""Run build.sh to compile libusb before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildLibusb}
|
||||||
|
|
||||||
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
|
class PlatformWheel(bdist_wheel):
|
||||||
|
"""Produce a platform-specific, Python-version-agnostic wheel."""
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
super().finalize_options()
|
||||||
|
self.root_is_pure = False
|
||||||
|
|
||||||
|
def get_tag(self):
|
||||||
|
system = platform.system()
|
||||||
|
machine = platform.machine()
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
plat = f"linux_{machine}"
|
||||||
|
elif system == "Darwin":
|
||||||
|
plat = "macosx_11_0_arm64"
|
||||||
|
else:
|
||||||
|
plat = f"{system.lower()}_{machine}"
|
||||||
|
|
||||||
|
return "py3", "none", plat
|
||||||
|
|
||||||
|
cmdclass["bdist_wheel"] = PlatformWheel
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
@@ -2,17 +2,21 @@
|
|||||||
members = [
|
members = [
|
||||||
"bzip2",
|
"bzip2",
|
||||||
"capnproto",
|
"capnproto",
|
||||||
|
"catch2",
|
||||||
"cppcheck",
|
"cppcheck",
|
||||||
"eigen",
|
"eigen",
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
"gcc-arm-none-eabi",
|
"gcc-arm-none-eabi",
|
||||||
|
"git",
|
||||||
"git-lfs",
|
"git-lfs",
|
||||||
"imgui",
|
"imgui",
|
||||||
"json11",
|
"json11",
|
||||||
|
"libusb",
|
||||||
"libjpeg",
|
"libjpeg",
|
||||||
"libyuv",
|
"libyuv",
|
||||||
"nanosvg",
|
"nanosvg",
|
||||||
"ncurses",
|
"ncurses",
|
||||||
|
"qt5",
|
||||||
"raylib",
|
"raylib",
|
||||||
"zeromq",
|
"zeromq",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|||||||
37
release.sh
37
release.sh
@@ -29,7 +29,7 @@ for toml in */pyproject.toml; do
|
|||||||
done
|
done
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
|
|
||||||
TOKEN="$(gh auth token 2>/dev/null)" || { echo "set GH_TOKEN to publish shim branch" >&2; exit 1; }
|
TOKEN="$(gh auth token 2>/dev/null)" || { echo "set GH_TOKEN to publish shim branches" >&2; exit 1; }
|
||||||
|
|
||||||
TMP_DIR="$(mktemp -d)"
|
TMP_DIR="$(mktemp -d)"
|
||||||
python3 - "$TMP_DIR" "$REPO" <<'PY'
|
python3 - "$TMP_DIR" "$REPO" <<'PY'
|
||||||
@@ -55,7 +55,8 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")):
|
|||||||
datadir = patterns[0].split("/", 1)[0] if patterns and patterns[0] else ""
|
datadir = patterns[0].split("/", 1)[0] if patterns and patterns[0] else ""
|
||||||
scripts = data.get("project", {}).get("scripts", {}) or {}
|
scripts = data.get("project", {}).get("scripts", {}) or {}
|
||||||
|
|
||||||
pkg_dir = tmp_dir / pkg
|
repo_dir = tmp_dir / pkg
|
||||||
|
pkg_dir = repo_dir / pkg
|
||||||
mod_dir = pkg_dir / module
|
mod_dir = pkg_dir / module
|
||||||
mod_dir.mkdir(parents=True, exist_ok=True)
|
mod_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
@@ -65,7 +66,8 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")):
|
|||||||
shutil.copy2(py_file, mod_dir / py_file.name)
|
shutil.copy2(py_file, mod_dir / py_file.name)
|
||||||
|
|
||||||
# copy extra packages (e.g. pyray for raylib)
|
# copy extra packages (e.g. pyray for raylib)
|
||||||
include_patterns = data.get("tool", {}).get("setuptools", {}).get("packages", {}).get("find", {}).get("include", [])
|
pkgs_val = data.get("tool", {}).get("setuptools", {}).get("packages", {})
|
||||||
|
include_patterns = pkgs_val.get("find", {}).get("include", []) if isinstance(pkgs_val, dict) else []
|
||||||
extra_packages = []
|
extra_packages = []
|
||||||
for pattern in include_patterns:
|
for pattern in include_patterns:
|
||||||
p = pattern.rstrip("*")
|
p = pattern.rstrip("*")
|
||||||
@@ -118,14 +120,25 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")):
|
|||||||
(pkg_dir / "pyproject.toml").write_text("\n".join(lines) + "\n")
|
(pkg_dir / "pyproject.toml").write_text("\n".join(lines) + "\n")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
(
|
shopt -s nullglob
|
||||||
cd "$TMP_DIR"
|
for repo_dir in "$TMP_DIR"/*; do
|
||||||
git init
|
[[ -d "$repo_dir" ]] || continue
|
||||||
git checkout -b releases
|
|
||||||
git add .
|
pkg="$(basename "$repo_dir")"
|
||||||
git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" commit -m "update shim packages"
|
branch="release-$pkg"
|
||||||
git remote add origin "https://x-access-token:${TOKEN}@github.com/${REPO}.git"
|
|
||||||
git push -f origin releases
|
echo "[$pkg] Publishing shim branch $branch"
|
||||||
)
|
|
||||||
|
(
|
||||||
|
cd "$repo_dir"
|
||||||
|
git init
|
||||||
|
git checkout -b "$branch"
|
||||||
|
git add "$pkg"
|
||||||
|
git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" commit -m "update $pkg shim"
|
||||||
|
git remote add origin "https://x-access-token:${TOKEN}@github.com/${REPO}.git"
|
||||||
|
git push -f origin "$branch"
|
||||||
|
)
|
||||||
|
done
|
||||||
|
shopt -u nullglob
|
||||||
|
|
||||||
rm -rf "$TMP_DIR"
|
rm -rf "$TMP_DIR"
|
||||||
|
|||||||
6
setup.sh
6
setup.sh
@@ -15,12 +15,12 @@ run_as_root() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
brew install nasm pkg-config ccache
|
brew install nasm pkg-config ccache autoconf automake libtool
|
||||||
elif command -v dnf &>/dev/null; then
|
elif command -v dnf &>/dev/null; then
|
||||||
dnf install -y nasm cmake gcc-c++ pkgconfig git perl-IPC-Cmd ccache
|
dnf install -y nasm cmake gcc-c++ pkgconfig git perl-IPC-Cmd ccache autoconf automake libtool
|
||||||
elif command -v apt-get &>/dev/null; then
|
elif command -v apt-get &>/dev/null; then
|
||||||
run_as_root apt-get update
|
run_as_root apt-get update
|
||||||
run_as_root apt-get install -y nasm cmake g++ pkg-config curl ccache
|
run_as_root apt-get install -y nasm cmake g++ pkg-config curl ccache autoconf automake libtool
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v uv &>/dev/null; then
|
if ! command -v uv &>/dev/null; then
|
||||||
|
|||||||
Reference in New Issue
Block a user