Compare commits

..

15 Commits

Author SHA1 Message Date
Adeeb Shihadeh
47e6adeb3d Vendor comma raylib in dependency package 2026-04-25 11:55:48 -07:00
Adeeb Shihadeh
9f9bc38a3e rm mdbook 2026-04-15 14:22:07 -07:00
Adeeb Shihadeh
79fefe6558 add mdbook package (#71) 2026-04-14 16:10:03 -07:00
Adeeb Shihadeh
2f5b981c19 fix git link: use CURL_LIBCURL for static deps (#66) 2026-03-24 11:20:08 -07:00
Adeeb Shihadeh
54dafe6c1b add git package (#63) 2026-03-23 18:13:19 -07:00
Adeeb Shihadeh
0fc2d13e50 ffmpeg: disable x86asm (nasm not needed for hw accel)
HW accel codecs bypass the CPU entirely — SIMD-optimized software
paths are irrelevant. Dropping x86asm removes ffmpeg's build-time
nasm dependency. nasm stays in setup.sh for x264 and libjpeg.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 16:13:05 -07:00
Adeeb Shihadeh
567fde8231 Revert "add shared library dependency check to distro tests"
This reverts commit d1af35e660.
2026-03-22 16:12:47 -07:00
Adeeb Shihadeh
d1af35e660 add shared library dependency check to distro tests
After installing wheels in clean containers, ldd all binaries and
.so files. Fails if any dependency is "not found", catching leaked
build-host deps that would break on end-user systems.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:40:40 -07:00
Adeeb Shihadeh
5457e99bb7 ffmpeg: add hardware-accelerated video decoders (#62) 2026-03-22 14:28:34 -07:00
Adeeb Shihadeh
0f28906d50 fix shim release 2026-03-21 10:53:26 -07:00
Adeeb Shihadeh
8b6c712f60 fix imgui 2026-03-21 10:39:33 -07:00
Adeeb Shihadeh
6ad06e2173 qt is always a mistake :( 2026-03-21 10:27:17 -07:00
Adeeb Shihadeh
577b731299 imgui: build static lib 2026-03-21 10:11:22 -07:00
Adeeb Shihadeh
6692e3d936 imgui: add libGL 2026-03-21 09:56:26 -07:00
Adeeb Shihadeh
6bc1fe9a9a split shim releases into per-package branches (#59) 2026-03-14 14:42:00 -07:00
21 changed files with 604 additions and 353 deletions

3
.gitignore vendored
View File

@@ -27,3 +27,6 @@ gcc-arm-none-eabi/gcc_arm_none_eabi/toolchain/
# downloaded git-lfs
git-lfs/git_lfs/bin/
# downloaded mdbook
mdbook/mdbook/bin/

View File

@@ -42,9 +42,9 @@ contributions welcome for other platforms!
```python
dependencies = [
# use the releases branch for pre-built wheels
"capnproto @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=capnproto",
"ffmpeg @ git+https://github.com/commaai/dependencies.git@releases#subdirectory=ffmpeg",
# use per-package release branches for pre-built wheels
"capnproto @ git+https://github.com/commaai/dependencies.git@release-capnproto#subdirectory=capnproto",
"ffmpeg @ git+https://github.com/commaai/dependencies.git@release-ffmpeg#subdirectory=ffmpeg",
# use the master branch to build the package on pip install
"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
* `./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
* 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

View File

@@ -4,9 +4,12 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$DIR"
PLATFORM="$(uname -s)"
FFMPEG_VERSION="7.1"
ZLIB_VERSION="da607da739fa6047df13e66a2af6b8bec7c2a498" # v1.3.2
X264_BRANCH="stable"
LIBDRM_VERSION="libdrm-2.4.124"
LIBVA_VERSION="2.22.0"
INSTALL_DIR="$DIR/ffmpeg/install"
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
@@ -48,6 +51,59 @@ make -j"$NJOBS"
make install
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 ---
if [ ! -d "ffmpeg-src/.git" ]; then
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
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}" \
./configure \
--cc="${CC:-cc}" \
@@ -70,6 +159,7 @@ PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
--disable-doc \
--disable-ffplay \
--disable-autodetect \
--disable-x86asm \
--disable-everything \
--enable-encoder=libx264,aac,ffvhuff,rawvideo,png,mjpeg \
--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-bsf=extract_extradata,h264_mp4toannexb,hevc_mp4toannexb \
--extra-cflags="-I$PREFIX/include" \
--extra-ldflags="-L$PREFIX/lib"
--extra-ldflags="-L$PREFIX/lib" \
"${HW_FLAGS[@]}"
make -j"$NJOBS"
make install
cd "$DIR"
@@ -94,7 +185,11 @@ cp "$PREFIX/bin/ffmpeg" "$INSTALL_DIR/bin/"
cp "$PREFIX/bin/ffprobe" "$INSTALL_DIR/bin/"
# 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/"
done

189
git/build.sh Executable file
View 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
View 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)

View File

@@ -3,13 +3,16 @@ requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "qt5"
version = "5.15.18"
description = "Qt 5.15 (QtBase + QtCharts)"
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 = ["qt5*"]
include = ["git*"]
[tool.setuptools.package-data]
qt5 = ["install/**/*"]
git = ["install/**/*"]

View File

@@ -10,8 +10,8 @@ except ImportError:
bdist_wheel = None
class BuildQt5(build_py):
"""Run build.sh to compile Qt5 before collecting package data."""
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__))
@@ -21,7 +21,7 @@ class BuildQt5(build_py):
super().run()
cmdclass = {"build_py": BuildQt5}
cmdclass = {"build_py": BuildGit}
if bdist_wheel is not None:

View File

@@ -11,8 +11,7 @@ NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
# ImPlot
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
# rlImGui
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
# GLFW 3.4
GLFW_COMMIT="7b6aead9fb88b3623e3b3725ebb42670cbe4c579"
@@ -32,14 +31,6 @@ fi
git -C implot-src fetch --depth 1 origin "$IMPLOT_COMMIT"
git -C implot-src checkout --force "$IMPLOT_COMMIT"
# Clone/update rlimgui
if [ ! -d "rlimgui-src/.git" ]; then
rm -rf rlimgui-src
git clone --depth 1 https://github.com/raylib-extras/rlImGui.git rlimgui-src
fi
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
# Clone/update GLFW
if [ ! -d "glfw-src/.git" ]; then
rm -rf glfw-src
@@ -73,37 +64,61 @@ cmake -B glfw-src/build -S glfw-src \
-DGLFW_BUILD_DOCS=OFF
cmake --build glfw-src/build --parallel "$NJOBS"
# Install
# Install headers
rm -rf "$INSTALL_DIR"
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src" "$INSTALL_DIR/lib"
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 \
imgui-src/imstb_rectpack.h imgui-src/imstb_textedit.h imgui-src/imstb_truetype.h \
"$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 \
imgui-src/backends/imgui_impl_glfw.h \
"$INSTALL_DIR/include/"
cp imgui-src/backends/imgui_impl_opengl3.cpp imgui-src/backends/imgui_impl_glfw.cpp \
"$INSTALL_DIR/src/"
# implot
# implot headers
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
cp rlimgui-src/rlImGui.h rlimgui-src/rlImGuiColors.h rlimgui-src/imgui_impl_raylib.h \
"$INSTALL_DIR/include/"
cp rlimgui-src/extras/FA6FreeSolidFontData.h rlimgui-src/extras/IconsFontAwesome6.h \
"$INSTALL_DIR/include/extras/"
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
# glfw
cp glfw-src/build/src/libglfw3.a "$INSTALL_DIR/lib/"
cp -r glfw-src/include/GLFW "$INSTALL_DIR/include/"
# Build libimgui.a (imgui core + backends + implot)
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"
du -sh "$INSTALL_DIR"

View File

@@ -1,13 +1,16 @@
import os
import platform as _platform
DIR = os.path.join(os.path.dirname(__file__), "install")
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():
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"

View File

@@ -5,11 +5,11 @@ build-backend = "setuptools.build_meta"
[project]
name = "imgui"
version = "1.92.7"
description = "Dear ImGui + ImPlot + rlImGui + GLFW 3.4 (static)"
description = "Dear ImGui + ImPlot + GLFW 3.4 (static)"
requires-python = ">=3.8"
[tool.setuptools.packages.find]
include = ["imgui*"]
[tool.setuptools]
packages = ["imgui"]
[tool.setuptools.package-data]
imgui = ["install/**/*"]

View File

@@ -6,6 +6,7 @@ members = [
"eigen",
"ffmpeg",
"gcc-arm-none-eabi",
"git",
"git-lfs",
"imgui",
"json11",

View File

@@ -1,159 +0,0 @@
#!/usr/bin/env bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$DIR"
QT_VERSION="5.15.18"
QT_TAG="v${QT_VERSION}-lts-lgpl"
INSTALL_DIR="$DIR/qt5/install"
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
# Install build dependencies
if [[ "$(uname)" == "Linux" ]]; then
if command -v dnf &>/dev/null; then
dnf install -y \
mesa-libGL-devel \
fontconfig-devel \
freetype-devel \
libxcb-devel \
xcb-util-devel \
xcb-util-image-devel \
xcb-util-keysyms-devel \
xcb-util-renderutil-devel \
xcb-util-wm-devel \
libxkbcommon-devel \
libxkbcommon-x11-devel \
libX11-devel \
perl-IPC-Cmd
elif command -v apt-get &>/dev/null; then
if [ "$(id -u)" -eq 0 ]; then
apt-get update && apt-get install -y \
libgl-dev \
libfontconfig1-dev libfreetype-dev \
libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev \
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev \
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \
libxcb-randr0-dev libxcb-render-util0-dev \
libxcb-xinerama0-dev libxcb-xkb-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libx11-xcb-dev
else
sudo apt-get update && sudo apt-get install -y \
libgl-dev \
libfontconfig1-dev libfreetype-dev \
libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev \
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev \
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \
libxcb-randr0-dev libxcb-render-util0-dev \
libxcb-xinerama0-dev libxcb-xkb-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libx11-xcb-dev
fi
fi
fi
# Clone/update qtbase
if [ ! -d "qtbase-src/.git" ]; then
rm -rf qtbase-src
git clone --depth 1 https://code.qt.io/qt/qtbase.git qtbase-src
fi
git -C qtbase-src fetch --depth 1 origin "$QT_TAG"
git -C qtbase-src checkout --force FETCH_HEAD
# Clean install dir and build artifacts to avoid stale cache issues
rm -rf "$INSTALL_DIR"
# Build qtbase (disable modules cabana doesn't need)
cd qtbase-src
make distclean 2>/dev/null || true
./configure \
-release \
-prefix "$INSTALL_DIR" \
-opensource -confirm-license \
-nomake examples \
-nomake tests \
-no-dbus \
-no-icu \
-opengl desktop
make -j"$NJOBS"
make install
cd "$DIR"
# Clone/update qtcharts
if [ ! -d "qtcharts-src/.git" ]; then
rm -rf qtcharts-src
git clone --depth 1 https://code.qt.io/qt/qtcharts.git qtcharts-src
fi
git -C qtcharts-src fetch --depth 1 origin "$QT_TAG"
git -C qtcharts-src checkout --force FETCH_HEAD
# Build qtcharts
cd qtcharts-src
make distclean 2>/dev/null || true
"$INSTALL_DIR/bin/qmake"
make -j"$NJOBS"
make install
cd "$DIR"
# Cleanup (don't let individual failures kill the build)
set +e
rm -rf "$INSTALL_DIR/doc" "$INSTALL_DIR/mkspecs" "$INSTALL_DIR/lib/cmake" "$INSTALL_DIR/lib/pkgconfig"
find "$INSTALL_DIR/lib" -name '*.prl' -delete 2>/dev/null || true
find "$INSTALL_DIR/lib" -name '*.la' -delete 2>/dev/null || true
# Remove unnecessary binaries (qmake alone is 28MB, only needed for qtcharts build above)
find "$INSTALL_DIR/bin" -not -name moc -not -name rcc -not -name uic -not -type d -delete 2>/dev/null || true
if [[ "$(uname)" == "Linux" ]]; then
# Remove unnecessary shared libs (keep only what cabana links)
KEEP_LIBS="Qt5Core Qt5Gui Qt5Widgets Qt5Charts Qt5OpenGL Qt5XcbQpa Qt5EglFSDeviceIntegration Qt5EglFsKmsSupport"
for f in "$INSTALL_DIR/lib/"lib*.so; do
name="${f##*/lib}"; name="${name%.so}"
echo "$KEEP_LIBS" | grep -qw "$name" || rm -f "$INSTALL_DIR/lib/lib${name}".so*
done
# Remove unnecessary include dirs
KEEP_INCLUDES="QtCore QtGui QtWidgets QtCharts QtOpenGL"
for d in "$INSTALL_DIR/include/"*/; do
name="$(basename "$d")"
echo "$KEEP_INCLUDES" | grep -qw "$name" || rm -rf "$d"
done
# Remove static libs
find "$INSTALL_DIR/lib" -maxdepth 1 -name '*.a' -delete
# Replace symlinks with copies (wheels can't store symlinks)
find "$INSTALL_DIR" -type l | while read -r link; do
target="$(readlink -f "$link")"
if [ -f "$target" ]; then
rm "$link"; cp "$target" "$link"
elif [ -d "$target" ]; then
rm "$link"; cp -r "$target" "$link"
fi
done
# Deduplicate versioned .so: keep only .so and .so.5 (SONAME)
find "$INSTALL_DIR/lib" -maxdepth 1 -name 'lib*.so.5.15.18' -delete
find "$INSTALL_DIR/lib" -maxdepth 1 -name 'lib*.so.5.15' -delete
# Strip
find "$INSTALL_DIR" -type f \( -name '*.so*' -o -path '*/bin/*' \) -exec strip --strip-unneeded {} + 2>/dev/null || true
else
# macOS: replace symlinks, strip frameworks
find "$INSTALL_DIR" -type l | while read -r link; do
target="$(readlink -f "$link")"
if [ -f "$target" ]; then
rm "$link"; cp "$target" "$link"
elif [ -d "$target" ]; then
rm "$link"; cp -r "$target" "$link"
fi
done
find "$INSTALL_DIR" -type f -name '*.dylib' -exec strip -x {} + 2>/dev/null || true
find "$INSTALL_DIR/bin" -type f -exec strip -x {} + 2>/dev/null || true
find "$INSTALL_DIR/lib" -maxdepth 1 -name '*.a' -delete 2>/dev/null || true
fi
set -e
echo "Installed Qt5 to $INSTALL_DIR"
du -sh "$INSTALL_DIR"

View File

@@ -1,19 +0,0 @@
import os
DIR = os.path.join(os.path.dirname(__file__), "install")
BIN_DIR = os.path.join(DIR, "bin")
LIB_DIR = os.path.join(DIR, "lib")
INCLUDE_DIR = os.path.join(DIR, "include")
def smoketest():
assert os.path.isfile(os.path.join(BIN_DIR, "moc")), "moc not found"
assert os.path.isfile(os.path.join(BIN_DIR, "rcc")), "rcc not found"
import glob
import platform
if platform.system() == "Darwin":
assert os.path.isdir(os.path.join(LIB_DIR, "QtCore.framework")), "QtCore.framework not found"
assert os.path.isdir(os.path.join(LIB_DIR, "QtCharts.framework")), "QtCharts.framework not found"
else:
assert glob.glob(os.path.join(LIB_DIR, "libQt5Core.so*")), "libQt5Core.so not found"
assert glob.glob(os.path.join(LIB_DIR, "libQt5Charts.so*")), "libQt5Charts.so not found"

View File

@@ -1,5 +1,8 @@
#!/usr/bin/env bash
set -e
set -euo pipefail
export SOURCE_DATE_EPOCH=0
export ZERO_AR_DATE=1
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$DIR"
@@ -7,30 +10,36 @@ cd "$DIR"
INSTALL_DIR="$DIR/raylib/install"
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
CC="ccache ${CC:-cc}"
# Detect platform: PLATFORM_COMMA for comma devices, PLATFORM_DESKTOP otherwise
RAYLIB_PLATFORM="${RAYLIB_PLATFORM:-PLATFORM_DESKTOP}"
if [ -f /TICI ]; then
RAYLIB_PLATFORM="PLATFORM_COMMA"
if command -v ccache >/dev/null 2>&1; then
CC="${CC:-ccache cc}"
else
CC="${CC:-cc}"
fi
export RAYLIB_PLATFORM
# Install build dependencies
if [[ "$(uname)" == "Linux" ]]; then
if [ "$RAYLIB_PLATFORM" = "PLATFORM_COMMA" ]; then
is_linux() {
[[ "$(uname)" == "Linux" ]]
}
install_linux_deps() {
local platform="$1"
if ! is_linux; then
return
fi
if [ "$platform" = "PLATFORM_COMMA" ]; then
# comma device: needs DRM/EGL/GLES headers (usually already present on AGNOS)
# apt may fail on devices due to read-only rootfs or package conflicts that's OK
if command -v apt-get &>/dev/null; then
# apt may fail on devices due to read-only rootfs or package conflicts; that's OK.
if command -v apt-get >/dev/null 2>&1; then
if [ "$(id -u)" -eq 0 ]; then
apt-get update && apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
else
sudo apt-get update && sudo apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
fi
fi
elif [ "$RAYLIB_PLATFORM" = "PLATFORM_OFFSCREEN" ]; then
# offscreen (CI): needs EGL/GL dev packages (no X11)
if command -v apt-get &>/dev/null; then
elif [ "$platform" = "PLATFORM_OFFSCREEN" ]; then
if command -v dnf >/dev/null 2>&1; then
dnf install -y mesa-libEGL-devel mesa-libGL-devel libglvnd-opengl libglvnd-core-devel 2>/dev/null || true
elif command -v apt-get >/dev/null 2>&1; then
if [ "$(id -u)" -eq 0 ]; then
apt-get update && apt-get install -y libegl-dev libgl-dev
else
@@ -38,10 +47,9 @@ if [[ "$(uname)" == "Linux" ]]; then
fi
fi
else
# desktop: needs X11/GL dev packages
if command -v dnf &>/dev/null; then
if command -v dnf >/dev/null 2>&1; then
dnf install -y libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel
elif command -v apt-get &>/dev/null; then
elif command -v apt-get >/dev/null 2>&1; then
if [ "$(id -u)" -eq 0 ]; then
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
else
@@ -49,55 +57,72 @@ if [[ "$(uname)" == "Linux" ]]; then
fi
fi
fi
fi
}
# Clone and build raylib C library
RAYLIB_COMMIT="d9d7cc1353ec0f73c97e84ddf0973983d1ee25e2"
# RAYLIB_COMMIT matches the openpilot third_party/raylib pin this package replaces.
RAYLIB_COMMIT="${RAYLIB_COMMIT:-3425bd9d1fb292ede4d80f97a1f4f258f614cffc}"
RAYLIB_OFFSCREEN_COMMIT="${RAYLIB_OFFSCREEN_COMMIT:-d9d7cc1353ec0f73c97e84ddf0973983d1ee25e2}"
RAYGUI_COMMIT="${RAYGUI_COMMIT:-76b36b597edb70ffaf96f046076adc20d67e7827}"
if [ ! -d "raylib-src/.git" ]; then
rm -rf raylib-src
git clone --depth 1 -b platform-offscreen --no-tags https://github.com/commaai/raylib.git raylib-src
git clone --depth 1 -b master --no-tags https://github.com/commaai/raylib.git raylib-src
fi
cd raylib-src
git fetch --depth 1 origin "$RAYLIB_COMMIT"
git reset --hard "$RAYLIB_COMMIT"
cd src
make clean
make -j"$NJOBS" PLATFORM="$RAYLIB_PLATFORM" CC="${CC:-gcc}"
cd "$DIR"
# Install lib + headers
rm -rf "$INSTALL_DIR"
mkdir -p "$INSTALL_DIR"/{lib,include}
cp raylib-src/src/libraylib.a "$INSTALL_DIR/lib/"
cp raylib-src/src/raylib.h raylib-src/src/raymath.h raylib-src/src/rlgl.h "$INSTALL_DIR/include/"
# On x86_64 Linux, also build the offscreen variant for CI headless rendering
if [[ "$(uname)" == "Linux" && "$(uname -m)" == "x86_64" && "$RAYLIB_PLATFORM" != "PLATFORM_OFFSCREEN" ]]; then
echo "Building offscreen variant..."
# Install EGL/GL dev packages needed for offscreen build + bundling
if command -v dnf &>/dev/null; then
dnf install -y mesa-libEGL-devel mesa-libGL-devel libglvnd-opengl libglvnd-core-devel 2>/dev/null || true
elif command -v apt-get &>/dev/null; then
if [ "$(id -u)" -eq 0 ]; then
apt-get update && apt-get install -y libegl-dev libgl-dev
if [ -n "${RAYLIB_VARIANTS:-}" ]; then
read -r -a VARIANTS <<< "$RAYLIB_VARIANTS"
elif [[ -f /TICI || -f /AGNOS ]]; then
VARIANTS=(comma)
elif is_linux && [[ "$(uname -m)" == "x86_64" ]]; then
VARIANTS=(desktop offscreen)
elif is_linux && [[ "$(uname -m)" == "aarch64" ]]; then
VARIANTS=(desktop comma)
else
sudo apt-get update && sudo apt-get install -y libegl-dev libgl-dev
fi
VARIANTS=(desktop)
fi
cd raylib-src/src
build_variant() {
local variant="$1"
local platform="PLATFORM_DESKTOP"
local commit="$RAYLIB_COMMIT"
if [ "$variant" = "comma" ]; then
platform="PLATFORM_COMMA"
elif [ "$variant" = "offscreen" ]; then
platform="PLATFORM_OFFSCREEN"
commit="$RAYLIB_OFFSCREEN_COMMIT"
fi
echo "Building raylib $variant ($platform)"
install_linux_deps "$platform"
cd "$DIR/raylib-src"
git fetch --depth 1 origin "$commit"
git reset --hard "$commit"
git clean -xdff .
cd src
make clean
make -j"$NJOBS" PLATFORM=PLATFORM_OFFSCREEN CC="${CC:-gcc}"
cp libraylib.a "$INSTALL_DIR/lib/libraylib_offscreen.a"
make -j"$NJOBS" PLATFORM="$platform" CC="$CC"
mkdir -p "$INSTALL_DIR/lib/$variant"
cp libraylib.a "$INSTALL_DIR/lib/$variant/libraylib.a"
if [ "$variant" = "${VARIANTS[0]}" ]; then
cp raylib.h raymath.h rlgl.h "$INSTALL_DIR/include/"
cp libraylib.a "$INSTALL_DIR/lib/libraylib.a"
fi
}
for variant in "${VARIANTS[@]}"; do
build_variant "$variant"
done
cd "$DIR"
# Bundle GLVND dispatchers so offscreen rendering works without extra system packages
if is_linux && [[ "$(uname -m)" == "x86_64" && " ${VARIANTS[*]} " == *" offscreen "* ]]; then
MESA_DIR="$INSTALL_DIR/lib/mesa"
mkdir -p "$MESA_DIR"
ldconfig 2>/dev/null || true
@@ -105,17 +130,21 @@ if [[ "$(uname)" == "Linux" && "$(uname -m)" == "x86_64" && "$RAYLIB_PLATFORM" !
src="$(ldconfig -p 2>/dev/null | grep "$lib" | grep -E 'x86.64|libc6,' | 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
# Download raygui header
RAYGUI_COMMIT="76b36b597edb70ffaf96f046076adc20d67e7827"
curl -fsSLo "$INSTALL_DIR/include/raygui.h" \
"https://raw.githubusercontent.com/raysan5/raygui/$RAYGUI_COMMIT/src/raygui.h"
cat > "$INSTALL_DIR/build-info.txt" <<EOF
raylib_commit=$RAYLIB_COMMIT
raylib_offscreen_commit=$RAYLIB_OFFSCREEN_COMMIT
raygui_commit=$RAYGUI_COMMIT
variants=${VARIANTS[*]}
EOF
echo "Installed raylib to $INSTALL_DIR"
du -sh "$INSTALL_DIR"

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "raylib"
version = "5.5.0.8"
version = "5.5.0.10"
description = "raylib + pyray Python bindings (commaai fork)"
requires-python = ">=3.8"
dependencies = ["cffi>=1.17.1"]

View File

@@ -1,71 +1,111 @@
import importlib
import os
import platform as _platform
DIR = os.path.join(os.path.dirname(__file__), "install")
LIB_DIR = os.path.join(DIR, "lib")
LIB_ROOT = os.path.join(DIR, "lib")
INCLUDE_DIR = os.path.join(DIR, "include")
BUILD_INFO = os.path.join(DIR, "build-info.txt")
_PLATFORM_BY_VARIANT = {
"comma": "PLATFORM_COMMA",
"desktop": "PLATFORM_DESKTOP",
"offscreen": "PLATFORM_OFFSCREEN",
}
def _detect_platform():
"""Auto-detect the raylib platform. In CI on Linux x86_64, use offscreen EGL rendering."""
explicit = os.environ.get("RAYLIB_PLATFORM", "")
def _normalize_variant(value):
if value in ("PLATFORM_COMMA", "comma"):
return "comma"
if value in ("PLATFORM_OFFSCREEN", "offscreen"):
return "offscreen"
if value in ("PLATFORM_DESKTOP", "desktop", ""):
return "desktop"
return value
def _detect_variant():
explicit = os.environ.get("RAYLIB_VARIANT") or os.environ.get("RAYLIB_PLATFORM", "")
if explicit:
return explicit
return _normalize_variant(explicit)
if os.path.isfile("/TICI") or os.path.isfile("/AGNOS"):
return "comma"
if os.environ.get("CI") and _platform.system() == "Linux" and _platform.machine() == "x86_64":
return "PLATFORM_OFFSCREEN"
return ""
return "offscreen"
return "desktop"
VARIANT = _detect_variant()
LIB_DIR = os.path.join(LIB_ROOT, VARIANT)
if not os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")):
LIB_DIR = LIB_ROOT
def _module_name(variant):
return f"_raylib_cffi_{variant}" if variant else "_raylib_cffi"
def _import_cffi_module():
names = [_module_name(VARIANT), "_raylib_cffi"]
seen = set()
for name in names:
if name in seen:
continue
seen.add(name)
try:
return importlib.import_module(f".{name}", __name__)
except ImportError:
continue
return None
def smoketest():
assert os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")), "libraylib.a not found"
assert os.path.isfile(os.path.join(INCLUDE_DIR, "raylib.h")), "raylib.h not found"
assert os.path.isfile(os.path.join(INCLUDE_DIR, "raymath.h")), "raymath.h not found"
assert os.path.isfile(os.path.join(INCLUDE_DIR, "rlgl.h")), "rlgl.h not found"
assert os.path.isfile(os.path.join(INCLUDE_DIR, "raygui.h")), "raygui.h not found"
assert os.path.isfile(BUILD_INFO), "build-info.txt not found"
try:
import _cffi_backend # noqa: F401
except ModuleNotFoundError:
return
assert _import_cffi_module() is not None, f"CFFI module for {VARIANT} not found"
import pyray # noqa: F401
# Build CFFI extension on first import if not already compiled,
# or rebuild if the target platform changed since last build.
def _ensure_cffi_built():
import glob
import subprocess
import sys
pkg_dir = os.path.dirname(__file__)
platform_marker = os.path.join(pkg_dir, ".raylib_platform")
requested = _detect_platform()
# Export so build.py picks it up
if requested:
os.environ["RAYLIB_PLATFORM"] = requested
# Mesa llvmpipe for software rendering in headless CI
if requested == "PLATFORM_OFFSCREEN":
os.environ.setdefault("LIBGL_ALWAYS_SOFTWARE", "1")
if _import_cffi_module() is not None:
return
cffi_files = glob.glob(os.path.join(pkg_dir, "_raylib_cffi*"))
build_script = os.path.join(os.path.dirname(__file__), "build.py")
if not os.path.isfile(build_script) or not os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")):
return
# Rebuild if platform changed
if cffi_files and requested:
built_for = open(platform_marker).read().strip() if os.path.isfile(platform_marker) else ""
if built_for != requested:
for f in cffi_files:
os.remove(f)
cffi_files = []
env = os.environ.copy()
env["RAYLIB_VARIANT"] = VARIANT
env["RAYLIB_PLATFORM"] = _PLATFORM_BY_VARIANT.get(VARIANT, "PLATFORM_DESKTOP")
env["RAYLIB_CFFI_MODULE"] = f"raylib.{_module_name(VARIANT)}"
if not cffi_files:
build_script = os.path.join(pkg_dir, "build.py")
if os.path.isfile(build_script) and os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")):
try:
subprocess.check_call([sys.executable, build_script], cwd=os.path.dirname(pkg_dir))
with open(platform_marker, "w") as f:
f.write(requested)
subprocess.check_call([sys.executable, build_script], cwd=os.path.dirname(os.path.dirname(__file__)), env=env)
except subprocess.CalledProcessError:
pass
_ensure_cffi_built()
# CFFI bindings (available when graphics libraries are present)
try:
from ._raylib_cffi import ffi, lib as rl
from raylib._raylib_cffi.lib import * # noqa: F403
_cffi_module = _import_cffi_module()
if _cffi_module is not None:
ffi = _cffi_module.ffi
rl = _cffi_module.lib
for _name in dir(rl):
if not _name.startswith("_"):
globals()[_name] = getattr(rl, _name)
from raylib.colors import * # noqa: F403
from raylib.defines import * # noqa: F403
from .version import __version__
except (ImportError, OSError):
pass

View File

@@ -11,8 +11,11 @@ from cffi import FFI
HERE = os.path.dirname(os.path.abspath(__file__))
RAYLIB_INCLUDE_PATH = os.path.join(HERE, "install", "include")
RAYLIB_LIB_PATH = os.path.join(HERE, "install", "lib")
RAYLIB_VARIANT = os.getenv("RAYLIB_VARIANT", "")
RAYLIB_LIB_ROOT = os.path.join(HERE, "install", "lib")
RAYLIB_LIB_PATH = os.path.join(RAYLIB_LIB_ROOT, RAYLIB_VARIANT) if RAYLIB_VARIANT else RAYLIB_LIB_ROOT
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "")
RAYLIB_CFFI_MODULE = os.getenv("RAYLIB_CFFI_MODULE", "raylib._raylib_cffi")
ffibuilder = FFI()
@@ -105,13 +108,9 @@ def build_ffi():
extra_link_args.remove('-lGL')
extra_link_args += ['-lGLESv2', '-lEGL', '-lgbm', '-ldrm']
elif RAYLIB_PLATFORM == "PLATFORM_OFFSCREEN":
# Use offscreen variant if available, otherwise fall back to default
offscreen_lib = os.path.join(RAYLIB_LIB_PATH, 'libraylib_offscreen.a')
if os.path.isfile(offscreen_lib):
extra_link_args[extra_link_args.index('-lraylib')] = '-lraylib_offscreen'
extra_link_args.remove('-lGL')
# Use bundled GLVND dispatchers if available, with RPATH for runtime
mesa_dir = os.path.join(RAYLIB_LIB_PATH, 'mesa')
mesa_dir = os.path.join(RAYLIB_LIB_ROOT, 'mesa')
if os.path.isdir(mesa_dir):
extra_link_args += [f'-L{mesa_dir}', f'-Wl,-rpath,$ORIGIN/install/lib/mesa']
extra_link_args += ['-lOpenGL', '-lEGL']
@@ -121,7 +120,7 @@ def build_ffi():
libraries = []
print("extra_link_args: " + str(extra_link_args))
ffibuilder.set_source("raylib._raylib_cffi",
ffibuilder.set_source(RAYLIB_CFFI_MODULE,
ffi_includes,
py_limited_api=True,
include_dirs=[RAYLIB_INCLUDE_PATH],

View File

@@ -1 +1 @@
__version__ = "5.5.0.8"
__version__ = "5.5.0.10"

View File

@@ -18,15 +18,37 @@ class BuildRaylib(build_py):
def run(self):
pkg_dir = os.path.dirname(os.path.abspath(__file__))
raylib_pkg_dir = os.path.join(pkg_dir, "raylib")
build_script = os.path.join(pkg_dir, "build.sh")
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
# Build CFFI extension so it's included in the wheel
cffi_so = glob.glob(os.path.join(pkg_dir, "raylib", "_raylib_cffi*"))
if not cffi_so:
build_cffi = os.path.join(pkg_dir, "raylib", "build.py")
# Build CFFI extensions so they are included in the wheel, and make sure stale
# local extensions from another raylib platform do not leak into the wheel.
for path in glob.glob(os.path.join(raylib_pkg_dir, "_raylib_cffi*")):
os.remove(path)
build_cffi = os.path.join(raylib_pkg_dir, "build.py")
if os.path.isfile(build_cffi):
subprocess.check_call([sys.executable, build_cffi], cwd=pkg_dir)
variants = [
os.path.basename(path)
for path in sorted(glob.glob(os.path.join(raylib_pkg_dir, "install", "lib", "*")))
if os.path.isfile(os.path.join(path, "libraylib.a"))
]
if not variants:
variants = [""]
platform_by_variant = {
"comma": "PLATFORM_COMMA",
"desktop": "PLATFORM_DESKTOP",
"offscreen": "PLATFORM_OFFSCREEN",
"": os.environ.get("RAYLIB_PLATFORM", ""),
}
for variant in variants:
env = os.environ.copy()
env["RAYLIB_VARIANT"] = variant
env["RAYLIB_PLATFORM"] = platform_by_variant.get(variant, "PLATFORM_DESKTOP")
env["RAYLIB_CFFI_MODULE"] = f"raylib._raylib_cffi_{variant}" if variant else "raylib._raylib_cffi"
subprocess.check_call([sys.executable, build_cffi], cwd=pkg_dir, env=env)
super().run()

View File

@@ -29,7 +29,7 @@ for toml in */pyproject.toml; do
done
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)"
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 ""
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.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)
# 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 = []
for pattern in include_patterns:
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")
PY
shopt -s nullglob
for repo_dir in "$TMP_DIR"/*; do
[[ -d "$repo_dir" ]] || continue
pkg="$(basename "$repo_dir")"
branch="release-$pkg"
echo "[$pkg] Publishing shim branch $branch"
(
cd "$TMP_DIR"
cd "$repo_dir"
git init
git checkout -b releases
git add .
git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" commit -m "update shim packages"
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 releases
git push -f origin "$branch"
)
done
shopt -u nullglob
rm -rf "$TMP_DIR"

View File

@@ -15,12 +15,12 @@ run_as_root() {
}
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
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
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
if ! command -v uv &>/dev/null; then