Compare commits
21 Commits
nanosvg/v0
...
raylib-uni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e6adeb3d | ||
|
|
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
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -6,13 +6,16 @@ members = [
|
|||||||
"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",
|
||||||
|
|||||||
143
raylib/build.sh
143
raylib/build.sh
@@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
@@ -7,30 +10,36 @@ cd "$DIR"
|
|||||||
INSTALL_DIR="$DIR/raylib/install"
|
INSTALL_DIR="$DIR/raylib/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)"
|
||||||
CC="ccache ${CC:-cc}"
|
if command -v ccache >/dev/null 2>&1; then
|
||||||
|
CC="${CC:-ccache cc}"
|
||||||
# Detect platform: PLATFORM_COMMA for comma devices, PLATFORM_DESKTOP otherwise
|
else
|
||||||
RAYLIB_PLATFORM="${RAYLIB_PLATFORM:-PLATFORM_DESKTOP}"
|
CC="${CC:-cc}"
|
||||||
if [ -f /TICI ]; then
|
|
||||||
RAYLIB_PLATFORM="PLATFORM_COMMA"
|
|
||||||
fi
|
fi
|
||||||
export RAYLIB_PLATFORM
|
|
||||||
|
|
||||||
# Install build dependencies
|
is_linux() {
|
||||||
if [[ "$(uname)" == "Linux" ]]; then
|
[[ "$(uname)" == "Linux" ]]
|
||||||
if [ "$RAYLIB_PLATFORM" = "PLATFORM_COMMA" ]; then
|
}
|
||||||
|
|
||||||
|
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)
|
# 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
|
# apt may fail on devices due to read-only rootfs or package conflicts; that's OK.
|
||||||
if command -v apt-get &>/dev/null; then
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
if [ "$(id -u)" -eq 0 ]; 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
|
apt-get update && apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
|
||||||
else
|
else
|
||||||
sudo apt-get update && sudo apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
|
sudo apt-get update && sudo apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$RAYLIB_PLATFORM" = "PLATFORM_OFFSCREEN" ]; then
|
elif [ "$platform" = "PLATFORM_OFFSCREEN" ]; then
|
||||||
# offscreen (CI): needs EGL/GL dev packages (no X11)
|
if command -v dnf >/dev/null 2>&1; then
|
||||||
if command -v apt-get &>/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 2>&1; then
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
apt-get update && apt-get install -y libegl-dev libgl-dev
|
apt-get update && apt-get install -y libegl-dev libgl-dev
|
||||||
else
|
else
|
||||||
@@ -38,10 +47,9 @@ if [[ "$(uname)" == "Linux" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# desktop: needs X11/GL dev packages
|
if command -v dnf >/dev/null 2>&1; then
|
||||||
if command -v dnf &>/dev/null; then
|
|
||||||
dnf install -y libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel
|
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
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
|
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
|
||||||
else
|
else
|
||||||
@@ -49,55 +57,72 @@ if [[ "$(uname)" == "Linux" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
# Clone and build raylib C library
|
# RAYLIB_COMMIT matches the openpilot third_party/raylib pin this package replaces.
|
||||||
RAYLIB_COMMIT="d9d7cc1353ec0f73c97e84ddf0973983d1ee25e2"
|
RAYLIB_COMMIT="${RAYLIB_COMMIT:-3425bd9d1fb292ede4d80f97a1f4f258f614cffc}"
|
||||||
|
RAYLIB_OFFSCREEN_COMMIT="${RAYLIB_OFFSCREEN_COMMIT:-d9d7cc1353ec0f73c97e84ddf0973983d1ee25e2}"
|
||||||
|
RAYGUI_COMMIT="${RAYGUI_COMMIT:-76b36b597edb70ffaf96f046076adc20d67e7827}"
|
||||||
|
|
||||||
if [ ! -d "raylib-src/.git" ]; then
|
if [ ! -d "raylib-src/.git" ]; then
|
||||||
rm -rf raylib-src
|
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
|
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"
|
rm -rf "$INSTALL_DIR"
|
||||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||||
|
|
||||||
cp raylib-src/src/libraylib.a "$INSTALL_DIR/lib/"
|
if [ -n "${RAYLIB_VARIANTS:-}" ]; then
|
||||||
cp raylib-src/src/raylib.h raylib-src/src/raymath.h raylib-src/src/rlgl.h "$INSTALL_DIR/include/"
|
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
|
||||||
|
VARIANTS=(desktop)
|
||||||
|
fi
|
||||||
|
|
||||||
# On x86_64 Linux, also build the offscreen variant for CI headless rendering
|
build_variant() {
|
||||||
if [[ "$(uname)" == "Linux" && "$(uname -m)" == "x86_64" && "$RAYLIB_PLATFORM" != "PLATFORM_OFFSCREEN" ]]; then
|
local variant="$1"
|
||||||
echo "Building offscreen variant..."
|
local platform="PLATFORM_DESKTOP"
|
||||||
|
local commit="$RAYLIB_COMMIT"
|
||||||
|
|
||||||
# Install EGL/GL dev packages needed for offscreen build + bundling
|
if [ "$variant" = "comma" ]; then
|
||||||
if command -v dnf &>/dev/null; then
|
platform="PLATFORM_COMMA"
|
||||||
dnf install -y mesa-libEGL-devel mesa-libGL-devel libglvnd-opengl libglvnd-core-devel 2>/dev/null || true
|
elif [ "$variant" = "offscreen" ]; then
|
||||||
elif command -v apt-get &>/dev/null; then
|
platform="PLATFORM_OFFSCREEN"
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
commit="$RAYLIB_OFFSCREEN_COMMIT"
|
||||||
apt-get update && apt-get install -y libegl-dev libgl-dev
|
|
||||||
else
|
|
||||||
sudo apt-get update && sudo apt-get install -y libegl-dev libgl-dev
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd raylib-src/src
|
echo "Building raylib $variant ($platform)"
|
||||||
make clean
|
install_linux_deps "$platform"
|
||||||
make -j"$NJOBS" PLATFORM=PLATFORM_OFFSCREEN CC="${CC:-gcc}"
|
|
||||||
cp libraylib.a "$INSTALL_DIR/lib/libraylib_offscreen.a"
|
|
||||||
cd "$DIR"
|
|
||||||
|
|
||||||
# Bundle GLVND dispatchers so offscreen rendering works without extra system packages
|
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" 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"
|
||||||
|
|
||||||
|
if is_linux && [[ "$(uname -m)" == "x86_64" && " ${VARIANTS[*]} " == *" offscreen "* ]]; then
|
||||||
MESA_DIR="$INSTALL_DIR/lib/mesa"
|
MESA_DIR="$INSTALL_DIR/lib/mesa"
|
||||||
mkdir -p "$MESA_DIR"
|
mkdir -p "$MESA_DIR"
|
||||||
ldconfig 2>/dev/null || true
|
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)"
|
src="$(ldconfig -p 2>/dev/null | grep "$lib" | grep -E 'x86.64|libc6,' | awk '{print $NF}' | head -1)"
|
||||||
if [ -n "$src" ] && [ -f "$src" ]; then
|
if [ -n "$src" ] && [ -f "$src" ]; then
|
||||||
cp -L "$src" "$MESA_DIR/"
|
cp -L "$src" "$MESA_DIR/"
|
||||||
# Create unversioned symlink for the linker
|
|
||||||
base="${lib%%.so.*}"
|
base="${lib%%.so.*}"
|
||||||
ln -sf "$lib" "$MESA_DIR/${base}.so"
|
ln -sf "$lib" "$MESA_DIR/${base}.so"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download raygui header
|
|
||||||
RAYGUI_COMMIT="76b36b597edb70ffaf96f046076adc20d67e7827"
|
|
||||||
curl -fsSLo "$INSTALL_DIR/include/raygui.h" \
|
curl -fsSLo "$INSTALL_DIR/include/raygui.h" \
|
||||||
"https://raw.githubusercontent.com/raysan5/raygui/$RAYGUI_COMMIT/src/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"
|
echo "Installed raylib to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "raylib"
|
name = "raylib"
|
||||||
version = "5.5.0.8"
|
version = "5.5.0.10"
|
||||||
description = "raylib + pyray Python bindings (commaai fork)"
|
description = "raylib + pyray Python bindings (commaai fork)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
dependencies = ["cffi>=1.17.1"]
|
dependencies = ["cffi>=1.17.1"]
|
||||||
|
|||||||
@@ -1,71 +1,111 @@
|
|||||||
|
import importlib
|
||||||
import os
|
import os
|
||||||
import platform as _platform
|
import platform as _platform
|
||||||
|
|
||||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
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")
|
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():
|
def _normalize_variant(value):
|
||||||
"""Auto-detect the raylib platform. In CI on Linux x86_64, use offscreen EGL rendering."""
|
if value in ("PLATFORM_COMMA", "comma"):
|
||||||
explicit = os.environ.get("RAYLIB_PLATFORM", "")
|
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:
|
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":
|
if os.environ.get("CI") and _platform.system() == "Linux" and _platform.machine() == "x86_64":
|
||||||
return "PLATFORM_OFFSCREEN"
|
return "offscreen"
|
||||||
return ""
|
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():
|
def smoketest():
|
||||||
assert os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")), "libraylib.a not found"
|
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, "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():
|
def _ensure_cffi_built():
|
||||||
import glob
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
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 _import_cffi_module() is not None:
|
||||||
if requested:
|
return
|
||||||
os.environ["RAYLIB_PLATFORM"] = requested
|
|
||||||
# Mesa llvmpipe for software rendering in headless CI
|
|
||||||
if requested == "PLATFORM_OFFSCREEN":
|
|
||||||
os.environ.setdefault("LIBGL_ALWAYS_SOFTWARE", "1")
|
|
||||||
|
|
||||||
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
|
env = os.environ.copy()
|
||||||
if cffi_files and requested:
|
env["RAYLIB_VARIANT"] = VARIANT
|
||||||
built_for = open(platform_marker).read().strip() if os.path.isfile(platform_marker) else ""
|
env["RAYLIB_PLATFORM"] = _PLATFORM_BY_VARIANT.get(VARIANT, "PLATFORM_DESKTOP")
|
||||||
if built_for != requested:
|
env["RAYLIB_CFFI_MODULE"] = f"raylib.{_module_name(VARIANT)}"
|
||||||
for f in cffi_files:
|
|
||||||
os.remove(f)
|
try:
|
||||||
cffi_files = []
|
subprocess.check_call([sys.executable, build_script], cwd=os.path.dirname(os.path.dirname(__file__)), env=env)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
pass
|
||||||
|
|
||||||
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)
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
_ensure_cffi_built()
|
_ensure_cffi_built()
|
||||||
|
|
||||||
# CFFI bindings (available when graphics libraries are present)
|
_cffi_module = _import_cffi_module()
|
||||||
try:
|
if _cffi_module is not None:
|
||||||
from ._raylib_cffi import ffi, lib as rl
|
ffi = _cffi_module.ffi
|
||||||
from raylib._raylib_cffi.lib import * # noqa: F403
|
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.colors import * # noqa: F403
|
||||||
from raylib.defines import * # noqa: F403
|
from raylib.defines import * # noqa: F403
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
except (ImportError, OSError):
|
|
||||||
pass
|
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ from cffi import FFI
|
|||||||
|
|
||||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||||
RAYLIB_INCLUDE_PATH = os.path.join(HERE, "install", "include")
|
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_PLATFORM = os.getenv("RAYLIB_PLATFORM", "")
|
||||||
|
RAYLIB_CFFI_MODULE = os.getenv("RAYLIB_CFFI_MODULE", "raylib._raylib_cffi")
|
||||||
|
|
||||||
ffibuilder = FFI()
|
ffibuilder = FFI()
|
||||||
|
|
||||||
@@ -105,13 +108,9 @@ def build_ffi():
|
|||||||
extra_link_args.remove('-lGL')
|
extra_link_args.remove('-lGL')
|
||||||
extra_link_args += ['-lGLESv2', '-lEGL', '-lgbm', '-ldrm']
|
extra_link_args += ['-lGLESv2', '-lEGL', '-lgbm', '-ldrm']
|
||||||
elif RAYLIB_PLATFORM == "PLATFORM_OFFSCREEN":
|
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')
|
extra_link_args.remove('-lGL')
|
||||||
# Use bundled GLVND dispatchers if available, with RPATH for runtime
|
# 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):
|
if os.path.isdir(mesa_dir):
|
||||||
extra_link_args += [f'-L{mesa_dir}', f'-Wl,-rpath,$ORIGIN/install/lib/mesa']
|
extra_link_args += [f'-L{mesa_dir}', f'-Wl,-rpath,$ORIGIN/install/lib/mesa']
|
||||||
extra_link_args += ['-lOpenGL', '-lEGL']
|
extra_link_args += ['-lOpenGL', '-lEGL']
|
||||||
@@ -121,7 +120,7 @@ def build_ffi():
|
|||||||
libraries = []
|
libraries = []
|
||||||
|
|
||||||
print("extra_link_args: " + str(extra_link_args))
|
print("extra_link_args: " + str(extra_link_args))
|
||||||
ffibuilder.set_source("raylib._raylib_cffi",
|
ffibuilder.set_source(RAYLIB_CFFI_MODULE,
|
||||||
ffi_includes,
|
ffi_includes,
|
||||||
py_limited_api=True,
|
py_limited_api=True,
|
||||||
include_dirs=[RAYLIB_INCLUDE_PATH],
|
include_dirs=[RAYLIB_INCLUDE_PATH],
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "5.5.0.8"
|
__version__ = "5.5.0.10"
|
||||||
|
|||||||
@@ -18,15 +18,37 @@ class BuildRaylib(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
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")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
# Build CFFI extension so it's included in the wheel
|
# Build CFFI extensions so they are included in the wheel, and make sure stale
|
||||||
cffi_so = glob.glob(os.path.join(pkg_dir, "raylib", "_raylib_cffi*"))
|
# local extensions from another raylib platform do not leak into the wheel.
|
||||||
if not cffi_so:
|
for path in glob.glob(os.path.join(raylib_pkg_dir, "_raylib_cffi*")):
|
||||||
build_cffi = os.path.join(pkg_dir, "raylib", "build.py")
|
os.remove(path)
|
||||||
if os.path.isfile(build_cffi):
|
|
||||||
subprocess.check_call([sys.executable, build_cffi], cwd=pkg_dir)
|
build_cffi = os.path.join(raylib_pkg_dir, "build.py")
|
||||||
|
if os.path.isfile(build_cffi):
|
||||||
|
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()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
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