Compare commits
62 Commits
eigen/v3.4
...
xvfb/v1.20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf61c10458 | ||
|
|
975313a86f | ||
|
|
19a9ed13c0 | ||
|
|
f9dd627e57 | ||
|
|
058ed3c076 | ||
|
|
9f9bc38a3e | ||
|
|
79fefe6558 | ||
|
|
2f5b981c19 | ||
|
|
54dafe6c1b | ||
|
|
0fc2d13e50 | ||
|
|
567fde8231 | ||
|
|
d1af35e660 | ||
|
|
5457e99bb7 | ||
|
|
0f28906d50 | ||
|
|
8b6c712f60 | ||
|
|
6ad06e2173 | ||
|
|
577b731299 | ||
|
|
6692e3d936 | ||
|
|
6bc1fe9a9a | ||
|
|
14d916d054 | ||
|
|
62afc9ea71 | ||
|
|
c55046f7f0 | ||
|
|
a78417ecd1 | ||
|
|
d14d45aef4 | ||
|
|
224cbbb783 | ||
|
|
53271a60fa | ||
|
|
8d9b59b9d0 | ||
|
|
950d288e77 | ||
|
|
331d94a683 | ||
|
|
2e9aed768a | ||
|
|
65674ad817 | ||
|
|
61379f09ec | ||
|
|
21bb9ab18e | ||
|
|
2341b89849 | ||
|
|
7d158432af | ||
|
|
c81badf4a5 | ||
|
|
122939fdf2 | ||
|
|
9690fd5160 | ||
|
|
c835b206c6 | ||
|
|
70b6bf1c40 | ||
|
|
d67b3e906e | ||
|
|
408cc4b949 | ||
|
|
9e9a5b56ac | ||
|
|
e46683e1fc | ||
|
|
db4664139a | ||
|
|
8472bcb091 | ||
|
|
357d36a61d | ||
|
|
ae529b6818 | ||
|
|
a3eeb36555 | ||
|
|
57b632b00a | ||
|
|
e35ea9f690 | ||
|
|
32c2a425b5 | ||
|
|
62d18088cc | ||
|
|
ec99b49198 | ||
|
|
31b96deac5 | ||
|
|
6fe17e7b31 | ||
|
|
2377af3f1f | ||
|
|
b9f89a5a5d | ||
|
|
fd4ae72793 | ||
|
|
dfa87aa31a | ||
|
|
71d4d1d3a1 | ||
|
|
f117a0e60d |
105
.github/workflows/ci.yml
vendored
Normal file
105
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build (${{ matrix.platform }})
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux-x86_64
|
||||
runs-on: ubuntu-latest
|
||||
- platform: linux-arm64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
- platform: macos
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: build-cache-v2-${{ matrix.platform }}-${{ hashFiles('build.sh', 'setup.sh', '*/pyproject.toml', '*/setup.py', '*/build.sh') }}
|
||||
restore-keys: build-cache-v2-${{ matrix.platform }}-
|
||||
path: |
|
||||
.uv-cache
|
||||
*/*/install
|
||||
*/*/toolchain
|
||||
*/*/bin
|
||||
*/*-src
|
||||
*/build
|
||||
- name: Build wheels
|
||||
env:
|
||||
MANYLINUX: ${{ runner.os == 'Linux' && '1' || '0' }}
|
||||
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
|
||||
BUILD_SH_REUSE_MANYLINUX_ARTIFACTS: "1"
|
||||
run: ./build.sh
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels-${{ matrix.platform }}
|
||||
path: dist/*.whl
|
||||
|
||||
test:
|
||||
name: test distro (${{ matrix.image }})
|
||||
needs: build
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- image: debian:bookworm-slim
|
||||
runs-on: ubuntu-latest
|
||||
- image: ubuntu:24.04
|
||||
runs-on: ubuntu-latest
|
||||
- image: ubuntu:20.04
|
||||
runs-on: ubuntu-latest
|
||||
- image: fedora:41
|
||||
runs-on: ubuntu-latest
|
||||
- image: archlinux:latest
|
||||
runs-on: ubuntu-latest
|
||||
- image: opensuse/tumbleweed:latest
|
||||
runs-on: ubuntu-latest
|
||||
- image: ghcr.io/void-linux/void-glibc:latest
|
||||
runs-on: ubuntu-latest
|
||||
- image: debian:bookworm-slim
|
||||
runs-on: ubuntu-24.04-arm
|
||||
# TODO: add musl test
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ contains(matrix.runs-on, 'arm') && 'wheels-linux-arm64' || 'wheels-linux-x86_64' }}
|
||||
path: dist/
|
||||
- run: ./test_wheels_in_image.sh "${{ matrix.image }}"
|
||||
|
||||
publish:
|
||||
name: publish wheels
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
needs: [build, test]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: wheels-*
|
||||
merge-multiple: true
|
||||
path: dist
|
||||
- uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: build-cache-v2-${{ matrix.platform }}-${{ hashFiles('build.sh', 'setup.sh', '*/pyproject.toml', '*/setup.py', '*/build.sh') }}
|
||||
restore-keys: build-cache-v2-${{ matrix.platform }}-
|
||||
path: |
|
||||
.uv-cache
|
||||
*/*/install
|
||||
*/*/toolchain
|
||||
*/*/bin
|
||||
- name: Publish wheels and shims
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: ./release.sh --publish-only
|
||||
212
.github/workflows/release.yml
vendored
212
.github/workflows/release.yml
vendored
@@ -1,212 +0,0 @@
|
||||
name: release wheels
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build - ${{ matrix.runs-on }}
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runs-on: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Install build dependencies
|
||||
run: ./setup.sh
|
||||
|
||||
- name: build and release wheels
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
pip install build
|
||||
|
||||
for toml in */pyproject.toml; do
|
||||
[ -f "$toml" ] || continue
|
||||
pkg="$(dirname "$toml")"
|
||||
version=$(python3 -c "import tomllib; print(tomllib.load(open('$toml', 'rb'))['project']['version'])")
|
||||
tag="${pkg}/v${version}"
|
||||
|
||||
echo "========================================="
|
||||
echo "Building: $pkg v$version"
|
||||
echo "========================================="
|
||||
python -m build --wheel "$pkg"
|
||||
|
||||
whl=$(ls "$pkg"/dist/*.whl)
|
||||
echo "Uploading: $whl"
|
||||
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" &>/dev/null; then
|
||||
gh release upload "$tag" "$whl" --repo "$GITHUB_REPOSITORY" --clobber
|
||||
else
|
||||
gh release create "$tag" "$whl" \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--title "$pkg v$version" \
|
||||
--notes "Platform wheels for $pkg $version"
|
||||
fi
|
||||
done
|
||||
|
||||
publish-shims:
|
||||
name: publish releases branch
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: build and push shim packages
|
||||
run: |
|
||||
REPO_URL="https://github.com/${GITHUB_REPOSITORY}"
|
||||
|
||||
# set up a temp dir for the releases branch
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
for toml in */pyproject.toml; do
|
||||
[ -f "$toml" ] || continue
|
||||
pkg="$(dirname "$toml")"
|
||||
version=$(python3 -c "import tomllib; print(tomllib.load(open('$toml', 'rb'))['project']['version'])")
|
||||
tag="${pkg}/v${version}"
|
||||
module="${pkg//-/_}"
|
||||
# detect the package-data directory (e.g. "toolchain" or "install")
|
||||
datadir=$(python3 -c "
|
||||
import tomllib
|
||||
t = tomllib.load(open('$toml', 'rb'))
|
||||
pat = t.get('tool', {}).get('setuptools', {}).get('package-data', {}).get('$module', [''])[0]
|
||||
print(pat.split('/')[0])
|
||||
")
|
||||
description=$(python3 -c "import tomllib; print(tomllib.load(open('$toml', 'rb'))['project']['description'])")
|
||||
|
||||
echo "========================================="
|
||||
echo "Creating shim: $pkg v$version (datadir=$datadir)"
|
||||
echo "========================================="
|
||||
|
||||
pkg_dir="$tmp/$pkg"
|
||||
mod_dir="$pkg_dir/$module"
|
||||
mkdir -p "$mod_dir"
|
||||
|
||||
# copy __init__.py from source
|
||||
cp "$pkg/$module/__init__.py" "$mod_dir/"
|
||||
|
||||
cat > "$pkg_dir/pyproject.toml" << TOML
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "$pkg"
|
||||
version = "$version"
|
||||
description = "$description (pre-built)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[project.scripts]
|
||||
$(grep -A100 '^\[project\.scripts\]' "$pkg/pyproject.toml" | tail -n +2 | sed '/^\[/q' | grep -v '^\[')
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["${module}*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
$module = ["${datadir}/**/*"]
|
||||
TOML
|
||||
|
||||
# setup.py — downloads pre-built wheel from GH releases and extracts data
|
||||
cat > "$pkg_dir/setup.py" << 'SETUP'
|
||||
import os
|
||||
import platform
|
||||
import zipfile
|
||||
from io import BytesIO
|
||||
from urllib.request import urlopen
|
||||
|
||||
from setuptools.command.build_py import build_py
|
||||
|
||||
REPO_URL = "REPO_URL_PLACEHOLDER"
|
||||
TAG = "TAG_PLACEHOLDER"
|
||||
VERSION = "VERSION_PLACEHOLDER"
|
||||
MODULE = "MODULE_PLACEHOLDER"
|
||||
DATADIR = "DATADIR_PLACEHOLDER"
|
||||
|
||||
PLATFORM_MAP = {
|
||||
("Linux", "x86_64"): "linux_x86_64",
|
||||
("Linux", "aarch64"): "linux_aarch64",
|
||||
("Darwin", "arm64"): "macosx_11_0_arm64",
|
||||
}
|
||||
|
||||
|
||||
class InstallPrebuilt(build_py):
|
||||
"""Download pre-built wheel from GitHub Releases and extract binaries."""
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
data_dir = os.path.join(pkg_dir, MODULE, DATADIR)
|
||||
|
||||
if not os.path.exists(os.path.join(data_dir, "bin")):
|
||||
key = (platform.system(), platform.machine())
|
||||
plat = PLATFORM_MAP.get(key)
|
||||
if plat is None:
|
||||
raise RuntimeError(f"unsupported platform: {key}")
|
||||
|
||||
whl_name = f"{MODULE}-{VERSION}-py3-none-{plat}.whl"
|
||||
url = f"{REPO_URL}/releases/download/{TAG}/{whl_name}"
|
||||
|
||||
print(f"Downloading {url} ...")
|
||||
data = urlopen(url).read()
|
||||
|
||||
print(f"Extracting {DATADIR} ...")
|
||||
with zipfile.ZipFile(BytesIO(data)) as zf:
|
||||
prefix = f"{MODULE}/{DATADIR}/"
|
||||
alt_prefix = f"{MODULE}-{VERSION}.data/purelib/{MODULE}/{DATADIR}/"
|
||||
for info in zf.infolist():
|
||||
for p in (prefix, alt_prefix):
|
||||
if info.filename.startswith(p):
|
||||
rel = info.filename[len(p):]
|
||||
if not rel:
|
||||
continue
|
||||
dest = os.path.join(data_dir, rel)
|
||||
if info.is_dir():
|
||||
os.makedirs(dest, exist_ok=True)
|
||||
else:
|
||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||
with open(dest, "wb") as f:
|
||||
f.write(zf.read(info))
|
||||
if info.external_attr >> 16 & 0o111:
|
||||
os.chmod(dest, 0o755)
|
||||
break
|
||||
|
||||
super().run()
|
||||
|
||||
|
||||
def setup():
|
||||
from setuptools import setup as _setup
|
||||
_setup(cmdclass={"build_py": InstallPrebuilt})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
SETUP
|
||||
|
||||
# template in the actual values
|
||||
sed -i "s|REPO_URL_PLACEHOLDER|${REPO_URL}|" "$pkg_dir/setup.py"
|
||||
sed -i "s|TAG_PLACEHOLDER|${tag}|" "$pkg_dir/setup.py"
|
||||
sed -i "s|VERSION_PLACEHOLDER|${version}|" "$pkg_dir/setup.py"
|
||||
sed -i "s|MODULE_PLACEHOLDER|${module}|" "$pkg_dir/setup.py"
|
||||
sed -i "s|DATADIR_PLACEHOLDER|${datadir}|" "$pkg_dir/setup.py"
|
||||
done
|
||||
|
||||
# push to releases branch
|
||||
cd "$tmp"
|
||||
git init
|
||||
git checkout -b releases
|
||||
git add .
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git commit -m "update shim packages"
|
||||
git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
git push -f origin releases
|
||||
92
.github/workflows/test.yml
vendored
92
.github/workflows/test.yml
vendored
@@ -1,92 +0,0 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build (${{ matrix.platform }})
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: macos
|
||||
runs-on: macos-latest
|
||||
- platform: linux-x86_64
|
||||
runs-on: ubuntu-latest
|
||||
- platform: linux-arm64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.14"
|
||||
- name: Install build dependencies
|
||||
run: ./setup.sh
|
||||
- name: Build wheels
|
||||
run: |
|
||||
for pkg in */pyproject.toml; do
|
||||
pip wheel "./$(dirname "$pkg")" --no-deps --wheel-dir dist/
|
||||
done
|
||||
- name: Smoketest locally
|
||||
run: bash smoketest.sh dist/
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels-${{ matrix.platform }}
|
||||
path: dist/*.whl
|
||||
|
||||
test:
|
||||
name: test (${{ matrix.image }})
|
||||
needs: build
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# test on vanilla linux images
|
||||
- image: debian:bookworm-slim
|
||||
runs-on: ubuntu-latest
|
||||
- image: ubuntu:24.04
|
||||
runs-on: ubuntu-latest
|
||||
- image: fedora:41
|
||||
runs-on: ubuntu-latest
|
||||
- image: archlinux:latest
|
||||
runs-on: ubuntu-latest
|
||||
# TODO: make musl work
|
||||
#- image: alpine:3.21
|
||||
# runs-on: ubuntu-latest
|
||||
- image: opensuse/tumbleweed:latest
|
||||
runs-on: ubuntu-latest
|
||||
- image: ghcr.io/void-linux/void-glibc:latest
|
||||
runs-on: ubuntu-latest
|
||||
- image: debian:bookworm-slim
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wheels-${{ contains(matrix.runs-on, 'arm') && 'linux-arm64' || 'linux-x86_64' }}
|
||||
path: wheels
|
||||
- name: build docker
|
||||
run: |
|
||||
docker build -t smoketest -f - . <<'DOCKERFILE'
|
||||
FROM ${{ matrix.image }}
|
||||
RUN if command -v apk >/dev/null; then \
|
||||
apk add --no-cache python3 py3-pip bash; \
|
||||
elif command -v apt-get >/dev/null; then \
|
||||
apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-venv; \
|
||||
elif command -v dnf >/dev/null; then \
|
||||
dnf install -y python3 python3-pip; \
|
||||
elif command -v pacman >/dev/null; then \
|
||||
pacman -Sy --noconfirm python python-pip; \
|
||||
elif command -v zypper >/dev/null; then \
|
||||
zypper install -y python3 python3-pip; \
|
||||
elif command -v xbps-install >/dev/null; then \
|
||||
xbps-install -Sy python3 python3-pip bash; \
|
||||
fi
|
||||
DOCKERFILE
|
||||
- name: ./smoketest.sh
|
||||
run: docker run --rm -v "$PWD:/work" -w /work smoketest bash smoketest.sh wheels/
|
||||
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
.git/
|
||||
repo/
|
||||
.venv/
|
||||
__pycache__/
|
||||
uv.lock
|
||||
|
||||
# agents
|
||||
.claude/
|
||||
@@ -12,10 +14,25 @@ build/
|
||||
dist/
|
||||
install/
|
||||
*.egg-info/
|
||||
*-src/
|
||||
*.tar.gz
|
||||
*.tar.xz
|
||||
*.tgz
|
||||
Python-*/
|
||||
ncurses-*/
|
||||
arm-gnu-toolchain-*/
|
||||
|
||||
# downloaded toolchain binaries
|
||||
gcc-arm-none-eabi/gcc_arm_none_eabi/toolchain/
|
||||
|
||||
|
||||
# downloaded git-lfs
|
||||
git-lfs/git_lfs/bin/
|
||||
|
||||
# downloaded mdbook
|
||||
mdbook/mdbook/bin/
|
||||
|
||||
# vendored at build time
|
||||
acados/acados/acados_template/
|
||||
acados/casadi/
|
||||
acados/casadi-venv/
|
||||
acados/casadi-wheel/
|
||||
|
||||
18
README.md
18
README.md
@@ -1,6 +1,6 @@
|
||||
# dependencies
|
||||
|
||||
a central repo for managing and [vendoring](https://htmx.org/essays/vendoring/) third party dependencies for all comma projects.
|
||||
a central repo for [vendoring](https://htmx.org/essays/vendoring/) all third party dependencies for comma projects.
|
||||
|
||||
since all our projects are Python, we wrap each vendored dependency as a pip package. `git clone` and `uv sync` is all you need.
|
||||
|
||||
@@ -9,8 +9,7 @@ motivations for this approach
|
||||
- `apt-get` updates its packages on a schedule we don't control
|
||||
- `apt-get` package versions don't match `brew` versions
|
||||
- `apt-get` doesn't come with Arch Linux
|
||||
- `apt-get` doesn't always have the exact package we need
|
||||
- `apt-get` packages are often bloated
|
||||
- `apt-get` packages come with more than we need, bloating our project footprint
|
||||
|
||||
<!--
|
||||
this critically adds friction to adding dependencies to our project
|
||||
@@ -27,6 +26,7 @@ we target the following platforms:
|
||||
|
||||
contributions welcome for other platforms!
|
||||
|
||||
<!--
|
||||
## packages
|
||||
|
||||
| package | description |
|
||||
@@ -36,13 +36,19 @@ contributions welcome for other platforms!
|
||||
| ffmpeg | video encode and decode for openpilot |
|
||||
| git-lfs | for tracking large files in openpilot |
|
||||
| zeromq | bridging the openpilot IPC between different hosts |
|
||||
-->
|
||||
|
||||
## usage
|
||||
|
||||
```python
|
||||
dependencies = [
|
||||
"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",
|
||||
"ffmpeg @ git+https://github.com/commaai/dependencies.git@master#subdirectory=ffmpeg",
|
||||
]
|
||||
```
|
||||
|
||||
@@ -52,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
|
||||
|
||||
107
_shim_setup.py
Normal file
107
_shim_setup.py
Normal file
@@ -0,0 +1,107 @@
|
||||
"""Shim setup.py: downloads pre-built wheels from GitHub Releases at install time."""
|
||||
import os
|
||||
import platform
|
||||
import time
|
||||
import zipfile
|
||||
from io import BytesIO
|
||||
from urllib.error import URLError
|
||||
from urllib.request import urlopen
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
except ImportError:
|
||||
import tomli as tomllib
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.command.build_py import build_py
|
||||
|
||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
with open(os.path.join(_HERE, "pyproject.toml"), "rb") as _f:
|
||||
_cfg = tomllib.load(_f)
|
||||
|
||||
REPO_URL = _cfg["tool"]["shim"]["repo_url"]
|
||||
TAG = _cfg["tool"]["shim"]["tag"]
|
||||
DATADIR = _cfg["tool"]["shim"]["datadir"]
|
||||
VERSION = _cfg["project"]["version"]
|
||||
MODULE = _cfg["project"]["name"].replace("-", "_")
|
||||
|
||||
# all top-level packages bundled in this wheel (e.g. acados + casadi).
|
||||
# `packages` may be a flat list or a dict with find.include patterns.
|
||||
_pkgs = _cfg.get("tool", {}).get("setuptools", {}).get("packages", [f"{MODULE}*"])
|
||||
if isinstance(_pkgs, list):
|
||||
_INCLUDE = _pkgs
|
||||
elif isinstance(_pkgs, dict):
|
||||
_INCLUDE = _pkgs.get("find", {}).get("include", [f"{MODULE}*"])
|
||||
else:
|
||||
_INCLUDE = [f"{MODULE}*"]
|
||||
TOP_PACKAGES = sorted({p.rstrip("*").rstrip("/") for p in _INCLUDE if p.rstrip("*").rstrip("/")})
|
||||
|
||||
PLATFORM_MAP = {
|
||||
("Linux", "x86_64"): "linux_x86_64",
|
||||
("Linux", "aarch64"): "linux_aarch64",
|
||||
("Darwin", "arm64"): "macosx_11_0_arm64",
|
||||
}
|
||||
|
||||
|
||||
class InstallPrebuilt(build_py):
|
||||
def run(self):
|
||||
module_dir = os.path.join(_HERE, MODULE)
|
||||
data_dir = os.path.join(module_dir, DATADIR)
|
||||
|
||||
if not os.path.exists(os.path.join(data_dir, "bin")):
|
||||
key = (platform.system(), platform.machine())
|
||||
plat = PLATFORM_MAP.get(key)
|
||||
if plat is None:
|
||||
raise RuntimeError(f"unsupported platform: {key}")
|
||||
|
||||
whl_names = [
|
||||
f"{MODULE}-{VERSION}-py3-none-{plat}.whl",
|
||||
f"{MODULE}-{VERSION}-py3-none-any.whl",
|
||||
]
|
||||
|
||||
raw = None
|
||||
for whl_name in whl_names:
|
||||
url = f"{REPO_URL}/releases/download/{TAG}/{whl_name}"
|
||||
print(f"Downloading {url} ...")
|
||||
for attempt in range(3):
|
||||
try:
|
||||
raw = urlopen(url, timeout=60).read()
|
||||
break
|
||||
except (URLError, OSError) as e:
|
||||
if attempt == 2:
|
||||
if whl_name == whl_names[-1]:
|
||||
raise
|
||||
break
|
||||
wait = 2 ** attempt
|
||||
print(f"Download failed ({e}), retrying in {wait}s ...")
|
||||
time.sleep(wait)
|
||||
if raw is not None:
|
||||
break
|
||||
|
||||
print("Extracting wheel ...")
|
||||
with zipfile.ZipFile(BytesIO(raw)) as zf:
|
||||
purelib_data = f"{MODULE}-{VERSION}.data/purelib/"
|
||||
for info in zf.infolist():
|
||||
if info.is_dir():
|
||||
continue
|
||||
name = info.filename
|
||||
if name.startswith(purelib_data):
|
||||
rel = name[len(purelib_data):]
|
||||
else:
|
||||
rel = name
|
||||
if "/" not in rel:
|
||||
continue
|
||||
top = rel.split("/", 1)[0]
|
||||
if top not in TOP_PACKAGES:
|
||||
continue
|
||||
dest = os.path.join(_HERE, rel)
|
||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||
with open(dest, "wb") as f:
|
||||
f.write(zf.read(info))
|
||||
if info.external_attr >> 16 & 0o111:
|
||||
os.chmod(dest, 0o755)
|
||||
|
||||
super().run()
|
||||
|
||||
|
||||
setup(cmdclass={"build_py": InstallPrebuilt})
|
||||
48
acados/acados/__init__.py
Normal file
48
acados/acados/__init__.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import os
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||
LIB_DIR = os.path.join(DIR, "lib")
|
||||
BIN_DIR = os.path.join(DIR, "bin")
|
||||
TERA_PATH = os.path.join(BIN_DIR, "t_renderer")
|
||||
|
||||
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "acados_template")
|
||||
|
||||
|
||||
def smoketest():
|
||||
import sys
|
||||
|
||||
lib_ext = ".dylib" if sys.platform == "darwin" else ".so"
|
||||
for lib in ("libacados", "libblasfeo", "libhpipm", "libqpOASES_e"):
|
||||
path = os.path.join(LIB_DIR, lib + lib_ext)
|
||||
assert os.path.isfile(path), f"missing lib: {path}"
|
||||
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "acados_c", "ocp_nlp_interface.h"))
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "blasfeo", "include", "blasfeo.h"))
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "hpipm", "include", "hpipm_common.h"))
|
||||
|
||||
assert os.path.isfile(TERA_PATH) and os.access(TERA_PATH, os.X_OK), f"t_renderer missing/not executable: {TERA_PATH}"
|
||||
|
||||
assert os.path.isfile(os.path.join(TEMPLATE_DIR, "__init__.py"))
|
||||
assert os.path.isfile(os.path.join(TEMPLATE_DIR, "acados_layout.json"))
|
||||
assert os.path.isdir(os.path.join(TEMPLATE_DIR, "c_templates_tera"))
|
||||
|
||||
# the vendored slim casadi shipped in this wheel is built against cpython 3.12
|
||||
# and pulls in numpy; only exercise it when both are available (real consumers
|
||||
# like openpilot install via the shim, which declares numpy as a dep).
|
||||
try:
|
||||
import numpy # noqa: F401
|
||||
except ImportError:
|
||||
return
|
||||
if sys.version_info[:2] != (3, 12):
|
||||
return
|
||||
|
||||
from casadi import SX, MX, DM, Function, CasadiMeta, vertcat, jacobian, sin, cos, n_nodes # noqa: F401
|
||||
|
||||
x = SX.sym("x")
|
||||
y = SX.sym("y")
|
||||
expr = vertcat(sin(x), cos(y))
|
||||
J = jacobian(expr, vertcat(x, y))
|
||||
assert J.shape == (2, 2)
|
||||
assert n_nodes(J) > 0
|
||||
assert isinstance(CasadiMeta.version(), str)
|
||||
139
acados/build.sh
Executable file
139
acados/build.sh
Executable file
@@ -0,0 +1,139 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
# v0.2.2
|
||||
VERSION="8af9b0ad180940ef611884574a0b27a43504311d"
|
||||
INSTALL_DIR="$DIR/acados/install"
|
||||
TEMPLATE_DIR="$DIR/acados/acados_template"
|
||||
CASADI_DIR="$DIR/casadi"
|
||||
CASADI_VERSION="3.6.7"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
# pick BLAS target per host arch
|
||||
ARCH="$(uname -m)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# this BLASFEO version doesn't have an Apple Silicon target; Cortex-A57
|
||||
# baseline ARMv8 SIMD compiles and runs fine on M1+.
|
||||
BLAS_TARGET="ARMV8A_ARM_CORTEX_A57"
|
||||
elif [[ "$ARCH" == "aarch64" ]]; then
|
||||
# Cortex-A57 = TICI baseline; safe for any modern aarch64
|
||||
BLAS_TARGET="ARMV8A_ARM_CORTEX_A57"
|
||||
else
|
||||
BLAS_TARGET="X64_AUTOMATIC"
|
||||
fi
|
||||
|
||||
ACADOS_FLAGS=(
|
||||
-DACADOS_WITH_QPOASES=ON
|
||||
-UBLASFEO_TARGET
|
||||
-DBLASFEO_TARGET="$BLAS_TARGET"
|
||||
-DACADOS_INSTALL_DIR="$INSTALL_DIR"
|
||||
# acados (and several of its submodules) still pin cmake_minimum_required <3.5;
|
||||
# CMake 4 removed that compatibility, so re-enable it here.
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
# qpOASES + blasfeo both call malloc()/posix_memalign() without including
|
||||
# <stdlib.h>. C99/C2x and modern gcc/clang reject implicit declarations as
|
||||
# errors. qpOASES also has a real Constraints*/Constraints** pointer bug
|
||||
# that gcc 14+ now flags as an error too. Downgrade both so the upstream
|
||||
# (pinned) sources keep compiling.
|
||||
"-DCMAKE_C_FLAGS=-Wno-implicit-function-declaration -Wno-incompatible-pointer-types"
|
||||
)
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
ACADOS_FLAGS+=(
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64
|
||||
-DCMAKE_MACOSX_RPATH=1
|
||||
)
|
||||
fi
|
||||
|
||||
# clone/update source
|
||||
if [ ! -d "acados-src/.git" ]; then
|
||||
rm -rf acados-src
|
||||
git clone https://github.com/acados/acados.git acados-src
|
||||
fi
|
||||
git -C acados-src fetch --all --tags
|
||||
git -C acados-src checkout --force "$VERSION"
|
||||
git -C acados-src submodule update --init --recursive --depth=1
|
||||
|
||||
# build acados
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake "${ACADOS_FLAGS[@]}" "$DIR/acados-src"
|
||||
make -j"$NJOBS" install
|
||||
cd "$DIR"
|
||||
|
||||
# we don't ship sample json templates
|
||||
rm -f "$INSTALL_DIR"/lib/*.json
|
||||
|
||||
# python interface package (acados_template)
|
||||
rm -rf "$TEMPLATE_DIR"
|
||||
cp -r acados-src/interfaces/acados_template/acados_template "$TEMPLATE_DIR"
|
||||
|
||||
# strip future_fstrings (avoids needing the compatibility package on py>=3.6).
|
||||
# Cython chokes on the unknown encoding in .pyx/.pxd too, not just .py.
|
||||
find "$TEMPLATE_DIR" -type f \( -name '*.py' -o -name '*.pyx' -o -name '*.pxd' \) \
|
||||
-exec sed -i.bak '/future.fstrings/d' {} +
|
||||
find "$TEMPLATE_DIR" -name '*.bak' -delete
|
||||
|
||||
# acados_template's gnsf/check_reformulation.py uses an absolute `from
|
||||
# acados_template.utils import ...` that only worked when acados_template was
|
||||
# itself a top-level package on the path. We ship it as `acados.acados_template`,
|
||||
# so rewrite to the relative form the rest of gnsf already uses.
|
||||
if [ -f "$TEMPLATE_DIR/gnsf/check_reformulation.py" ]; then
|
||||
sed -i.bak 's/^from acados_template\.utils /from ..utils /' "$TEMPLATE_DIR/gnsf/check_reformulation.py"
|
||||
rm -f "$TEMPLATE_DIR/gnsf/check_reformulation.py.bak"
|
||||
fi
|
||||
|
||||
# build tera renderer (needs cargo)
|
||||
if ! command -v cargo >/dev/null 2>&1; then
|
||||
echo "installing rust toolchain (needed for tera_renderer)..."
|
||||
curl -LsSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
|
||||
# shellcheck disable=SC1091
|
||||
source "$HOME/.cargo/env"
|
||||
fi
|
||||
|
||||
mkdir -p "$INSTALL_DIR/bin"
|
||||
cd "$DIR/acados-src/interfaces/acados_template/tera_renderer/"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
cargo build --release --target aarch64-apple-darwin
|
||||
cp target/aarch64-apple-darwin/release/t_renderer "$INSTALL_DIR/bin/t_renderer"
|
||||
else
|
||||
cargo build --release
|
||||
cp target/release/t_renderer "$INSTALL_DIR/bin/t_renderer"
|
||||
fi
|
||||
|
||||
cd "$DIR"
|
||||
|
||||
# vendor a slim casadi: install the upstream wheel into a throwaway cp312 venv
|
||||
# (uv resolves the right platform wheel automatically), then move the casadi/
|
||||
# tree out and slim it.
|
||||
echo "vendoring casadi $CASADI_VERSION ..."
|
||||
rm -rf "$CASADI_DIR" casadi-venv
|
||||
uv venv --python 3.12 --quiet casadi-venv
|
||||
uv pip install --python casadi-venv/bin/python --no-deps --quiet "casadi==$CASADI_VERSION"
|
||||
mv casadi-venv/lib/python3.12/site-packages/casadi "$CASADI_DIR"
|
||||
rm -rf casadi-venv
|
||||
|
||||
# drop everything except the bits openpilot actually needs:
|
||||
# - __init__.py, casadi.py, tools/ (Python wrapper)
|
||||
# - _casadi.so (CPython extension; same name on linux+darwin)
|
||||
# - libcasadi.{so,dylib}* (the C++ runtime that _casadi.so links to)
|
||||
# openpilot only uses symbolic SX/MX/Function/jacobian etc., which live in
|
||||
# libcasadi + _casadi. Solver plugins (conic_*, nlpsol_*, integrator_*, ...)
|
||||
# and their third-party backends (ipopt, bonmin, hpipm, fatrop, ...) are
|
||||
# loaded lazily via dlopen and never reached.
|
||||
cd "$CASADI_DIR"
|
||||
shopt -s extglob
|
||||
# libc++.*.dylib only exists on darwin and is needed by _casadi.so via @rpath
|
||||
rm -rf !(__init__.py|casadi.py|_casadi.so|tools|libcasadi.*|libc++.*)
|
||||
shopt -u extglob
|
||||
|
||||
cd "$DIR"
|
||||
rm -rf casadi-wheel
|
||||
|
||||
echo "Installed acados to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
echo "Vendored casadi (slim) at $CASADI_DIR"
|
||||
du -sh "$CASADI_DIR"
|
||||
23
acados/pyproject.toml
Normal file
23
acados/pyproject.toml
Normal file
@@ -0,0 +1,23 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "acados"
|
||||
version = "0.2.2"
|
||||
description = "acados solvers + Python interface, with a slimmed casadi vendored alongside"
|
||||
requires-python = ">=3.8"
|
||||
dependencies = [
|
||||
# the vendored casadi.py shim imports numpy at module load time
|
||||
"numpy",
|
||||
]
|
||||
|
||||
# `find` runs at setup() init time, before build.sh creates these dirs, so
|
||||
# enumerate packages explicitly. acados.acados_template + casadi.tools are
|
||||
# subpackages and ship via package-data.
|
||||
[tool.setuptools]
|
||||
packages = ["acados", "casadi"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
acados = ["install/**/*", "acados_template/**/*"]
|
||||
casadi = ["**/*"]
|
||||
68
acados/setup.py
Normal file
68
acados/setup.py
Normal file
@@ -0,0 +1,68 @@
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
from setuptools.command.build_py import build_py
|
||||
|
||||
# `casadi/` is generated by build.sh (vendored from the upstream wheel), but
|
||||
# setuptools requires every declared package to have a directory + __init__.py
|
||||
# *before* any command runs. Drop a stub if it isn't there yet — build.sh
|
||||
# replaces it with the real slim casadi during build_py.
|
||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
_casadi_init = os.path.join(_HERE, "casadi", "__init__.py")
|
||||
if not os.path.exists(_casadi_init):
|
||||
os.makedirs(os.path.dirname(_casadi_init), exist_ok=True)
|
||||
open(_casadi_init, "w").close()
|
||||
|
||||
try:
|
||||
from wheel.bdist_wheel import bdist_wheel
|
||||
except ImportError:
|
||||
bdist_wheel = None
|
||||
|
||||
|
||||
class BuildAcados(build_py):
|
||||
"""Run build.sh to compile acados 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": BuildAcados}
|
||||
|
||||
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()
|
||||
81
build.sh
Executable file
81
build.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
echo "usage: MANYLINUX=1 ./build.sh" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
USE_MANYLINUX="${MANYLINUX:-0}"
|
||||
|
||||
if [[ -z "${BUILD_SH_IN_MANYLINUX:-}" ]] && ! command -v uv >/dev/null 2>&1; then
|
||||
./setup.sh
|
||||
fi
|
||||
|
||||
if [[ "$USE_MANYLINUX" == "1" && -z "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
||||
UV_BIN="$(command -v uv)"
|
||||
docker run --rm \
|
||||
-e BUILD_SH_IN_MANYLINUX=1 \
|
||||
-e BUILD_SH_REUSE_MANYLINUX_ARTIFACTS="${BUILD_SH_REUSE_MANYLINUX_ARTIFACTS:-}" \
|
||||
-e HOME=/tmp \
|
||||
-e UV_CACHE_DIR=/work/.uv-cache \
|
||||
-e UV_PYTHON=/opt/python/cp312-cp312/bin/python3 \
|
||||
-v "$ROOT_DIR:/work" \
|
||||
-v "$UV_BIN:/usr/local/bin/uv:ro" \
|
||||
-w /work \
|
||||
"quay.io/pypa/manylinux_2_28_$(uname -m)" \
|
||||
bash build.sh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
||||
export PATH="/opt/python/cp312-cp312/bin:$PATH"
|
||||
|
||||
# cached *-src repos may be owned by the host runner user; tell git to trust them
|
||||
git config --global --add safe.directory '*'
|
||||
|
||||
./setup.sh
|
||||
|
||||
if [[ -z "${BUILD_SH_REUSE_MANYLINUX_ARTIFACTS:-}" ]]; then
|
||||
for toml in */pyproject.toml; do
|
||||
pkg="${toml%/pyproject.toml}"
|
||||
module="${pkg//-/_}"
|
||||
rm -rf "$pkg/$module/install" "$pkg/$module/toolchain" "$pkg/$module/bin"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
export CMAKE_C_COMPILER_LAUNCHER=ccache
|
||||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
echo "Building workspace packages into dist"
|
||||
START_SECS=$SECONDS
|
||||
|
||||
mkdir -p dist/
|
||||
rm -rf dist/*
|
||||
uv build --all-packages --wheel --out-dir dist --no-create-gitignore
|
||||
|
||||
if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
||||
VENV_DIR="$ROOT_DIR/.venv-manylinux"
|
||||
else
|
||||
VENV_DIR="$ROOT_DIR/.venv"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Running smoketests"
|
||||
|
||||
uv venv --allow-existing --quiet "$VENV_DIR"
|
||||
uv pip install --python "$VENV_DIR/bin/python" --reinstall --no-deps --quiet dist/*.whl >/dev/null
|
||||
|
||||
for toml in */pyproject.toml; do
|
||||
module="$(basename "$(dirname "$toml")" | tr '-' '_')"
|
||||
"$VENV_DIR/bin/python" -c "import $module; $module.smoketest()" >/dev/null
|
||||
done
|
||||
|
||||
du -hs dist/* | sort -hr
|
||||
|
||||
echo
|
||||
echo "Done in $((SECONDS - START_SECS))s"
|
||||
37
bzip2/build.sh
Executable file
37
bzip2/build.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="bzip2-1.0.8"
|
||||
INSTALL_DIR="$DIR/bzip2/install"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
CC="ccache ${CC:-cc}"
|
||||
|
||||
# Clone/update source
|
||||
if [ ! -d "bzip2-src/.git" ]; then
|
||||
rm -rf bzip2-src
|
||||
git clone --depth 1 https://gitlab.com/bzip2/bzip2.git bzip2-src
|
||||
fi
|
||||
git -C bzip2-src fetch --depth 1 origin "$VERSION"
|
||||
git -C bzip2-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build static library with -fPIC
|
||||
cd bzip2-src
|
||||
make -j"$NJOBS" libbz2.a CC="${CC:-cc}" CFLAGS="-Wall -Winline -O2 -fPIC -D_FILE_OFFSET_BITS=64"
|
||||
cd "$DIR"
|
||||
|
||||
# Copy to package install dir
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||
|
||||
# Library
|
||||
cp bzip2-src/libbz2.a "$INSTALL_DIR/lib/"
|
||||
|
||||
# Headers
|
||||
cp bzip2-src/bzlib.h "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed bzip2 to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
10
bzip2/bzip2/__init__.py
Normal file
10
bzip2/bzip2/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
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")
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(LIB_DIR, "libbz2.a")), "libbz2.a not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "bzlib.h")), "bzlib.h not found"
|
||||
15
bzip2/pyproject.toml
Normal file
15
bzip2/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "bzip2"
|
||||
version = "1.0.8"
|
||||
description = "bzip2 compression library (static build)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["bzip2*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
bzip2 = ["install/**/*"]
|
||||
58
bzip2/setup.py
Normal file
58
bzip2/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 BuildBzip2(build_py):
|
||||
"""Run build.sh to compile bzip2 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": BuildBzip2}
|
||||
|
||||
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()
|
||||
@@ -7,18 +7,15 @@ cd "$DIR"
|
||||
VERSION="1.0.1"
|
||||
INSTALL_DIR="$DIR/capnproto/install"
|
||||
|
||||
# Idempotent: skip if already built
|
||||
if [ -x "$INSTALL_DIR/bin/capnp" ]; then
|
||||
echo "capnproto already present, skipping build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
# Clone
|
||||
if [ ! -d "capnproto-src" ]; then
|
||||
git clone --depth 1 --branch "v${VERSION}" https://github.com/capnproto/capnproto.git capnproto-src
|
||||
# Clone/update source
|
||||
if [ ! -d "capnproto-src/.git" ]; then
|
||||
rm -rf capnproto-src
|
||||
git clone --depth 1 https://github.com/capnproto/capnproto.git capnproto-src
|
||||
fi
|
||||
git -C capnproto-src fetch --depth 1 origin "v${VERSION}"
|
||||
git -C capnproto-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
PREFIX="$DIR/build/prefix"
|
||||
@@ -30,6 +27,8 @@ cmake -S capnproto-src -B "$DIR/build" \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_C_FLAGS="-fPIC" \
|
||||
-DCMAKE_CXX_FLAGS="-fPIC" \
|
||||
-DWITH_OPENSSL=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
@@ -62,8 +61,5 @@ for obj in filesystem.c++.o main.c++.o test-helpers.c++.o; do
|
||||
ar d "$INSTALL_DIR/lib/libkj.a" "$obj" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Clean up
|
||||
rm -rf capnproto-src "$DIR/build"
|
||||
|
||||
echo "Installed capnproto to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -29,3 +29,16 @@ def _run_capnpc():
|
||||
|
||||
def _run_capnpc_cpp():
|
||||
_run("capnpc-c++")
|
||||
|
||||
|
||||
def smoketest():
|
||||
import subprocess
|
||||
|
||||
capnp = os.path.join(BIN_DIR, "capnp")
|
||||
capnpc = os.path.join(BIN_DIR, "capnpc")
|
||||
capnpc_cpp = os.path.join(BIN_DIR, "capnpc-c++")
|
||||
env = os.environ.copy()
|
||||
env["PATH"] = BIN_DIR + ":" + env.get("PATH", "")
|
||||
subprocess.run([capnp, "--version"], check=True, env=env)
|
||||
subprocess.run([capnpc, "--version"], check=True, env=env)
|
||||
subprocess.run([capnpc_cpp, "--version"], check=True, env=env)
|
||||
|
||||
@@ -15,9 +15,6 @@ class BuildCapnproto(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
marker = os.path.join(pkg_dir, "capnproto", "install", "bin", "capnp")
|
||||
|
||||
if not os.path.exists(marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
|
||||
22
catch2/build.sh
Executable file
22
catch2/build.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="v2.13.10"
|
||||
INSTALL_DIR="$DIR/catch2/install"
|
||||
|
||||
if [ ! -d "catch2-src/.git" ]; then
|
||||
rm -rf catch2-src
|
||||
git clone --depth 1 https://github.com/catchorg/Catch2.git catch2-src
|
||||
fi
|
||||
git -C catch2-src fetch --depth 1 origin "$VERSION"
|
||||
git -C catch2-src checkout --force FETCH_HEAD
|
||||
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR/include"
|
||||
cp -r catch2-src/single_include/catch2 "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed catch2 to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
9
catch2/catch2/__init__.py
Normal file
9
catch2/catch2/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import os
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||
LIB_DIR = DIR # header-only; no libraries
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "catch2", "catch.hpp")), "catch2/catch.hpp not found"
|
||||
16
catch2/pyproject.toml
Normal file
16
catch2/pyproject.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "catch2"
|
||||
version = "2.13.10"
|
||||
description = "Catch2 C++ test framework headers"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["catch2*"]
|
||||
exclude = ["catch2-src*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
catch2 = ["install/**/*"]
|
||||
28
catch2/setup.py
Normal file
28
catch2/setup.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from setuptools.command.build_py import build_py
|
||||
|
||||
|
||||
class BuildCatch2(build_py):
|
||||
"""Run build.sh to download Catch2 headers before collecting package data."""
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
super().run()
|
||||
|
||||
|
||||
cmdclass = {"build_py": BuildCatch2}
|
||||
|
||||
|
||||
def setup():
|
||||
from setuptools import setup as _setup
|
||||
|
||||
_setup(cmdclass=cmdclass)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
37
cppcheck/build.sh
Executable file
37
cppcheck/build.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="2.16.0"
|
||||
INSTALL_DIR="$DIR/cppcheck/install"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
CXX="ccache ${CXX:-c++}"
|
||||
|
||||
# Clone/update source
|
||||
if [ ! -d "cppcheck-src/.git" ]; then
|
||||
rm -rf cppcheck-src
|
||||
git clone --depth 1 https://github.com/danmar/cppcheck.git cppcheck-src
|
||||
fi
|
||||
git -C cppcheck-src fetch --depth 1 origin "$VERSION"
|
||||
git -C cppcheck-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
cd cppcheck-src
|
||||
make MATCHCOMPILER=yes CXXFLAGS="-O2" -j"$NJOBS"
|
||||
cd "$DIR"
|
||||
|
||||
# Install
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
cp cppcheck-src/cppcheck "$INSTALL_DIR/"
|
||||
cp -r cppcheck-src/addons "$INSTALL_DIR/"
|
||||
cp -r cppcheck-src/cfg "$INSTALL_DIR/"
|
||||
cp -r cppcheck-src/platforms "$INSTALL_DIR/"
|
||||
strip "$INSTALL_DIR/cppcheck" 2>/dev/null || true
|
||||
|
||||
echo "Installed cppcheck to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
16
cppcheck/cppcheck/__init__.py
Normal file
16
cppcheck/cppcheck/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
|
||||
|
||||
def _run():
|
||||
binary = os.path.join(DIR, "cppcheck")
|
||||
os.execvp(binary, ["cppcheck"] + sys.argv[1:])
|
||||
|
||||
|
||||
def smoketest():
|
||||
import subprocess
|
||||
binary = os.path.join(DIR, "cppcheck")
|
||||
result = subprocess.run([binary, "--version"], capture_output=True, text=True, check=True)
|
||||
print(result.stdout.strip())
|
||||
18
cppcheck/pyproject.toml
Normal file
18
cppcheck/pyproject.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "cppcheck"
|
||||
version = "2.16.0"
|
||||
description = "Cppcheck static analysis tool"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[project.scripts]
|
||||
cppcheck = "cppcheck:_run"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["cppcheck*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
cppcheck = ["install/**/*"]
|
||||
58
cppcheck/setup.py
Normal file
58
cppcheck/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 BuildCppcheck(build_py):
|
||||
"""Run build.sh to compile cppcheck 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": BuildCppcheck}
|
||||
|
||||
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()
|
||||
@@ -7,28 +7,19 @@ cd "$DIR"
|
||||
VERSION="3.4.0"
|
||||
INSTALL_DIR="$DIR/eigen/install"
|
||||
|
||||
# Idempotent: skip if already present
|
||||
if [ -d "$INSTALL_DIR/eigen3/Eigen" ]; then
|
||||
echo "eigen already present, skipping download."
|
||||
exit 0
|
||||
# Clone/update source
|
||||
if [ ! -d "eigen-src/.git" ]; then
|
||||
rm -rf eigen-src
|
||||
git clone --depth 1 https://gitlab.com/libeigen/eigen.git eigen-src
|
||||
fi
|
||||
git -C eigen-src fetch --depth 1 origin "$VERSION"
|
||||
git -C eigen-src checkout --force FETCH_HEAD
|
||||
|
||||
TARBALL="eigen-${VERSION}.tar.gz"
|
||||
URL="https://gitlab.com/libeigen/eigen/-/archive/${VERSION}/${TARBALL}"
|
||||
|
||||
echo "Downloading Eigen ${VERSION} ..."
|
||||
curl -fSL -o "$TARBALL" "$URL"
|
||||
|
||||
echo "Extracting headers ..."
|
||||
# Copy headers
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR/eigen3"
|
||||
|
||||
# Extract only the Eigen/ and unsupported/Eigen/ header directories
|
||||
tar --strip-components=1 -xzf "$TARBALL" -C "$INSTALL_DIR/eigen3" \
|
||||
"eigen-${VERSION}/Eigen" \
|
||||
"eigen-${VERSION}/unsupported"
|
||||
|
||||
rm -f "$TARBALL"
|
||||
cp -r eigen-src/Eigen "$INSTALL_DIR/eigen3/"
|
||||
cp -r eigen-src/unsupported "$INSTALL_DIR/eigen3/"
|
||||
|
||||
echo "Installed eigen to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -15,9 +15,6 @@ class BuildEigen(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
marker = os.path.join(pkg_dir, "eigen", "install", "eigen3", "Eigen")
|
||||
|
||||
if not os.path.isdir(marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
|
||||
151
ffmpeg/build.sh
Normal file → Executable file
151
ffmpeg/build.sh
Normal file → Executable file
@@ -4,26 +4,43 @@ 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"
|
||||
|
||||
# Idempotent: skip if already built
|
||||
if [ -x "$INSTALL_DIR/bin/ffmpeg" ]; then
|
||||
echo "ffmpeg already present, skipping build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
CC="ccache ${CC:-cc}"
|
||||
PREFIX="$DIR/build/prefix"
|
||||
mkdir -p "$DIR/build"
|
||||
|
||||
# --- Build x264 (static) ---
|
||||
if [ ! -d "x264-src" ]; then
|
||||
git clone --depth 1 --branch stable https://code.videolan.org/videolan/x264.git x264-src
|
||||
# --- 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 "$ZLIB_VERSION"
|
||||
|
||||
cd zlib-src
|
||||
./configure --prefix="$PREFIX" --static
|
||||
make -j"$NJOBS"
|
||||
make install
|
||||
cd "$DIR"
|
||||
|
||||
# --- Build x264 (static) ---
|
||||
if [ ! -d "x264-src/.git" ]; then
|
||||
rm -rf x264-src
|
||||
git clone --depth 1 https://code.videolan.org/videolan/x264.git x264-src
|
||||
fi
|
||||
git -C x264-src fetch --depth 1 origin "$X264_BRANCH"
|
||||
git -C x264-src checkout --force FETCH_HEAD
|
||||
|
||||
cd x264-src
|
||||
./configure \
|
||||
CFLAGS="-fno-finite-math-only" ./configure \
|
||||
--prefix="$PREFIX" \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
@@ -34,34 +51,127 @@ make -j"$NJOBS"
|
||||
make install
|
||||
cd "$DIR"
|
||||
|
||||
# --- Build FFmpeg ---
|
||||
if [ ! -d "ffmpeg-src" ]; then
|
||||
git clone --depth 1 --branch "n${FFMPEG_VERSION}" https://github.com/FFmpeg/FFmpeg.git ffmpeg-src
|
||||
# --- 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
|
||||
git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg-src
|
||||
fi
|
||||
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}" \
|
||||
--prefix="$PREFIX" \
|
||||
--enable-gpl \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--enable-zlib \
|
||||
--enable-libx264 \
|
||||
--enable-pic \
|
||||
--disable-doc \
|
||||
--disable-ffplay \
|
||||
--disable-autodetect \
|
||||
--disable-x86asm \
|
||||
--disable-everything \
|
||||
--enable-encoder=libx264,aac,ffvhuff,rawvideo,png \
|
||||
--enable-encoder=libx264,aac,ffvhuff,rawvideo,png,mjpeg \
|
||||
--enable-decoder=h264,hevc,ffvhuff,aac,rawvideo,png,mjpeg,mp3,pcm_s16le \
|
||||
--enable-muxer=mpegts,matroska,mp4,hevc,rawvideo,image2,null,mov \
|
||||
--enable-muxer=mpegts,matroska,mp4,hevc,rawvideo,image2,null,mov,framehash \
|
||||
--enable-demuxer=hevc,matroska,mpegts,mov,rawvideo,image2,aac,concat \
|
||||
--enable-parser=h264,hevc,aac,mpegaudio \
|
||||
--enable-protocol=file,pipe \
|
||||
--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"
|
||||
@@ -75,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; 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
|
||||
|
||||
@@ -87,8 +201,5 @@ done
|
||||
# Strip binaries
|
||||
strip "$INSTALL_DIR/bin/ffmpeg" "$INSTALL_DIR/bin/ffprobe" 2>/dev/null || true
|
||||
|
||||
# Clean up
|
||||
rm -rf x264-src ffmpeg-src "$DIR/build"
|
||||
|
||||
echo "Installed ffmpeg to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -18,3 +18,12 @@ def _run_ffmpeg():
|
||||
|
||||
def _run_ffprobe():
|
||||
_run("ffprobe")
|
||||
|
||||
|
||||
def smoketest():
|
||||
import subprocess
|
||||
|
||||
ffmpeg = os.path.join(BIN_DIR, "ffmpeg")
|
||||
ffprobe = os.path.join(BIN_DIR, "ffprobe")
|
||||
subprocess.run([ffmpeg, "-version"], check=True)
|
||||
subprocess.run([ffprobe, "-version"], check=True)
|
||||
|
||||
@@ -15,9 +15,6 @@ class BuildFFmpeg(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
marker = os.path.join(pkg_dir, "ffmpeg", "install", "bin", "ffmpeg")
|
||||
|
||||
if not os.path.exists(marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
|
||||
@@ -9,10 +9,11 @@ TOOLCHAIN_BASE="arm-gnu-toolchain-${TOOLCHAIN_VERSION}"
|
||||
GCC_VERSION="13.2.1"
|
||||
|
||||
INSTALL_DIR="$DIR/gcc_arm_none_eabi/toolchain"
|
||||
VERSION_FILE="$INSTALL_DIR/.version"
|
||||
|
||||
# Idempotent: skip if already built
|
||||
if [ -x "$INSTALL_DIR/bin/arm-none-eabi-gcc" ]; then
|
||||
echo "Toolchain already present, skipping download."
|
||||
# Skip if already at correct version
|
||||
if [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$TOOLCHAIN_VERSION" ]; then
|
||||
echo "Toolchain $TOOLCHAIN_VERSION already present, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -112,6 +113,7 @@ find "$INSTALL_DIR" -type f \( -executable -o -name '*.so' \) -exec strip {} + 2
|
||||
# --- clean up download artifacts ---
|
||||
rm -rf "$EXTRACT_DIR"
|
||||
rm -f "$TARBALL"
|
||||
echo "$TOOLCHAIN_VERSION" > "$VERSION_FILE"
|
||||
|
||||
echo "Installed to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from setuptools.command.build_py import build_py
|
||||
from setuptools.dist import Distribution
|
||||
|
||||
try:
|
||||
from wheel.bdist_wheel import bdist_wheel
|
||||
@@ -17,11 +15,6 @@ class BuildToolchain(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
toolchain_marker = os.path.join(
|
||||
pkg_dir, "gcc_arm_none_eabi", "toolchain", "bin", "arm-none-eabi-gcc"
|
||||
)
|
||||
|
||||
if not os.path.exists(toolchain_marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@ cd "$DIR"
|
||||
|
||||
VERSION="3.6.1"
|
||||
INSTALL_DIR="$DIR/git_lfs/bin"
|
||||
VERSION_FILE="$INSTALL_DIR/.version"
|
||||
|
||||
# Idempotent: skip if already present
|
||||
if [ -x "$INSTALL_DIR/git-lfs" ]; then
|
||||
echo "git-lfs already present, skipping download."
|
||||
# Skip if already at correct version
|
||||
if [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$VERSION" ]; then
|
||||
echo "git-lfs $VERSION already present, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -49,9 +50,9 @@ else
|
||||
fi
|
||||
|
||||
chmod +x "$INSTALL_DIR/git-lfs"
|
||||
strip "$INSTALL_DIR/git-lfs" 2>/dev/null || true
|
||||
|
||||
rm -f "$FILENAME"
|
||||
echo "$VERSION" > "$VERSION_FILE"
|
||||
|
||||
echo "Installed git-lfs to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -15,9 +15,6 @@ class BuildGitLfs(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
marker = os.path.join(pkg_dir, "git_lfs", "bin", "git-lfs")
|
||||
|
||||
if not os.path.exists(marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
|
||||
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()
|
||||
124
imgui/build.sh
Executable file
124
imgui/build.sh
Executable file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
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)
|
||||
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
||||
# ImPlot
|
||||
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
||||
|
||||
# GLFW 3.4
|
||||
GLFW_COMMIT="7b6aead9fb88b3623e3b3725ebb42670cbe4c579"
|
||||
|
||||
# Clone/update imgui
|
||||
if [ ! -d "imgui-src/.git" ]; then
|
||||
rm -rf imgui-src
|
||||
git clone --depth 1 https://github.com/ocornut/imgui.git imgui-src
|
||||
fi
|
||||
git -C imgui-src fetch --depth 1 origin "$IMGUI_COMMIT"
|
||||
git -C imgui-src checkout --force "$IMGUI_COMMIT"
|
||||
|
||||
# Clone/update implot
|
||||
if [ ! -d "implot-src/.git" ]; then
|
||||
rm -rf implot-src
|
||||
git clone --depth 1 https://github.com/epezent/implot.git implot-src
|
||||
fi
|
||||
git -C implot-src fetch --depth 1 origin "$IMPLOT_COMMIT"
|
||||
git -C implot-src checkout --force "$IMPLOT_COMMIT"
|
||||
|
||||
# Clone/update GLFW
|
||||
if [ ! -d "glfw-src/.git" ]; then
|
||||
rm -rf glfw-src
|
||||
git clone --depth 1 https://github.com/glfw/glfw.git glfw-src
|
||||
fi
|
||||
git -C glfw-src fetch --depth 1 origin "$GLFW_COMMIT"
|
||||
git -C glfw-src checkout --force "$GLFW_COMMIT"
|
||||
|
||||
# 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"
|
||||
mkdir -p "$INSTALL_DIR/include" "$INSTALL_DIR/lib"
|
||||
|
||||
# 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/backends/imgui_impl_opengl3.h imgui-src/backends/imgui_impl_opengl3_loader.h \
|
||||
imgui-src/backends/imgui_impl_glfw.h \
|
||||
"$INSTALL_DIR/include/"
|
||||
|
||||
# implot headers
|
||||
cp implot-src/implot.h implot-src/implot_internal.h "$INSTALL_DIR/include/"
|
||||
|
||||
# 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"
|
||||
16
imgui/imgui/__init__.py
Normal file
16
imgui/imgui/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
import platform as _platform
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||
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(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"
|
||||
15
imgui/pyproject.toml
Normal file
15
imgui/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "imgui"
|
||||
version = "1.92.7"
|
||||
description = "Dear ImGui + ImPlot + GLFW 3.4 (static)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["imgui"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
imgui = ["install/**/*"]
|
||||
58
imgui/setup.py
Normal file
58
imgui/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 BuildImgui(build_py):
|
||||
"""Run build.sh to download imgui sources 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": BuildImgui}
|
||||
|
||||
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()
|
||||
31
json11/build.sh
Executable file
31
json11/build.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="db00e9369a92aa74bf630a2ffb092a4b0b132c01"
|
||||
INSTALL_DIR="$DIR/json11/install"
|
||||
CXX="ccache ${CXX:-c++}"
|
||||
|
||||
if [ ! -d "$DIR/json11-src/.git" ]; then
|
||||
git clone --depth 1 https://github.com/dropbox/json11.git json11-src
|
||||
fi
|
||||
|
||||
git -C json11-src fetch --depth 1 origin "$VERSION"
|
||||
git -C json11-src checkout --force "$VERSION"
|
||||
|
||||
BUILD_DIR="$DIR/build"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR/lib" "$INSTALL_DIR/include/json11"
|
||||
|
||||
CXX="${CXX:-c++}"
|
||||
AR="${AR:-ar}"
|
||||
|
||||
$CXX -std=c++11 -fPIC -O2 -c "$DIR/json11-src/json11.cpp" -o "$BUILD_DIR/json11.o"
|
||||
"$AR" rcs "$INSTALL_DIR/lib/libjson11.a" "$BUILD_DIR/json11.o"
|
||||
cp "$DIR/json11-src/json11.hpp" "$INSTALL_DIR/include/json11/json11.hpp"
|
||||
|
||||
echo "Installed json11 to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
10
json11/json11/__init__.py
Normal file
10
json11/json11/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
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")
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(LIB_DIR, "libjson11.a")), "libjson11.a not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "json11", "json11.hpp")), "json11/json11.hpp not found"
|
||||
15
json11/pyproject.toml
Normal file
15
json11/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "json11"
|
||||
version = "20170411.0"
|
||||
description = "json11 JSON parser library (static build)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["json11*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
json11 = ["install/**/*"]
|
||||
58
json11/setup.py
Normal file
58
json11/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 BuildJson11(build_py):
|
||||
"""Run build.sh to compile json11 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": BuildJson11}
|
||||
|
||||
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()
|
||||
51
libjpeg/build.sh
Executable file
51
libjpeg/build.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="3.1.0"
|
||||
INSTALL_DIR="$DIR/libjpeg/install"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
# Clone/update source
|
||||
if [ ! -d "libjpeg-turbo-src/.git" ]; then
|
||||
rm -rf libjpeg-turbo-src
|
||||
git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo-src
|
||||
fi
|
||||
git -C libjpeg-turbo-src fetch --depth 1 origin "${VERSION}"
|
||||
git -C libjpeg-turbo-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
PREFIX="$DIR/build/prefix"
|
||||
mkdir -p "$DIR/build"
|
||||
|
||||
cmake -S libjpeg-turbo-src -B "$DIR/build" \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_C_FLAGS="-fPIC" \
|
||||
-DENABLE_SHARED=OFF \
|
||||
-DENABLE_STATIC=ON \
|
||||
-DWITH_TURBOJPEG=OFF
|
||||
|
||||
cmake --build "$DIR/build" -j"$NJOBS"
|
||||
cmake --install "$DIR/build"
|
||||
|
||||
# Copy to package install dir
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||
|
||||
# Library
|
||||
cp "$PREFIX/lib/libjpeg.a" "$INSTALL_DIR/lib/"
|
||||
|
||||
# Headers
|
||||
cp "$PREFIX/include/jpeglib.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/jconfig.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/jerror.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/jmorecfg.h" "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed libjpeg to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
10
libjpeg/libjpeg/__init__.py
Normal file
10
libjpeg/libjpeg/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
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")
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(LIB_DIR, "libjpeg.a")), "libjpeg.a not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "jpeglib.h")), "jpeglib.h not found"
|
||||
15
libjpeg/pyproject.toml
Normal file
15
libjpeg/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "libjpeg"
|
||||
version = "3.1.0"
|
||||
description = "libjpeg-turbo JPEG library (static build)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["libjpeg*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
libjpeg = ["install/**/*"]
|
||||
58
libjpeg/setup.py
Normal file
58
libjpeg/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 BuildLibjpeg(build_py):
|
||||
"""Run build.sh to compile libjpeg-turbo 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": BuildLibjpeg}
|
||||
|
||||
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()
|
||||
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()
|
||||
44
libyuv/build.sh
Executable file
44
libyuv/build.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="6067afde563c3946eebd94f146b3824ab7a97a9c"
|
||||
INSTALL_DIR="$DIR/libyuv/install"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
if [ ! -d "libyuv-src/.git" ]; then
|
||||
git clone --depth 1 https://chromium.googlesource.com/libyuv/libyuv libyuv-src
|
||||
fi
|
||||
|
||||
git -C libyuv-src fetch --depth 1 origin "$VERSION"
|
||||
git -C libyuv-src checkout --force "$VERSION"
|
||||
|
||||
BUILD_DIR="$DIR/build"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
cmake -S "$DIR/libyuv-src" -B "$BUILD_DIR" \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_C_FLAGS="-fPIC" \
|
||||
-DCMAKE_CXX_FLAGS="-fPIC"
|
||||
|
||||
cmake --build "$BUILD_DIR" -j"$NJOBS"
|
||||
|
||||
LIBYUV_STATIC="$(find "$BUILD_DIR" -name "libyuv.a" -type f | head -n 1)"
|
||||
if [ -z "$LIBYUV_STATIC" ]; then
|
||||
echo "libyuv.a not found in build output" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||
cp "$LIBYUV_STATIC" "$INSTALL_DIR/lib/libyuv.a"
|
||||
cp -r "$DIR/libyuv-src/include/." "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed libyuv to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
11
libyuv/libyuv/__init__.py
Normal file
11
libyuv/libyuv/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
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")
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(LIB_DIR, "libyuv.a")), "libyuv.a not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "libyuv.h")), "libyuv.h not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "libyuv", "version.h")), "libyuv/version.h not found"
|
||||
15
libyuv/pyproject.toml
Normal file
15
libyuv/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "libyuv"
|
||||
version = "1922.0"
|
||||
description = "libyuv image processing library (static build)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["libyuv*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
libyuv = ["install/**/*"]
|
||||
58
libyuv/setup.py
Normal file
58
libyuv/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 BuildLibyuv(build_py):
|
||||
"""Run build.sh to compile libyuv 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": BuildLibyuv}
|
||||
|
||||
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()
|
||||
25
nanosvg/build.sh
Executable file
25
nanosvg/build.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
COMMIT="5cefd9847949af6df13f65027fd43af5a7513633"
|
||||
INSTALL_DIR="$DIR/nanosvg/install"
|
||||
|
||||
# Clone/update source
|
||||
if [ ! -d "nanosvg-src/.git" ]; then
|
||||
rm -rf nanosvg-src
|
||||
git clone --depth 1 https://github.com/memononen/nanosvg.git nanosvg-src
|
||||
fi
|
||||
git -C nanosvg-src fetch --depth 1 origin "$COMMIT"
|
||||
git -C nanosvg-src checkout --force FETCH_HEAD
|
||||
|
||||
# Copy headers
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR/include"
|
||||
cp nanosvg-src/src/nanosvg.h "$INSTALL_DIR/include/"
|
||||
cp nanosvg-src/src/nanosvgrast.h "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed nanosvg to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
10
nanosvg/nanosvg/__init__.py
Normal file
10
nanosvg/nanosvg/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||
LIB_DIR = DIR # header-only; no libraries
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "nanosvg.h")), "nanosvg.h not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "nanosvgrast.h")), "nanosvgrast.h not found"
|
||||
15
nanosvg/pyproject.toml
Normal file
15
nanosvg/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "nanosvg"
|
||||
version = "0.0.1"
|
||||
description = "NanoSVG: simple SVG parser and rasterizer"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["nanosvg*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
nanosvg = ["install/**/*"]
|
||||
58
nanosvg/setup.py
Normal file
58
nanosvg/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 BuildNanosvg(build_py):
|
||||
"""Run build.sh to download nanosvg headers before collecting package data."""
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
super().run()
|
||||
|
||||
|
||||
cmdclass = {"build_py": BuildNanosvg}
|
||||
|
||||
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()
|
||||
64
ncurses/build.sh
Executable file
64
ncurses/build.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="6.5"
|
||||
INSTALL_DIR="$DIR/ncurses/install"
|
||||
VERSION_FILE="$DIR/ncurses-src/.version"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
export CC="ccache ${CC:-cc}"
|
||||
|
||||
# Download tarball (v6.5 tag doesn't exist on the GitHub mirror)
|
||||
if [ ! -f "$VERSION_FILE" ] || [ "$(cat "$VERSION_FILE")" != "$VERSION" ]; then
|
||||
rm -rf ncurses-src
|
||||
mkdir -p ncurses-src
|
||||
curl -fSL "https://ftp.gnu.org/gnu/ncurses/ncurses-${VERSION}.tar.gz" \
|
||||
| tar xz --strip-components=1 -C ncurses-src
|
||||
echo "$VERSION" > "$VERSION_FILE"
|
||||
fi
|
||||
|
||||
# Build
|
||||
PREFIX="$DIR/build/prefix"
|
||||
mkdir -p "$DIR/build"
|
||||
|
||||
cd ncurses-src
|
||||
CFLAGS="-fPIC" ./configure \
|
||||
--prefix="$PREFIX" \
|
||||
--without-shared \
|
||||
--with-normal \
|
||||
--without-debug \
|
||||
--without-cxx \
|
||||
--without-cxx-binding \
|
||||
--without-ada \
|
||||
--without-manpages \
|
||||
--without-progs \
|
||||
--without-tests \
|
||||
--without-dlsym \
|
||||
--enable-overwrite
|
||||
|
||||
make -j"$NJOBS"
|
||||
# Only install libs and headers; skip terminfo database (fails on macOS CI)
|
||||
make install.libs install.includes
|
||||
cd "$DIR"
|
||||
|
||||
# Copy to package install dir
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||
|
||||
# Libraries (ncurses 6.x builds wide-char by default; provide as libncurses.a)
|
||||
cp "$PREFIX/lib/libncursesw.a" "$INSTALL_DIR/lib/libncurses.a" 2>/dev/null \
|
||||
|| cp "$PREFIX/lib/libncurses.a" "$INSTALL_DIR/lib/"
|
||||
|
||||
# Headers (--enable-overwrite puts them directly in include/)
|
||||
cp "$PREFIX/include/ncurses.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/curses.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/ncurses_dll.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/unctrl.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/term.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/termcap.h" "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed ncurses to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
10
ncurses/ncurses/__init__.py
Normal file
10
ncurses/ncurses/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
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")
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(LIB_DIR, "libncurses.a")), "libncurses.a not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "ncurses.h")), "ncurses.h not found"
|
||||
15
ncurses/pyproject.toml
Normal file
15
ncurses/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "ncurses"
|
||||
version = "6.5"
|
||||
description = "ncurses terminal library (static build)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["ncurses*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
ncurses = ["install/**/*"]
|
||||
58
ncurses/setup.py
Normal file
58
ncurses/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 BuildNcurses(build_py):
|
||||
"""Run build.sh to compile ncurses 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": BuildNcurses}
|
||||
|
||||
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()
|
||||
25
pyproject.toml
Normal file
25
pyproject.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
[tool.uv.workspace]
|
||||
members = [
|
||||
"acados",
|
||||
"bzip2",
|
||||
"capnproto",
|
||||
"catch2",
|
||||
"cppcheck",
|
||||
"eigen",
|
||||
"ffmpeg",
|
||||
"gcc-arm-none-eabi",
|
||||
"git",
|
||||
"git-lfs",
|
||||
"imgui",
|
||||
"json11",
|
||||
"libusb",
|
||||
"libjpeg",
|
||||
"libyuv",
|
||||
"nanosvg",
|
||||
"ncurses",
|
||||
"qt5",
|
||||
"raylib",
|
||||
"xvfb",
|
||||
"zeromq",
|
||||
"zstd",
|
||||
]
|
||||
4
raylib/.gitignore
vendored
Normal file
4
raylib/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
raylib-src/
|
||||
raylib/install/
|
||||
raylib/*.modified
|
||||
raylib/_raylib_cffi*
|
||||
121
raylib/build.sh
Executable file
121
raylib/build.sh
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
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"
|
||||
fi
|
||||
export RAYLIB_PLATFORM
|
||||
|
||||
# Install build dependencies
|
||||
if [[ "$(uname)" == "Linux" ]]; then
|
||||
if [ "$RAYLIB_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
|
||||
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
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
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
|
||||
else
|
||||
# desktop: needs X11/GL dev packages
|
||||
if command -v dnf &>/dev/null; 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
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
|
||||
else
|
||||
sudo apt-get update && sudo apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clone and build raylib C library
|
||||
RAYLIB_COMMIT="d9d7cc1353ec0f73c97e84ddf0973983d1ee25e2"
|
||||
|
||||
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
|
||||
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
|
||||
else
|
||||
sudo apt-get update && sudo apt-get install -y libegl-dev libgl-dev
|
||||
fi
|
||||
fi
|
||||
|
||||
cd raylib-src/src
|
||||
make clean
|
||||
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
|
||||
MESA_DIR="$INSTALL_DIR/lib/mesa"
|
||||
mkdir -p "$MESA_DIR"
|
||||
ldconfig 2>/dev/null || true
|
||||
for lib in libEGL.so.1 libOpenGL.so.0 libGLdispatch.so.0; do
|
||||
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"
|
||||
|
||||
echo "Installed raylib to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
16
raylib/pyproject.toml
Normal file
16
raylib/pyproject.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel", "cffi>=1.17.1"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "raylib"
|
||||
version = "5.5.0.8"
|
||||
description = "raylib + pyray Python bindings (commaai fork)"
|
||||
requires-python = ">=3.8"
|
||||
dependencies = ["cffi>=1.17.1"]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["raylib*", "pyray*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
raylib = ["install/**/*", "_raylib_cffi*.so"]
|
||||
159
raylib/pyray/__init__.py
Normal file
159
raylib/pyray/__init__.py
Normal file
@@ -0,0 +1,159 @@
|
||||
# Copyright (c) 2021 Richard Smith and others
|
||||
#
|
||||
# This program and the accompanying materials are made available under the
|
||||
# terms of the Eclipse Public License 2.0 which is available at
|
||||
# http://www.eclipse.org/legal/epl-2.0.
|
||||
#
|
||||
# This Source Code may also be made available under the following Secondary
|
||||
# licenses when the conditions for such availability set forth in the Eclipse
|
||||
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
|
||||
# with the GNU Classpath Exception which is
|
||||
# available at https://www.gnu.org/software/classpath/license.html.
|
||||
#
|
||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
import re
|
||||
import weakref
|
||||
from array import array
|
||||
|
||||
from raylib import rl, ffi
|
||||
from raylib.colors import *
|
||||
|
||||
try:
|
||||
from raylib.defines import *
|
||||
except AttributeError:
|
||||
print("sorry deprecated enums dont work on dynamic version")
|
||||
|
||||
from inspect import getmembers, isbuiltin
|
||||
|
||||
current_module = __import__(__name__)
|
||||
|
||||
|
||||
def _underscore(word: str) -> str:
|
||||
word = re.sub('2D$', '_2d', word)
|
||||
word = re.sub('3D$', '_3d', word)
|
||||
word = re.sub(r"([A-Z]+)([A-Z][a-z])", r'\1_\2', word)
|
||||
word = re.sub(r"([a-z\d])([A-Z])", r'\1_\2', word)
|
||||
word = word.replace("-", "_")
|
||||
return word.lower()
|
||||
|
||||
|
||||
def _wrap_function(original_func):
|
||||
c_args = [str(x) for x in ffi.typeof(original_func).args]
|
||||
number_of_args = len(c_args)
|
||||
c_arg_is_pointer = [x.kind == 'pointer' for x in ffi.typeof(original_func).args]
|
||||
c_arg_is_string = [str(x) == "<ctype 'char *'>" for x in ffi.typeof(original_func).args]
|
||||
# c_arg_is_void_pointer = [str(x) == "<ctype 'void *'>" for x in ffi.typeof(original_func).args]
|
||||
|
||||
def wrapped_func(*args):
|
||||
args = list(args) # tuple is immutable, converting it to mutable list is faster than constructing new list!
|
||||
for i in range(number_of_args):
|
||||
try:
|
||||
arg = args[i]
|
||||
except IndexError:
|
||||
raise RuntimeError(f"function requires {number_of_args} arguments but you supplied {len(args)}")
|
||||
if c_arg_is_pointer[i]:
|
||||
if c_arg_is_string[i]: # we assume c_arg is 'const char *'
|
||||
try: # if it's a non-const 'char *' then user should be supplying a ctype pointer, not a Python
|
||||
# string
|
||||
args[i] = arg.encode('utf-8') # in that case this conversion will fail
|
||||
except AttributeError: # but those functions are uncommon, so quicker on average to try the
|
||||
# conversion
|
||||
pass # and ignore the exception
|
||||
# if user supplied a Python string but c_arg is a 'char *' not a 'const char *' then we ought to raise
|
||||
# exception because its an out
|
||||
# parameter and user should supply a ctype pointer, but we cant because cffi cant detect 'const'
|
||||
# so we would have to get the info from raylib.json
|
||||
elif c_args[i] == "<ctype 'char * *'>" and type(arg) is list:
|
||||
args[i] = [ffi.new("char[]", x.encode('utf-8')) for x in arg]
|
||||
elif is_cdata(arg) and "*" not in str(arg):
|
||||
args[i] = ffi.addressof(arg)
|
||||
elif arg is None:
|
||||
args[i] = ffi.NULL
|
||||
elif not is_cdata(arg):
|
||||
if c_args[i] == "<ctype '_Bool *'>":
|
||||
raise TypeError(
|
||||
f"Argument {i} ({arg}) must be a ctype bool, please create one with: pyray.ffi.new('bool "
|
||||
f"*', True)")
|
||||
elif c_args[i] == "<ctype 'int *'>":
|
||||
raise TypeError(
|
||||
f"Argument {i} ({arg}) must be a ctype int, please create one with: pyray.ffi.new('int "
|
||||
f"*', 1)")
|
||||
elif c_args[i] == "<ctype 'float *'>":
|
||||
raise TypeError(
|
||||
f"Argument {i} ({arg}) must be a ctype float, please create one with: pyray.ffi.new("
|
||||
f"'float *', 1.0)")
|
||||
elif c_args[i] == "<ctype 'void *'>":
|
||||
# we could assume it's a string and try to convert it but we would have to be sure it's
|
||||
# const. that seems reasonable assumption for char* but i'm not confident it is for void*
|
||||
raise TypeError(
|
||||
f"Argument {i} ({arg}) must be a cdata pointer. Type is void so I don't know what type it "
|
||||
f"should be."
|
||||
"If it's a const string you can create it with pyray.ffi.new('char []', b\"whatever\") . "
|
||||
"If it's a float you can create it with pyray.ffi.new('float *', 1.0)")
|
||||
|
||||
result = original_func(*args)
|
||||
if result is None:
|
||||
return
|
||||
elif is_cdata(result) and str(result).startswith("<cdata 'char *'"):
|
||||
if str(result) == "<cdata 'char *' NULL>":
|
||||
return ""
|
||||
else:
|
||||
return ffi.string(result).decode('utf-8')
|
||||
else:
|
||||
return result
|
||||
|
||||
# apparently pypy and cpython produce different types so check for both
|
||||
def is_cdata(arg):
|
||||
return str(type(arg)) == "<class '_cffi_backend.__CDataOwn'>" or str(
|
||||
type(arg)) == "<class '_cffi_backend._CDataBase'>"
|
||||
|
||||
return wrapped_func
|
||||
|
||||
|
||||
global_weakkeydict = weakref.WeakKeyDictionary()
|
||||
|
||||
|
||||
def _make_struct_constructor_function(struct):
|
||||
def func(*args):
|
||||
# print(struct, args)
|
||||
modified_args = []
|
||||
for (field, arg) in zip(ffi.typeof(struct).fields, args):
|
||||
# print("arg:", str(arg), "field:", field[1], "field type:", field[1].type, "type(arg):", str(type(arg)))
|
||||
if arg is None:
|
||||
arg = ffi.NULL
|
||||
elif (field[1].type.kind == 'pointer'
|
||||
and (str(type(arg)) == "<class 'numpy.ndarray'>"
|
||||
or isinstance(arg, (array, bytes, bytearray, memoryview)))):
|
||||
arg = ffi.from_buffer(field[1].type, arg)
|
||||
modified_args.append(arg)
|
||||
s = ffi.new(f"struct {struct} *", modified_args)[0]
|
||||
global_weakkeydict[s] = modified_args
|
||||
return s
|
||||
|
||||
return func
|
||||
|
||||
|
||||
for name, attr in getmembers(rl):
|
||||
# print(name, attr)
|
||||
uname = _underscore(name)
|
||||
if isbuiltin(attr) or str(type(attr)) == "<class '_cffi_backend.__FFIFunctionWrapper'>" or str(
|
||||
type(attr)) == "<class '_cffi_backend._CDataBase'>":
|
||||
# print(attr.__call__)
|
||||
# print(attr.__doc__)
|
||||
# print(dir(attr))
|
||||
# print(dir(attr.__repr__))
|
||||
f = _wrap_function(attr)
|
||||
setattr(current_module, uname, f)
|
||||
else:
|
||||
setattr(current_module, name, attr)
|
||||
|
||||
for struct in ffi.list_types()[0]:
|
||||
f = _make_struct_constructor_function(struct)
|
||||
setattr(current_module, struct, f)
|
||||
|
||||
# overwrite ffi enums with our own
|
||||
from raylib.enums import *
|
||||
|
||||
|
||||
def text_format(*args):
|
||||
raise RuntimeError("Use Python f-strings etc rather than calling text_format().")
|
||||
71
raylib/raylib/__init__.py
Normal file
71
raylib/raylib/__init__.py
Normal file
@@ -0,0 +1,71 @@
|
||||
import os
|
||||
import platform as _platform
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
LIB_DIR = os.path.join(DIR, "lib")
|
||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||
|
||||
|
||||
def _detect_platform():
|
||||
"""Auto-detect the raylib platform. In CI on Linux x86_64, use offscreen EGL rendering."""
|
||||
explicit = os.environ.get("RAYLIB_PLATFORM", "")
|
||||
if explicit:
|
||||
return explicit
|
||||
if os.environ.get("CI") and _platform.system() == "Linux" and _platform.machine() == "x86_64":
|
||||
return "PLATFORM_OFFSCREEN"
|
||||
return ""
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
# 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")
|
||||
|
||||
cffi_files = glob.glob(os.path.join(pkg_dir, "_raylib_cffi*"))
|
||||
|
||||
# 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 = []
|
||||
|
||||
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()
|
||||
|
||||
# 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
|
||||
from raylib.colors import * # noqa: F403
|
||||
from raylib.defines import * # noqa: F403
|
||||
from .version import __version__
|
||||
except (ImportError, OSError):
|
||||
pass
|
||||
137
raylib/raylib/build.py
Normal file
137
raylib/raylib/build.py
Normal file
@@ -0,0 +1,137 @@
|
||||
# Based on commaai/raylib-python-cffi (commit ab0191f)
|
||||
# Modified to use local install paths and compile standalone (no cffi_modules)
|
||||
|
||||
import re
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
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_PLATFORM = os.getenv("RAYLIB_PLATFORM", "")
|
||||
|
||||
ffibuilder = FFI()
|
||||
|
||||
|
||||
def check_raylib_installed():
|
||||
return os.path.isfile(os.path.join(RAYLIB_LIB_PATH, 'libraylib.a'))
|
||||
|
||||
|
||||
def pre_process_header(filename, remove_function_bodies=False):
|
||||
print("Pre-processing " + filename)
|
||||
file = open(filename, "r")
|
||||
filetext = "".join([line for line in file if '#include' not in line])
|
||||
command = ['gcc', '-CC', '-P', '-undef', '-nostdinc', '-DRL_MATRIX_TYPE',
|
||||
'-DRL_QUATERNION_TYPE', '-DRL_VECTOR4_TYPE', '-DRL_VECTOR3_TYPE', '-DRL_VECTOR2_TYPE',
|
||||
'-DRLAPI=', '-DPHYSACDEF=', '-DRAYGUIDEF=', '-DRMAPI=',
|
||||
'-dDI', '-E', '-']
|
||||
filetext = subprocess.run(command, text=True, input=filetext, stdout=subprocess.PIPE).stdout
|
||||
filetext = filetext.replace("va_list", "void *")
|
||||
if remove_function_bodies:
|
||||
filetext = re.sub('\n{\n(.|\n)*?\n}\n', ';', filetext)
|
||||
filetext = "\n".join([line for line in filetext.splitlines() if not line.startswith("#")])
|
||||
modified_path = os.path.join(HERE, os.path.basename(filename) + ".modified")
|
||||
with open(modified_path, "w") as f:
|
||||
f.write(filetext)
|
||||
return filetext
|
||||
|
||||
|
||||
def check_header_exists(file):
|
||||
if not os.path.isfile(file):
|
||||
print(f"\nWARNING: {file} not found. Build will not contain these extra functions.\n")
|
||||
time.sleep(1)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def build_ffi():
|
||||
"""Set up the FFI builder. Must be called after libraylib.a and headers exist."""
|
||||
if not check_raylib_installed():
|
||||
raise Exception("ERROR: raylib not found. Please run build.sh first.")
|
||||
|
||||
raylib_h = os.path.join(RAYLIB_INCLUDE_PATH, "raylib.h")
|
||||
rlgl_h = os.path.join(RAYLIB_INCLUDE_PATH, "rlgl.h")
|
||||
raymath_h = os.path.join(RAYLIB_INCLUDE_PATH, "raymath.h")
|
||||
|
||||
for h in (raylib_h, rlgl_h, raymath_h):
|
||||
if not os.path.isfile(h):
|
||||
raise Exception(f"ERROR: {h} not found. Please run build.sh first.")
|
||||
|
||||
ffi_includes = """
|
||||
#include "raylib.h"
|
||||
#include "rlgl.h"
|
||||
#include "raymath.h"
|
||||
"""
|
||||
|
||||
raygui_h = os.path.join(RAYLIB_INCLUDE_PATH, "raygui.h")
|
||||
if check_header_exists(raygui_h):
|
||||
ffi_includes += """
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#define RAYGUI_SUPPORT_RICONS
|
||||
#include "raygui.h"
|
||||
"""
|
||||
|
||||
ffibuilder.cdef(pre_process_header(raylib_h))
|
||||
ffibuilder.cdef(pre_process_header(rlgl_h))
|
||||
ffibuilder.cdef(pre_process_header(raymath_h, True))
|
||||
|
||||
if os.path.isfile(raygui_h):
|
||||
ffibuilder.cdef(pre_process_header(raygui_h))
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
print("BUILDING FOR MAC")
|
||||
extra_link_args = [
|
||||
os.path.join(RAYLIB_LIB_PATH, 'libraylib.a'),
|
||||
'-framework', 'OpenGL',
|
||||
'-framework', 'Cocoa',
|
||||
'-framework', 'IOKit',
|
||||
'-framework', 'CoreFoundation',
|
||||
'-framework', 'CoreVideo',
|
||||
]
|
||||
libraries = []
|
||||
extra_compile_args = ["-Wno-error=incompatible-function-pointer-types"]
|
||||
else:
|
||||
print("BUILDING FOR LINUX")
|
||||
extra_link_args = [
|
||||
f'-L{RAYLIB_LIB_PATH}', '-lraylib',
|
||||
'-lm', '-lpthread', '-lGL',
|
||||
'-lrt', '-ldl', '-lpthread', '-latomic',
|
||||
]
|
||||
if RAYLIB_PLATFORM == "PLATFORM_COMMA":
|
||||
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')
|
||||
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']
|
||||
else:
|
||||
extra_link_args += ['-lX11']
|
||||
extra_compile_args = ["-Wno-incompatible-pointer-types"]
|
||||
libraries = []
|
||||
|
||||
print("extra_link_args: " + str(extra_link_args))
|
||||
ffibuilder.set_source("raylib._raylib_cffi",
|
||||
ffi_includes,
|
||||
py_limited_api=True,
|
||||
include_dirs=[RAYLIB_INCLUDE_PATH],
|
||||
extra_link_args=extra_link_args,
|
||||
extra_compile_args=extra_compile_args,
|
||||
libraries=libraries)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
build_ffi()
|
||||
# compile with output going to the package root (parent of raylib/)
|
||||
pkg_root = os.path.dirname(HERE)
|
||||
ffibuilder.compile(verbose=True, tmpdir=pkg_root)
|
||||
41
raylib/raylib/colors.py
Normal file
41
raylib/raylib/colors.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2021 Richard Smith and others
|
||||
#
|
||||
# This program and the accompanying materials are made available under the
|
||||
# terms of the Eclipse Public License 2.0 which is available at
|
||||
# http://www.eclipse.org/legal/epl-2.0.
|
||||
#
|
||||
# This Source Code may also be made available under the following Secondary
|
||||
# licenses when the conditions for such availability set forth in the Eclipse
|
||||
# Public License, v. 2.0 are satisfied: GNU General Public License, version 2
|
||||
# with the GNU Classpath Exception which is
|
||||
# available at https://www.gnu.org/software/classpath/license.html.
|
||||
#
|
||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
|
||||
LIGHTGRAY =( 200, 200, 200, 255 )
|
||||
GRAY =( 130, 130, 130, 255 )
|
||||
DARKGRAY =( 80, 80, 80, 255 )
|
||||
YELLOW =( 253, 249, 0, 255 )
|
||||
GOLD =( 255, 203, 0, 255 )
|
||||
ORANGE =( 255, 161, 0, 255 )
|
||||
PINK =( 255, 109, 194, 255 )
|
||||
RED =( 230, 41, 55, 255 )
|
||||
MAROON =( 190, 33, 55, 255 )
|
||||
GREEN =( 0, 228, 48, 255 )
|
||||
LIME =( 0, 158, 47, 255 )
|
||||
DARKGREEN =( 0, 117, 44, 255 )
|
||||
SKYBLUE =( 102, 191, 255, 255 )
|
||||
BLUE =( 0, 121, 241, 255 )
|
||||
DARKBLUE =( 0, 82, 172, 255 )
|
||||
PURPLE =( 200, 122, 255, 255 )
|
||||
VIOLET =( 135, 60, 190, 255 )
|
||||
DARKPURPLE =( 112, 31, 126, 255 )
|
||||
BEIGE =( 211, 176, 131, 255 )
|
||||
BROWN =( 127, 106, 79, 255 )
|
||||
DARKBROWN =( 76, 63, 47, 255 )
|
||||
WHITE =( 255, 255, 255, 255 )
|
||||
BLACK =( 0, 0, 0, 255 )
|
||||
BLANK =( 0, 0, 0, 0 )
|
||||
MAGENTA =( 255, 0, 255, 255 )
|
||||
RAYWHITE =( 245, 245, 245, 255 )
|
||||
|
||||
510
raylib/raylib/defines.py
Normal file
510
raylib/raylib/defines.py
Normal file
@@ -0,0 +1,510 @@
|
||||
import raylib
|
||||
|
||||
RAYLIB_VERSION_MAJOR: int = 5
|
||||
RAYLIB_VERSION_MINOR: int = 5
|
||||
RAYLIB_VERSION_PATCH: int = 0
|
||||
RAYLIB_VERSION: str = "5.5"
|
||||
PI: float = 3.141592653589793
|
||||
DEG2RAD = PI / 180.0
|
||||
RAD2DEG = 180.0 / PI
|
||||
MOUSE_LEFT_BUTTON = raylib.MOUSE_BUTTON_LEFT
|
||||
MOUSE_RIGHT_BUTTON = raylib.MOUSE_BUTTON_RIGHT
|
||||
MOUSE_MIDDLE_BUTTON = raylib.MOUSE_BUTTON_MIDDLE
|
||||
MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
|
||||
MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
|
||||
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
|
||||
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS
|
||||
EPSILON: float = 1e-06
|
||||
RLGL_VERSION: str = "5.0"
|
||||
RL_DEFAULT_BATCH_BUFFER_ELEMENTS: int = 8192
|
||||
RL_DEFAULT_BATCH_BUFFERS: int = 1
|
||||
RL_DEFAULT_BATCH_DRAWCALLS: int = 256
|
||||
RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS: int = 4
|
||||
RL_MAX_MATRIX_STACK_SIZE: int = 32
|
||||
RL_MAX_SHADER_LOCATIONS: int = 32
|
||||
RL_TEXTURE_WRAP_S: int = 10242
|
||||
RL_TEXTURE_WRAP_T: int = 10243
|
||||
RL_TEXTURE_MAG_FILTER: int = 10240
|
||||
RL_TEXTURE_MIN_FILTER: int = 10241
|
||||
RL_TEXTURE_FILTER_NEAREST: int = 9728
|
||||
RL_TEXTURE_FILTER_LINEAR: int = 9729
|
||||
RL_TEXTURE_FILTER_MIP_NEAREST: int = 9984
|
||||
RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR: int = 9986
|
||||
RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST: int = 9985
|
||||
RL_TEXTURE_FILTER_MIP_LINEAR: int = 9987
|
||||
RL_TEXTURE_FILTER_ANISOTROPIC: int = 12288
|
||||
RL_TEXTURE_MIPMAP_BIAS_RATIO: int = 16384
|
||||
RL_TEXTURE_WRAP_REPEAT: int = 10497
|
||||
RL_TEXTURE_WRAP_CLAMP: int = 33071
|
||||
RL_TEXTURE_WRAP_MIRROR_REPEAT: int = 33648
|
||||
RL_TEXTURE_WRAP_MIRROR_CLAMP: int = 34626
|
||||
RL_MODELVIEW: int = 5888
|
||||
RL_PROJECTION: int = 5889
|
||||
RL_TEXTURE: int = 5890
|
||||
RL_LINES: int = 1
|
||||
RL_TRIANGLES: int = 4
|
||||
RL_QUADS: int = 7
|
||||
RL_UNSIGNED_BYTE: int = 5121
|
||||
RL_FLOAT: int = 5126
|
||||
RL_STREAM_DRAW: int = 35040
|
||||
RL_STREAM_READ: int = 35041
|
||||
RL_STREAM_COPY: int = 35042
|
||||
RL_STATIC_DRAW: int = 35044
|
||||
RL_STATIC_READ: int = 35045
|
||||
RL_STATIC_COPY: int = 35046
|
||||
RL_DYNAMIC_DRAW: int = 35048
|
||||
RL_DYNAMIC_READ: int = 35049
|
||||
RL_DYNAMIC_COPY: int = 35050
|
||||
RL_FRAGMENT_SHADER: int = 35632
|
||||
RL_VERTEX_SHADER: int = 35633
|
||||
RL_COMPUTE_SHADER: int = 37305
|
||||
RL_ZERO: int = 0
|
||||
RL_ONE: int = 1
|
||||
RL_SRC_COLOR: int = 768
|
||||
RL_ONE_MINUS_SRC_COLOR: int = 769
|
||||
RL_SRC_ALPHA: int = 770
|
||||
RL_ONE_MINUS_SRC_ALPHA: int = 771
|
||||
RL_DST_ALPHA: int = 772
|
||||
RL_ONE_MINUS_DST_ALPHA: int = 773
|
||||
RL_DST_COLOR: int = 774
|
||||
RL_ONE_MINUS_DST_COLOR: int = 775
|
||||
RL_SRC_ALPHA_SATURATE: int = 776
|
||||
RL_CONSTANT_COLOR: int = 32769
|
||||
RL_ONE_MINUS_CONSTANT_COLOR: int = 32770
|
||||
RL_CONSTANT_ALPHA: int = 32771
|
||||
RL_ONE_MINUS_CONSTANT_ALPHA: int = 32772
|
||||
RL_FUNC_ADD: int = 32774
|
||||
RL_MIN: int = 32775
|
||||
RL_MAX: int = 32776
|
||||
RL_FUNC_SUBTRACT: int = 32778
|
||||
RL_FUNC_REVERSE_SUBTRACT: int = 32779
|
||||
RL_BLEND_EQUATION: int = 32777
|
||||
RL_BLEND_EQUATION_RGB: int = 32777
|
||||
RL_BLEND_EQUATION_ALPHA: int = 34877
|
||||
RL_BLEND_DST_RGB: int = 32968
|
||||
RL_BLEND_SRC_RGB: int = 32969
|
||||
RL_BLEND_DST_ALPHA: int = 32970
|
||||
RL_BLEND_SRC_ALPHA: int = 32971
|
||||
RL_BLEND_COLOR: int = 32773
|
||||
RL_READ_FRAMEBUFFER: int = 36008
|
||||
RL_DRAW_FRAMEBUFFER: int = 36009
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION: int = 0
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD: int = 1
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL: int = 2
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR: int = 3
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT: int = 4
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2: int = 5
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES: int = 6
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS: int = 7
|
||||
RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS: int = 8
|
||||
RL_SHADER_LOC_MAP_DIFFUSE = raylib.RL_SHADER_LOC_MAP_ALBEDO
|
||||
RL_SHADER_LOC_MAP_SPECULAR = raylib.RL_SHADER_LOC_MAP_METALNESS
|
||||
GL_SHADING_LANGUAGE_VERSION: int = 35724
|
||||
GL_COMPRESSED_RGB_S3TC_DXT1_EXT: int = 33776
|
||||
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: int = 33777
|
||||
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: int = 33778
|
||||
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: int = 33779
|
||||
GL_ETC1_RGB8_OES: int = 36196
|
||||
GL_COMPRESSED_RGB8_ETC2: int = 37492
|
||||
GL_COMPRESSED_RGBA8_ETC2_EAC: int = 37496
|
||||
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: int = 35840
|
||||
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: int = 35842
|
||||
GL_COMPRESSED_RGBA_ASTC_4x4_KHR: int = 37808
|
||||
GL_COMPRESSED_RGBA_ASTC_8x8_KHR: int = 37815
|
||||
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: int = 34047
|
||||
GL_TEXTURE_MAX_ANISOTROPY_EXT: int = 34046
|
||||
GL_PROGRAM_POINT_SIZE: int = 34370
|
||||
GL_LINE_WIDTH: int = 2849
|
||||
GL_UNSIGNED_SHORT_5_6_5: int = 33635
|
||||
GL_UNSIGNED_SHORT_5_5_5_1: int = 32820
|
||||
GL_UNSIGNED_SHORT_4_4_4_4: int = 32819
|
||||
GL_LUMINANCE: int = 6409
|
||||
GL_LUMINANCE_ALPHA: int = 6410
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION: str = "vertexPosition"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD: str = "vertexTexCoord"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL: str = "vertexNormal"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR: str = "vertexColor"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT: str = "vertexTangent"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2: str = "vertexTexCoord2"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS: str = "vertexBoneIds"
|
||||
RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS: str = "vertexBoneWeights"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_MVP: str = "mvp"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW: str = "matView"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION: str = "matProjection"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL: str = "matModel"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL: str = "matNormal"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR: str = "colDiffuse"
|
||||
RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES: str = "boneMatrices"
|
||||
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0: str = "texture0"
|
||||
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1: str = "texture1"
|
||||
RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2: str = "texture2"
|
||||
RAYGUI_VERSION_MAJOR: int = 4
|
||||
RAYGUI_VERSION_MINOR: int = 5
|
||||
RAYGUI_VERSION_PATCH: int = 0
|
||||
RAYGUI_VERSION: str = "4.5-dev"
|
||||
SCROLLBAR_LEFT_SIDE: int = 0
|
||||
SCROLLBAR_RIGHT_SIDE: int = 1
|
||||
RAYGUI_ICON_SIZE: int = 16
|
||||
RAYGUI_ICON_MAX_ICONS: int = 256
|
||||
RAYGUI_ICON_MAX_NAME_LENGTH: int = 32
|
||||
RAYGUI_MAX_CONTROLS: int = 16
|
||||
RAYGUI_MAX_PROPS_BASE: int = 16
|
||||
RAYGUI_MAX_PROPS_EXTENDED: int = 8
|
||||
KEY_RIGHT: int = 262
|
||||
KEY_LEFT: int = 263
|
||||
KEY_DOWN: int = 264
|
||||
KEY_UP: int = 265
|
||||
KEY_BACKSPACE: int = 259
|
||||
KEY_ENTER: int = 257
|
||||
MOUSE_LEFT_BUTTON: int = 0
|
||||
RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT: int = 24
|
||||
RAYGUI_GROUPBOX_LINE_THICK: int = 1
|
||||
RAYGUI_LINE_MARGIN_TEXT: int = 12
|
||||
RAYGUI_LINE_TEXT_PADDING: int = 4
|
||||
RAYGUI_PANEL_BORDER_WIDTH: int = 1
|
||||
RAYGUI_TABBAR_ITEM_WIDTH: int = 160
|
||||
RAYGUI_MIN_SCROLLBAR_WIDTH: int = 40
|
||||
RAYGUI_MIN_SCROLLBAR_HEIGHT: int = 40
|
||||
RAYGUI_MIN_MOUSE_WHEEL_SPEED: int = 20
|
||||
RAYGUI_TOGGLEGROUP_MAX_ITEMS: int = 32
|
||||
RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: int = 40
|
||||
RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: int = 1
|
||||
RAYGUI_VALUEBOX_MAX_CHARS: int = 32
|
||||
RAYGUI_COLORBARALPHA_CHECKED_SIZE: int = 10
|
||||
RAYGUI_MESSAGEBOX_BUTTON_HEIGHT: int = 24
|
||||
RAYGUI_MESSAGEBOX_BUTTON_PADDING: int = 12
|
||||
RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT: int = 24
|
||||
RAYGUI_TEXTINPUTBOX_BUTTON_PADDING: int = 12
|
||||
RAYGUI_TEXTINPUTBOX_HEIGHT: int = 26
|
||||
RAYGUI_GRID_ALPHA: float = 0.15
|
||||
MAX_LINE_BUFFER_SIZE: int = 256
|
||||
ICON_TEXT_PADDING: int = 4
|
||||
RAYGUI_MAX_TEXT_LINES: int = 128
|
||||
RAYGUI_TEXTSPLIT_MAX_ITEMS: int = 128
|
||||
RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE: int = 1024
|
||||
RAYGUI_TEXTFORMAT_MAX_SIZE: int = 256
|
||||
PHYSAC_MAX_BODIES: int = 64
|
||||
PHYSAC_MAX_MANIFOLDS: int = 4096
|
||||
PHYSAC_MAX_VERTICES: int = 24
|
||||
PHYSAC_DEFAULT_CIRCLE_VERTICES: int = 24
|
||||
PHYSAC_COLLISION_ITERATIONS: int = 100
|
||||
PHYSAC_PENETRATION_ALLOWANCE: float = 0.05
|
||||
PHYSAC_PENETRATION_CORRECTION: float = 0.4
|
||||
PHYSAC_PI: float = 3.141592653589793
|
||||
PHYSAC_DEG2RAD = PHYSAC_PI / 180.0
|
||||
PHYSAC_FLT_MAX: float = 3.402823466e+38
|
||||
PHYSAC_EPSILON: float = 1e-06
|
||||
GLFW_VERSION_MAJOR: int = 3
|
||||
GLFW_VERSION_MINOR: int = 4
|
||||
GLFW_VERSION_REVISION: int = 0
|
||||
GLFW_TRUE: int = 1
|
||||
GLFW_FALSE: int = 0
|
||||
GLFW_RELEASE: int = 0
|
||||
GLFW_PRESS: int = 1
|
||||
GLFW_REPEAT: int = 2
|
||||
GLFW_HAT_CENTERED: int = 0
|
||||
GLFW_HAT_UP: int = 1
|
||||
GLFW_HAT_RIGHT: int = 2
|
||||
GLFW_HAT_DOWN: int = 4
|
||||
GLFW_HAT_LEFT: int = 8
|
||||
GLFW_HAT_RIGHT_UP = GLFW_HAT_RIGHT | GLFW_HAT_UP
|
||||
GLFW_HAT_RIGHT_DOWN = GLFW_HAT_RIGHT | GLFW_HAT_DOWN
|
||||
GLFW_HAT_LEFT_UP = GLFW_HAT_LEFT | GLFW_HAT_UP
|
||||
GLFW_HAT_LEFT_DOWN = GLFW_HAT_LEFT | GLFW_HAT_DOWN
|
||||
GLFW_KEY_SPACE: int = 32
|
||||
GLFW_KEY_APOSTROPHE: int = 39
|
||||
GLFW_KEY_COMMA: int = 44
|
||||
GLFW_KEY_MINUS: int = 45
|
||||
GLFW_KEY_PERIOD: int = 46
|
||||
GLFW_KEY_SLASH: int = 47
|
||||
GLFW_KEY_0: int = 48
|
||||
GLFW_KEY_1: int = 49
|
||||
GLFW_KEY_2: int = 50
|
||||
GLFW_KEY_3: int = 51
|
||||
GLFW_KEY_4: int = 52
|
||||
GLFW_KEY_5: int = 53
|
||||
GLFW_KEY_6: int = 54
|
||||
GLFW_KEY_7: int = 55
|
||||
GLFW_KEY_8: int = 56
|
||||
GLFW_KEY_9: int = 57
|
||||
GLFW_KEY_SEMICOLON: int = 59
|
||||
GLFW_KEY_EQUAL: int = 61
|
||||
GLFW_KEY_A: int = 65
|
||||
GLFW_KEY_B: int = 66
|
||||
GLFW_KEY_C: int = 67
|
||||
GLFW_KEY_D: int = 68
|
||||
GLFW_KEY_E: int = 69
|
||||
GLFW_KEY_F: int = 70
|
||||
GLFW_KEY_G: int = 71
|
||||
GLFW_KEY_H: int = 72
|
||||
GLFW_KEY_I: int = 73
|
||||
GLFW_KEY_J: int = 74
|
||||
GLFW_KEY_K: int = 75
|
||||
GLFW_KEY_L: int = 76
|
||||
GLFW_KEY_M: int = 77
|
||||
GLFW_KEY_N: int = 78
|
||||
GLFW_KEY_O: int = 79
|
||||
GLFW_KEY_P: int = 80
|
||||
GLFW_KEY_Q: int = 81
|
||||
GLFW_KEY_R: int = 82
|
||||
GLFW_KEY_S: int = 83
|
||||
GLFW_KEY_T: int = 84
|
||||
GLFW_KEY_U: int = 85
|
||||
GLFW_KEY_V: int = 86
|
||||
GLFW_KEY_W: int = 87
|
||||
GLFW_KEY_X: int = 88
|
||||
GLFW_KEY_Y: int = 89
|
||||
GLFW_KEY_Z: int = 90
|
||||
GLFW_KEY_LEFT_BRACKET: int = 91
|
||||
GLFW_KEY_BACKSLASH: int = 92
|
||||
GLFW_KEY_RIGHT_BRACKET: int = 93
|
||||
GLFW_KEY_GRAVE_ACCENT: int = 96
|
||||
GLFW_KEY_WORLD_1: int = 161
|
||||
GLFW_KEY_WORLD_2: int = 162
|
||||
GLFW_KEY_ESCAPE: int = 256
|
||||
GLFW_KEY_ENTER: int = 257
|
||||
GLFW_KEY_TAB: int = 258
|
||||
GLFW_KEY_BACKSPACE: int = 259
|
||||
GLFW_KEY_INSERT: int = 260
|
||||
GLFW_KEY_DELETE: int = 261
|
||||
GLFW_KEY_RIGHT: int = 262
|
||||
GLFW_KEY_LEFT: int = 263
|
||||
GLFW_KEY_DOWN: int = 264
|
||||
GLFW_KEY_UP: int = 265
|
||||
GLFW_KEY_PAGE_UP: int = 266
|
||||
GLFW_KEY_PAGE_DOWN: int = 267
|
||||
GLFW_KEY_HOME: int = 268
|
||||
GLFW_KEY_END: int = 269
|
||||
GLFW_KEY_CAPS_LOCK: int = 280
|
||||
GLFW_KEY_SCROLL_LOCK: int = 281
|
||||
GLFW_KEY_NUM_LOCK: int = 282
|
||||
GLFW_KEY_PRINT_SCREEN: int = 283
|
||||
GLFW_KEY_PAUSE: int = 284
|
||||
GLFW_KEY_F1: int = 290
|
||||
GLFW_KEY_F2: int = 291
|
||||
GLFW_KEY_F3: int = 292
|
||||
GLFW_KEY_F4: int = 293
|
||||
GLFW_KEY_F5: int = 294
|
||||
GLFW_KEY_F6: int = 295
|
||||
GLFW_KEY_F7: int = 296
|
||||
GLFW_KEY_F8: int = 297
|
||||
GLFW_KEY_F9: int = 298
|
||||
GLFW_KEY_F10: int = 299
|
||||
GLFW_KEY_F11: int = 300
|
||||
GLFW_KEY_F12: int = 301
|
||||
GLFW_KEY_F13: int = 302
|
||||
GLFW_KEY_F14: int = 303
|
||||
GLFW_KEY_F15: int = 304
|
||||
GLFW_KEY_F16: int = 305
|
||||
GLFW_KEY_F17: int = 306
|
||||
GLFW_KEY_F18: int = 307
|
||||
GLFW_KEY_F19: int = 308
|
||||
GLFW_KEY_F20: int = 309
|
||||
GLFW_KEY_F21: int = 310
|
||||
GLFW_KEY_F22: int = 311
|
||||
GLFW_KEY_F23: int = 312
|
||||
GLFW_KEY_F24: int = 313
|
||||
GLFW_KEY_F25: int = 314
|
||||
GLFW_KEY_KP_0: int = 320
|
||||
GLFW_KEY_KP_1: int = 321
|
||||
GLFW_KEY_KP_2: int = 322
|
||||
GLFW_KEY_KP_3: int = 323
|
||||
GLFW_KEY_KP_4: int = 324
|
||||
GLFW_KEY_KP_5: int = 325
|
||||
GLFW_KEY_KP_6: int = 326
|
||||
GLFW_KEY_KP_7: int = 327
|
||||
GLFW_KEY_KP_8: int = 328
|
||||
GLFW_KEY_KP_9: int = 329
|
||||
GLFW_KEY_KP_DECIMAL: int = 330
|
||||
GLFW_KEY_KP_DIVIDE: int = 331
|
||||
GLFW_KEY_KP_MULTIPLY: int = 332
|
||||
GLFW_KEY_KP_SUBTRACT: int = 333
|
||||
GLFW_KEY_KP_ADD: int = 334
|
||||
GLFW_KEY_KP_ENTER: int = 335
|
||||
GLFW_KEY_KP_EQUAL: int = 336
|
||||
GLFW_KEY_LEFT_SHIFT: int = 340
|
||||
GLFW_KEY_LEFT_CONTROL: int = 341
|
||||
GLFW_KEY_LEFT_ALT: int = 342
|
||||
GLFW_KEY_LEFT_SUPER: int = 343
|
||||
GLFW_KEY_RIGHT_SHIFT: int = 344
|
||||
GLFW_KEY_RIGHT_CONTROL: int = 345
|
||||
GLFW_KEY_RIGHT_ALT: int = 346
|
||||
GLFW_KEY_RIGHT_SUPER: int = 347
|
||||
GLFW_KEY_MENU: int = 348
|
||||
GLFW_MOD_SHIFT: int = 1
|
||||
GLFW_MOD_CONTROL: int = 2
|
||||
GLFW_MOD_ALT: int = 4
|
||||
GLFW_MOD_SUPER: int = 8
|
||||
GLFW_MOD_CAPS_LOCK: int = 16
|
||||
GLFW_MOD_NUM_LOCK: int = 32
|
||||
GLFW_MOUSE_BUTTON_1: int = 0
|
||||
GLFW_MOUSE_BUTTON_2: int = 1
|
||||
GLFW_MOUSE_BUTTON_3: int = 2
|
||||
GLFW_MOUSE_BUTTON_4: int = 3
|
||||
GLFW_MOUSE_BUTTON_5: int = 4
|
||||
GLFW_MOUSE_BUTTON_6: int = 5
|
||||
GLFW_MOUSE_BUTTON_7: int = 6
|
||||
GLFW_MOUSE_BUTTON_8: int = 7
|
||||
GLFW_JOYSTICK_1: int = 0
|
||||
GLFW_JOYSTICK_2: int = 1
|
||||
GLFW_JOYSTICK_3: int = 2
|
||||
GLFW_JOYSTICK_4: int = 3
|
||||
GLFW_JOYSTICK_5: int = 4
|
||||
GLFW_JOYSTICK_6: int = 5
|
||||
GLFW_JOYSTICK_7: int = 6
|
||||
GLFW_JOYSTICK_8: int = 7
|
||||
GLFW_JOYSTICK_9: int = 8
|
||||
GLFW_JOYSTICK_10: int = 9
|
||||
GLFW_JOYSTICK_11: int = 10
|
||||
GLFW_JOYSTICK_12: int = 11
|
||||
GLFW_JOYSTICK_13: int = 12
|
||||
GLFW_JOYSTICK_14: int = 13
|
||||
GLFW_JOYSTICK_15: int = 14
|
||||
GLFW_JOYSTICK_16: int = 15
|
||||
GLFW_GAMEPAD_BUTTON_A: int = 0
|
||||
GLFW_GAMEPAD_BUTTON_B: int = 1
|
||||
GLFW_GAMEPAD_BUTTON_X: int = 2
|
||||
GLFW_GAMEPAD_BUTTON_Y: int = 3
|
||||
GLFW_GAMEPAD_BUTTON_LEFT_BUMPER: int = 4
|
||||
GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER: int = 5
|
||||
GLFW_GAMEPAD_BUTTON_BACK: int = 6
|
||||
GLFW_GAMEPAD_BUTTON_START: int = 7
|
||||
GLFW_GAMEPAD_BUTTON_GUIDE: int = 8
|
||||
GLFW_GAMEPAD_BUTTON_LEFT_THUMB: int = 9
|
||||
GLFW_GAMEPAD_BUTTON_RIGHT_THUMB: int = 10
|
||||
GLFW_GAMEPAD_BUTTON_DPAD_UP: int = 11
|
||||
GLFW_GAMEPAD_BUTTON_DPAD_RIGHT: int = 12
|
||||
GLFW_GAMEPAD_BUTTON_DPAD_DOWN: int = 13
|
||||
GLFW_GAMEPAD_BUTTON_DPAD_LEFT: int = 14
|
||||
GLFW_GAMEPAD_AXIS_LEFT_X: int = 0
|
||||
GLFW_GAMEPAD_AXIS_LEFT_Y: int = 1
|
||||
GLFW_GAMEPAD_AXIS_RIGHT_X: int = 2
|
||||
GLFW_GAMEPAD_AXIS_RIGHT_Y: int = 3
|
||||
GLFW_GAMEPAD_AXIS_LEFT_TRIGGER: int = 4
|
||||
GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER: int = 5
|
||||
GLFW_NO_ERROR: int = 0
|
||||
GLFW_NOT_INITIALIZED: int = 65537
|
||||
GLFW_NO_CURRENT_CONTEXT: int = 65538
|
||||
GLFW_INVALID_ENUM: int = 65539
|
||||
GLFW_INVALID_VALUE: int = 65540
|
||||
GLFW_OUT_OF_MEMORY: int = 65541
|
||||
GLFW_API_UNAVAILABLE: int = 65542
|
||||
GLFW_VERSION_UNAVAILABLE: int = 65543
|
||||
GLFW_PLATFORM_ERROR: int = 65544
|
||||
GLFW_FORMAT_UNAVAILABLE: int = 65545
|
||||
GLFW_NO_WINDOW_CONTEXT: int = 65546
|
||||
GLFW_CURSOR_UNAVAILABLE: int = 65547
|
||||
GLFW_FEATURE_UNAVAILABLE: int = 65548
|
||||
GLFW_FEATURE_UNIMPLEMENTED: int = 65549
|
||||
GLFW_PLATFORM_UNAVAILABLE: int = 65550
|
||||
GLFW_FOCUSED: int = 131073
|
||||
GLFW_ICONIFIED: int = 131074
|
||||
GLFW_RESIZABLE: int = 131075
|
||||
GLFW_VISIBLE: int = 131076
|
||||
GLFW_DECORATED: int = 131077
|
||||
GLFW_AUTO_ICONIFY: int = 131078
|
||||
GLFW_FLOATING: int = 131079
|
||||
GLFW_MAXIMIZED: int = 131080
|
||||
GLFW_CENTER_CURSOR: int = 131081
|
||||
GLFW_TRANSPARENT_FRAMEBUFFER: int = 131082
|
||||
GLFW_HOVERED: int = 131083
|
||||
GLFW_FOCUS_ON_SHOW: int = 131084
|
||||
GLFW_MOUSE_PASSTHROUGH: int = 131085
|
||||
GLFW_POSITION_X: int = 131086
|
||||
GLFW_POSITION_Y: int = 131087
|
||||
GLFW_RED_BITS: int = 135169
|
||||
GLFW_GREEN_BITS: int = 135170
|
||||
GLFW_BLUE_BITS: int = 135171
|
||||
GLFW_ALPHA_BITS: int = 135172
|
||||
GLFW_DEPTH_BITS: int = 135173
|
||||
GLFW_STENCIL_BITS: int = 135174
|
||||
GLFW_ACCUM_RED_BITS: int = 135175
|
||||
GLFW_ACCUM_GREEN_BITS: int = 135176
|
||||
GLFW_ACCUM_BLUE_BITS: int = 135177
|
||||
GLFW_ACCUM_ALPHA_BITS: int = 135178
|
||||
GLFW_AUX_BUFFERS: int = 135179
|
||||
GLFW_STEREO: int = 135180
|
||||
GLFW_SAMPLES: int = 135181
|
||||
GLFW_SRGB_CAPABLE: int = 135182
|
||||
GLFW_REFRESH_RATE: int = 135183
|
||||
GLFW_DOUBLEBUFFER: int = 135184
|
||||
GLFW_CLIENT_API: int = 139265
|
||||
GLFW_CONTEXT_VERSION_MAJOR: int = 139266
|
||||
GLFW_CONTEXT_VERSION_MINOR: int = 139267
|
||||
GLFW_CONTEXT_REVISION: int = 139268
|
||||
GLFW_CONTEXT_ROBUSTNESS: int = 139269
|
||||
GLFW_OPENGL_FORWARD_COMPAT: int = 139270
|
||||
GLFW_CONTEXT_DEBUG: int = 139271
|
||||
GLFW_OPENGL_PROFILE: int = 139272
|
||||
GLFW_CONTEXT_RELEASE_BEHAVIOR: int = 139273
|
||||
GLFW_CONTEXT_NO_ERROR: int = 139274
|
||||
GLFW_CONTEXT_CREATION_API: int = 139275
|
||||
GLFW_SCALE_TO_MONITOR: int = 139276
|
||||
GLFW_SCALE_FRAMEBUFFER: int = 139277
|
||||
GLFW_COCOA_RETINA_FRAMEBUFFER: int = 143361
|
||||
GLFW_COCOA_FRAME_NAME: int = 143362
|
||||
GLFW_COCOA_GRAPHICS_SWITCHING: int = 143363
|
||||
GLFW_X11_CLASS_NAME: int = 147457
|
||||
GLFW_X11_INSTANCE_NAME: int = 147458
|
||||
GLFW_WIN32_KEYBOARD_MENU: int = 151553
|
||||
GLFW_WIN32_SHOWDEFAULT: int = 151554
|
||||
GLFW_WAYLAND_APP_ID: int = 155649
|
||||
GLFW_NO_API: int = 0
|
||||
GLFW_OPENGL_API: int = 196609
|
||||
GLFW_OPENGL_ES_API: int = 196610
|
||||
GLFW_NO_ROBUSTNESS: int = 0
|
||||
GLFW_NO_RESET_NOTIFICATION: int = 200705
|
||||
GLFW_LOSE_CONTEXT_ON_RESET: int = 200706
|
||||
GLFW_OPENGL_ANY_PROFILE: int = 0
|
||||
GLFW_OPENGL_CORE_PROFILE: int = 204801
|
||||
GLFW_OPENGL_COMPAT_PROFILE: int = 204802
|
||||
GLFW_CURSOR: int = 208897
|
||||
GLFW_STICKY_KEYS: int = 208898
|
||||
GLFW_STICKY_MOUSE_BUTTONS: int = 208899
|
||||
GLFW_LOCK_KEY_MODS: int = 208900
|
||||
GLFW_RAW_MOUSE_MOTION: int = 208901
|
||||
GLFW_CURSOR_NORMAL: int = 212993
|
||||
GLFW_CURSOR_HIDDEN: int = 212994
|
||||
GLFW_CURSOR_DISABLED: int = 212995
|
||||
GLFW_CURSOR_CAPTURED: int = 212996
|
||||
GLFW_ANY_RELEASE_BEHAVIOR: int = 0
|
||||
GLFW_RELEASE_BEHAVIOR_FLUSH: int = 217089
|
||||
GLFW_RELEASE_BEHAVIOR_NONE: int = 217090
|
||||
GLFW_NATIVE_CONTEXT_API: int = 221185
|
||||
GLFW_EGL_CONTEXT_API: int = 221186
|
||||
GLFW_OSMESA_CONTEXT_API: int = 221187
|
||||
GLFW_ANGLE_PLATFORM_TYPE_NONE: int = 225281
|
||||
GLFW_ANGLE_PLATFORM_TYPE_OPENGL: int = 225282
|
||||
GLFW_ANGLE_PLATFORM_TYPE_OPENGLES: int = 225283
|
||||
GLFW_ANGLE_PLATFORM_TYPE_D3D9: int = 225284
|
||||
GLFW_ANGLE_PLATFORM_TYPE_D3D11: int = 225285
|
||||
GLFW_ANGLE_PLATFORM_TYPE_VULKAN: int = 225287
|
||||
GLFW_ANGLE_PLATFORM_TYPE_METAL: int = 225288
|
||||
GLFW_WAYLAND_PREFER_LIBDECOR: int = 229377
|
||||
GLFW_WAYLAND_DISABLE_LIBDECOR: int = 229378
|
||||
GLFW_ANY_POSITION: int = 2147483648
|
||||
GLFW_ARROW_CURSOR: int = 221185
|
||||
GLFW_IBEAM_CURSOR: int = 221186
|
||||
GLFW_CROSSHAIR_CURSOR: int = 221187
|
||||
GLFW_POINTING_HAND_CURSOR: int = 221188
|
||||
GLFW_RESIZE_EW_CURSOR: int = 221189
|
||||
GLFW_RESIZE_NS_CURSOR: int = 221190
|
||||
GLFW_RESIZE_NWSE_CURSOR: int = 221191
|
||||
GLFW_RESIZE_NESW_CURSOR: int = 221192
|
||||
GLFW_RESIZE_ALL_CURSOR: int = 221193
|
||||
GLFW_NOT_ALLOWED_CURSOR: int = 221194
|
||||
GLFW_CONNECTED: int = 262145
|
||||
GLFW_DISCONNECTED: int = 262146
|
||||
GLFW_JOYSTICK_HAT_BUTTONS: int = 327681
|
||||
GLFW_ANGLE_PLATFORM_TYPE: int = 327682
|
||||
GLFW_PLATFORM: int = 327683
|
||||
GLFW_COCOA_CHDIR_RESOURCES: int = 331777
|
||||
GLFW_COCOA_MENUBAR: int = 331778
|
||||
GLFW_X11_XCB_VULKAN_SURFACE: int = 335873
|
||||
GLFW_WAYLAND_LIBDECOR: int = 339969
|
||||
GLFW_ANY_PLATFORM: int = 393216
|
||||
GLFW_PLATFORM_WIN32: int = 393217
|
||||
GLFW_PLATFORM_COCOA: int = 393218
|
||||
GLFW_PLATFORM_WAYLAND: int = 393219
|
||||
GLFW_PLATFORM_X11: int = 393220
|
||||
GLFW_PLATFORM_NULL: int = 393221
|
||||
719
raylib/raylib/enums.py
Normal file
719
raylib/raylib/enums.py
Normal file
@@ -0,0 +1,719 @@
|
||||
from enum import IntEnum
|
||||
|
||||
class ConfigFlags(IntEnum):
|
||||
FLAG_VSYNC_HINT = 64
|
||||
FLAG_FULLSCREEN_MODE = 2
|
||||
FLAG_WINDOW_RESIZABLE = 4
|
||||
FLAG_WINDOW_UNDECORATED = 8
|
||||
FLAG_WINDOW_HIDDEN = 128
|
||||
FLAG_WINDOW_MINIMIZED = 512
|
||||
FLAG_WINDOW_MAXIMIZED = 1024
|
||||
FLAG_WINDOW_UNFOCUSED = 2048
|
||||
FLAG_WINDOW_TOPMOST = 4096
|
||||
FLAG_WINDOW_ALWAYS_RUN = 256
|
||||
FLAG_WINDOW_TRANSPARENT = 16
|
||||
FLAG_WINDOW_HIGHDPI = 8192
|
||||
FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384
|
||||
FLAG_BORDERLESS_WINDOWED_MODE = 32768
|
||||
FLAG_MSAA_4X_HINT = 32
|
||||
FLAG_INTERLACED_HINT = 65536
|
||||
|
||||
class TraceLogLevel(IntEnum):
|
||||
LOG_ALL = 0
|
||||
LOG_TRACE = 1
|
||||
LOG_DEBUG = 2
|
||||
LOG_INFO = 3
|
||||
LOG_WARNING = 4
|
||||
LOG_ERROR = 5
|
||||
LOG_FATAL = 6
|
||||
LOG_NONE = 7
|
||||
|
||||
class KeyboardKey(IntEnum):
|
||||
KEY_NULL = 0
|
||||
KEY_APOSTROPHE = 39
|
||||
KEY_COMMA = 44
|
||||
KEY_MINUS = 45
|
||||
KEY_PERIOD = 46
|
||||
KEY_SLASH = 47
|
||||
KEY_ZERO = 48
|
||||
KEY_ONE = 49
|
||||
KEY_TWO = 50
|
||||
KEY_THREE = 51
|
||||
KEY_FOUR = 52
|
||||
KEY_FIVE = 53
|
||||
KEY_SIX = 54
|
||||
KEY_SEVEN = 55
|
||||
KEY_EIGHT = 56
|
||||
KEY_NINE = 57
|
||||
KEY_SEMICOLON = 59
|
||||
KEY_EQUAL = 61
|
||||
KEY_A = 65
|
||||
KEY_B = 66
|
||||
KEY_C = 67
|
||||
KEY_D = 68
|
||||
KEY_E = 69
|
||||
KEY_F = 70
|
||||
KEY_G = 71
|
||||
KEY_H = 72
|
||||
KEY_I = 73
|
||||
KEY_J = 74
|
||||
KEY_K = 75
|
||||
KEY_L = 76
|
||||
KEY_M = 77
|
||||
KEY_N = 78
|
||||
KEY_O = 79
|
||||
KEY_P = 80
|
||||
KEY_Q = 81
|
||||
KEY_R = 82
|
||||
KEY_S = 83
|
||||
KEY_T = 84
|
||||
KEY_U = 85
|
||||
KEY_V = 86
|
||||
KEY_W = 87
|
||||
KEY_X = 88
|
||||
KEY_Y = 89
|
||||
KEY_Z = 90
|
||||
KEY_LEFT_BRACKET = 91
|
||||
KEY_BACKSLASH = 92
|
||||
KEY_RIGHT_BRACKET = 93
|
||||
KEY_GRAVE = 96
|
||||
KEY_SPACE = 32
|
||||
KEY_ESCAPE = 256
|
||||
KEY_ENTER = 257
|
||||
KEY_TAB = 258
|
||||
KEY_BACKSPACE = 259
|
||||
KEY_INSERT = 260
|
||||
KEY_DELETE = 261
|
||||
KEY_RIGHT = 262
|
||||
KEY_LEFT = 263
|
||||
KEY_DOWN = 264
|
||||
KEY_UP = 265
|
||||
KEY_PAGE_UP = 266
|
||||
KEY_PAGE_DOWN = 267
|
||||
KEY_HOME = 268
|
||||
KEY_END = 269
|
||||
KEY_CAPS_LOCK = 280
|
||||
KEY_SCROLL_LOCK = 281
|
||||
KEY_NUM_LOCK = 282
|
||||
KEY_PRINT_SCREEN = 283
|
||||
KEY_PAUSE = 284
|
||||
KEY_F1 = 290
|
||||
KEY_F2 = 291
|
||||
KEY_F3 = 292
|
||||
KEY_F4 = 293
|
||||
KEY_F5 = 294
|
||||
KEY_F6 = 295
|
||||
KEY_F7 = 296
|
||||
KEY_F8 = 297
|
||||
KEY_F9 = 298
|
||||
KEY_F10 = 299
|
||||
KEY_F11 = 300
|
||||
KEY_F12 = 301
|
||||
KEY_LEFT_SHIFT = 340
|
||||
KEY_LEFT_CONTROL = 341
|
||||
KEY_LEFT_ALT = 342
|
||||
KEY_LEFT_SUPER = 343
|
||||
KEY_RIGHT_SHIFT = 344
|
||||
KEY_RIGHT_CONTROL = 345
|
||||
KEY_RIGHT_ALT = 346
|
||||
KEY_RIGHT_SUPER = 347
|
||||
KEY_KB_MENU = 348
|
||||
KEY_KP_0 = 320
|
||||
KEY_KP_1 = 321
|
||||
KEY_KP_2 = 322
|
||||
KEY_KP_3 = 323
|
||||
KEY_KP_4 = 324
|
||||
KEY_KP_5 = 325
|
||||
KEY_KP_6 = 326
|
||||
KEY_KP_7 = 327
|
||||
KEY_KP_8 = 328
|
||||
KEY_KP_9 = 329
|
||||
KEY_KP_DECIMAL = 330
|
||||
KEY_KP_DIVIDE = 331
|
||||
KEY_KP_MULTIPLY = 332
|
||||
KEY_KP_SUBTRACT = 333
|
||||
KEY_KP_ADD = 334
|
||||
KEY_KP_ENTER = 335
|
||||
KEY_KP_EQUAL = 336
|
||||
KEY_BACK = 4
|
||||
KEY_MENU = 5
|
||||
KEY_VOLUME_UP = 24
|
||||
KEY_VOLUME_DOWN = 25
|
||||
|
||||
class MouseButton(IntEnum):
|
||||
MOUSE_BUTTON_LEFT = 0
|
||||
MOUSE_BUTTON_RIGHT = 1
|
||||
MOUSE_BUTTON_MIDDLE = 2
|
||||
MOUSE_BUTTON_SIDE = 3
|
||||
MOUSE_BUTTON_EXTRA = 4
|
||||
MOUSE_BUTTON_FORWARD = 5
|
||||
MOUSE_BUTTON_BACK = 6
|
||||
|
||||
class MouseCursor(IntEnum):
|
||||
MOUSE_CURSOR_DEFAULT = 0
|
||||
MOUSE_CURSOR_ARROW = 1
|
||||
MOUSE_CURSOR_IBEAM = 2
|
||||
MOUSE_CURSOR_CROSSHAIR = 3
|
||||
MOUSE_CURSOR_POINTING_HAND = 4
|
||||
MOUSE_CURSOR_RESIZE_EW = 5
|
||||
MOUSE_CURSOR_RESIZE_NS = 6
|
||||
MOUSE_CURSOR_RESIZE_NWSE = 7
|
||||
MOUSE_CURSOR_RESIZE_NESW = 8
|
||||
MOUSE_CURSOR_RESIZE_ALL = 9
|
||||
MOUSE_CURSOR_NOT_ALLOWED = 10
|
||||
|
||||
class GamepadButton(IntEnum):
|
||||
GAMEPAD_BUTTON_UNKNOWN = 0
|
||||
GAMEPAD_BUTTON_LEFT_FACE_UP = 1
|
||||
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2
|
||||
GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3
|
||||
GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4
|
||||
GAMEPAD_BUTTON_RIGHT_FACE_UP = 5
|
||||
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6
|
||||
GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7
|
||||
GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8
|
||||
GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9
|
||||
GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10
|
||||
GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11
|
||||
GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12
|
||||
GAMEPAD_BUTTON_MIDDLE_LEFT = 13
|
||||
GAMEPAD_BUTTON_MIDDLE = 14
|
||||
GAMEPAD_BUTTON_MIDDLE_RIGHT = 15
|
||||
GAMEPAD_BUTTON_LEFT_THUMB = 16
|
||||
GAMEPAD_BUTTON_RIGHT_THUMB = 17
|
||||
|
||||
class GamepadAxis(IntEnum):
|
||||
GAMEPAD_AXIS_LEFT_X = 0
|
||||
GAMEPAD_AXIS_LEFT_Y = 1
|
||||
GAMEPAD_AXIS_RIGHT_X = 2
|
||||
GAMEPAD_AXIS_RIGHT_Y = 3
|
||||
GAMEPAD_AXIS_LEFT_TRIGGER = 4
|
||||
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
||||
|
||||
class MaterialMapIndex(IntEnum):
|
||||
MATERIAL_MAP_ALBEDO = 0
|
||||
MATERIAL_MAP_METALNESS = 1
|
||||
MATERIAL_MAP_NORMAL = 2
|
||||
MATERIAL_MAP_ROUGHNESS = 3
|
||||
MATERIAL_MAP_OCCLUSION = 4
|
||||
MATERIAL_MAP_EMISSION = 5
|
||||
MATERIAL_MAP_HEIGHT = 6
|
||||
MATERIAL_MAP_CUBEMAP = 7
|
||||
MATERIAL_MAP_IRRADIANCE = 8
|
||||
MATERIAL_MAP_PREFILTER = 9
|
||||
MATERIAL_MAP_BRDF = 10
|
||||
|
||||
class ShaderLocationIndex(IntEnum):
|
||||
SHADER_LOC_VERTEX_POSITION = 0
|
||||
SHADER_LOC_VERTEX_TEXCOORD01 = 1
|
||||
SHADER_LOC_VERTEX_TEXCOORD02 = 2
|
||||
SHADER_LOC_VERTEX_NORMAL = 3
|
||||
SHADER_LOC_VERTEX_TANGENT = 4
|
||||
SHADER_LOC_VERTEX_COLOR = 5
|
||||
SHADER_LOC_MATRIX_MVP = 6
|
||||
SHADER_LOC_MATRIX_VIEW = 7
|
||||
SHADER_LOC_MATRIX_PROJECTION = 8
|
||||
SHADER_LOC_MATRIX_MODEL = 9
|
||||
SHADER_LOC_MATRIX_NORMAL = 10
|
||||
SHADER_LOC_VECTOR_VIEW = 11
|
||||
SHADER_LOC_COLOR_DIFFUSE = 12
|
||||
SHADER_LOC_COLOR_SPECULAR = 13
|
||||
SHADER_LOC_COLOR_AMBIENT = 14
|
||||
SHADER_LOC_MAP_ALBEDO = 15
|
||||
SHADER_LOC_MAP_METALNESS = 16
|
||||
SHADER_LOC_MAP_NORMAL = 17
|
||||
SHADER_LOC_MAP_ROUGHNESS = 18
|
||||
SHADER_LOC_MAP_OCCLUSION = 19
|
||||
SHADER_LOC_MAP_EMISSION = 20
|
||||
SHADER_LOC_MAP_HEIGHT = 21
|
||||
SHADER_LOC_MAP_CUBEMAP = 22
|
||||
SHADER_LOC_MAP_IRRADIANCE = 23
|
||||
SHADER_LOC_MAP_PREFILTER = 24
|
||||
SHADER_LOC_MAP_BRDF = 25
|
||||
SHADER_LOC_VERTEX_BONEIDS = 26
|
||||
SHADER_LOC_VERTEX_BONEWEIGHTS = 27
|
||||
SHADER_LOC_BONE_MATRICES = 28
|
||||
|
||||
class ShaderUniformDataType(IntEnum):
|
||||
SHADER_UNIFORM_FLOAT = 0
|
||||
SHADER_UNIFORM_VEC2 = 1
|
||||
SHADER_UNIFORM_VEC3 = 2
|
||||
SHADER_UNIFORM_VEC4 = 3
|
||||
SHADER_UNIFORM_INT = 4
|
||||
SHADER_UNIFORM_IVEC2 = 5
|
||||
SHADER_UNIFORM_IVEC3 = 6
|
||||
SHADER_UNIFORM_IVEC4 = 7
|
||||
SHADER_UNIFORM_SAMPLER2D = 8
|
||||
|
||||
class ShaderAttributeDataType(IntEnum):
|
||||
SHADER_ATTRIB_FLOAT = 0
|
||||
SHADER_ATTRIB_VEC2 = 1
|
||||
SHADER_ATTRIB_VEC3 = 2
|
||||
SHADER_ATTRIB_VEC4 = 3
|
||||
|
||||
class PixelFormat(IntEnum):
|
||||
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
|
||||
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
|
||||
PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
|
||||
PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4
|
||||
PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5
|
||||
PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6
|
||||
PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7
|
||||
PIXELFORMAT_UNCOMPRESSED_R32 = 8
|
||||
PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9
|
||||
PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10
|
||||
PIXELFORMAT_UNCOMPRESSED_R16 = 11
|
||||
PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12
|
||||
PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13
|
||||
PIXELFORMAT_COMPRESSED_DXT1_RGB = 14
|
||||
PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15
|
||||
PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16
|
||||
PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17
|
||||
PIXELFORMAT_COMPRESSED_ETC1_RGB = 18
|
||||
PIXELFORMAT_COMPRESSED_ETC2_RGB = 19
|
||||
PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20
|
||||
PIXELFORMAT_COMPRESSED_PVRT_RGB = 21
|
||||
PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22
|
||||
PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23
|
||||
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24
|
||||
|
||||
class TextureFilter(IntEnum):
|
||||
TEXTURE_FILTER_POINT = 0
|
||||
TEXTURE_FILTER_BILINEAR = 1
|
||||
TEXTURE_FILTER_TRILINEAR = 2
|
||||
TEXTURE_FILTER_ANISOTROPIC_4X = 3
|
||||
TEXTURE_FILTER_ANISOTROPIC_8X = 4
|
||||
TEXTURE_FILTER_ANISOTROPIC_16X = 5
|
||||
|
||||
class TextureWrap(IntEnum):
|
||||
TEXTURE_WRAP_REPEAT = 0
|
||||
TEXTURE_WRAP_CLAMP = 1
|
||||
TEXTURE_WRAP_MIRROR_REPEAT = 2
|
||||
TEXTURE_WRAP_MIRROR_CLAMP = 3
|
||||
|
||||
class CubemapLayout(IntEnum):
|
||||
CUBEMAP_LAYOUT_AUTO_DETECT = 0
|
||||
CUBEMAP_LAYOUT_LINE_VERTICAL = 1
|
||||
CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2
|
||||
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3
|
||||
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4
|
||||
|
||||
class FontType(IntEnum):
|
||||
FONT_DEFAULT = 0
|
||||
FONT_BITMAP = 1
|
||||
FONT_SDF = 2
|
||||
|
||||
class BlendMode(IntEnum):
|
||||
BLEND_ALPHA = 0
|
||||
BLEND_ADDITIVE = 1
|
||||
BLEND_MULTIPLIED = 2
|
||||
BLEND_ADD_COLORS = 3
|
||||
BLEND_SUBTRACT_COLORS = 4
|
||||
BLEND_ALPHA_PREMULTIPLY = 5
|
||||
BLEND_CUSTOM = 6
|
||||
BLEND_CUSTOM_SEPARATE = 7
|
||||
|
||||
class Gesture(IntEnum):
|
||||
GESTURE_NONE = 0
|
||||
GESTURE_TAP = 1
|
||||
GESTURE_DOUBLETAP = 2
|
||||
GESTURE_HOLD = 4
|
||||
GESTURE_DRAG = 8
|
||||
GESTURE_SWIPE_RIGHT = 16
|
||||
GESTURE_SWIPE_LEFT = 32
|
||||
GESTURE_SWIPE_UP = 64
|
||||
GESTURE_SWIPE_DOWN = 128
|
||||
GESTURE_PINCH_IN = 256
|
||||
GESTURE_PINCH_OUT = 512
|
||||
|
||||
class CameraMode(IntEnum):
|
||||
CAMERA_CUSTOM = 0
|
||||
CAMERA_FREE = 1
|
||||
CAMERA_ORBITAL = 2
|
||||
CAMERA_FIRST_PERSON = 3
|
||||
CAMERA_THIRD_PERSON = 4
|
||||
|
||||
class CameraProjection(IntEnum):
|
||||
CAMERA_PERSPECTIVE = 0
|
||||
CAMERA_ORTHOGRAPHIC = 1
|
||||
|
||||
class NPatchLayout(IntEnum):
|
||||
NPATCH_NINE_PATCH = 0
|
||||
NPATCH_THREE_PATCH_VERTICAL = 1
|
||||
NPATCH_THREE_PATCH_HORIZONTAL = 2
|
||||
|
||||
class GuiState(IntEnum):
|
||||
STATE_NORMAL = 0
|
||||
STATE_FOCUSED = 1
|
||||
STATE_PRESSED = 2
|
||||
STATE_DISABLED = 3
|
||||
|
||||
class GuiTextAlignment(IntEnum):
|
||||
TEXT_ALIGN_LEFT = 0
|
||||
TEXT_ALIGN_CENTER = 1
|
||||
TEXT_ALIGN_RIGHT = 2
|
||||
|
||||
class GuiTextAlignmentVertical(IntEnum):
|
||||
TEXT_ALIGN_TOP = 0
|
||||
TEXT_ALIGN_MIDDLE = 1
|
||||
TEXT_ALIGN_BOTTOM = 2
|
||||
|
||||
class GuiTextWrapMode(IntEnum):
|
||||
TEXT_WRAP_NONE = 0
|
||||
TEXT_WRAP_CHAR = 1
|
||||
TEXT_WRAP_WORD = 2
|
||||
|
||||
class GuiControl(IntEnum):
|
||||
DEFAULT = 0
|
||||
LABEL = 1
|
||||
BUTTON = 2
|
||||
TOGGLE = 3
|
||||
SLIDER = 4
|
||||
PROGRESSBAR = 5
|
||||
CHECKBOX = 6
|
||||
COMBOBOX = 7
|
||||
DROPDOWNBOX = 8
|
||||
TEXTBOX = 9
|
||||
VALUEBOX = 10
|
||||
SPINNER = 11
|
||||
LISTVIEW = 12
|
||||
COLORPICKER = 13
|
||||
SCROLLBAR = 14
|
||||
STATUSBAR = 15
|
||||
|
||||
class GuiControlProperty(IntEnum):
|
||||
BORDER_COLOR_NORMAL = 0
|
||||
BASE_COLOR_NORMAL = 1
|
||||
TEXT_COLOR_NORMAL = 2
|
||||
BORDER_COLOR_FOCUSED = 3
|
||||
BASE_COLOR_FOCUSED = 4
|
||||
TEXT_COLOR_FOCUSED = 5
|
||||
BORDER_COLOR_PRESSED = 6
|
||||
BASE_COLOR_PRESSED = 7
|
||||
TEXT_COLOR_PRESSED = 8
|
||||
BORDER_COLOR_DISABLED = 9
|
||||
BASE_COLOR_DISABLED = 10
|
||||
TEXT_COLOR_DISABLED = 11
|
||||
BORDER_WIDTH = 12
|
||||
TEXT_PADDING = 13
|
||||
TEXT_ALIGNMENT = 14
|
||||
|
||||
class GuiDefaultProperty(IntEnum):
|
||||
TEXT_SIZE = 16
|
||||
TEXT_SPACING = 17
|
||||
LINE_COLOR = 18
|
||||
BACKGROUND_COLOR = 19
|
||||
TEXT_LINE_SPACING = 20
|
||||
TEXT_ALIGNMENT_VERTICAL = 21
|
||||
TEXT_WRAP_MODE = 22
|
||||
|
||||
class GuiToggleProperty(IntEnum):
|
||||
GROUP_PADDING = 16
|
||||
|
||||
class GuiSliderProperty(IntEnum):
|
||||
SLIDER_WIDTH = 16
|
||||
SLIDER_PADDING = 17
|
||||
|
||||
class GuiProgressBarProperty(IntEnum):
|
||||
PROGRESS_PADDING = 16
|
||||
|
||||
class GuiScrollBarProperty(IntEnum):
|
||||
ARROWS_SIZE = 16
|
||||
ARROWS_VISIBLE = 17
|
||||
SCROLL_SLIDER_PADDING = 18
|
||||
SCROLL_SLIDER_SIZE = 19
|
||||
SCROLL_PADDING = 20
|
||||
SCROLL_SPEED = 21
|
||||
|
||||
class GuiCheckBoxProperty(IntEnum):
|
||||
CHECK_PADDING = 16
|
||||
|
||||
class GuiComboBoxProperty(IntEnum):
|
||||
COMBO_BUTTON_WIDTH = 16
|
||||
COMBO_BUTTON_SPACING = 17
|
||||
|
||||
class GuiDropdownBoxProperty(IntEnum):
|
||||
ARROW_PADDING = 16
|
||||
DROPDOWN_ITEMS_SPACING = 17
|
||||
DROPDOWN_ARROW_HIDDEN = 18
|
||||
DROPDOWN_ROLL_UP = 19
|
||||
|
||||
class GuiTextBoxProperty(IntEnum):
|
||||
TEXT_READONLY = 16
|
||||
|
||||
class GuiSpinnerProperty(IntEnum):
|
||||
SPIN_BUTTON_WIDTH = 16
|
||||
SPIN_BUTTON_SPACING = 17
|
||||
|
||||
class GuiListViewProperty(IntEnum):
|
||||
LIST_ITEMS_HEIGHT = 16
|
||||
LIST_ITEMS_SPACING = 17
|
||||
SCROLLBAR_WIDTH = 18
|
||||
SCROLLBAR_SIDE = 19
|
||||
LIST_ITEMS_BORDER_WIDTH = 20
|
||||
|
||||
class GuiColorPickerProperty(IntEnum):
|
||||
COLOR_SELECTOR_SIZE = 16
|
||||
HUEBAR_WIDTH = 17
|
||||
HUEBAR_PADDING = 18
|
||||
HUEBAR_SELECTOR_HEIGHT = 19
|
||||
HUEBAR_SELECTOR_OVERFLOW = 20
|
||||
|
||||
class GuiIconName(IntEnum):
|
||||
ICON_NONE = 0
|
||||
ICON_FOLDER_FILE_OPEN = 1
|
||||
ICON_FILE_SAVE_CLASSIC = 2
|
||||
ICON_FOLDER_OPEN = 3
|
||||
ICON_FOLDER_SAVE = 4
|
||||
ICON_FILE_OPEN = 5
|
||||
ICON_FILE_SAVE = 6
|
||||
ICON_FILE_EXPORT = 7
|
||||
ICON_FILE_ADD = 8
|
||||
ICON_FILE_DELETE = 9
|
||||
ICON_FILETYPE_TEXT = 10
|
||||
ICON_FILETYPE_AUDIO = 11
|
||||
ICON_FILETYPE_IMAGE = 12
|
||||
ICON_FILETYPE_PLAY = 13
|
||||
ICON_FILETYPE_VIDEO = 14
|
||||
ICON_FILETYPE_INFO = 15
|
||||
ICON_FILE_COPY = 16
|
||||
ICON_FILE_CUT = 17
|
||||
ICON_FILE_PASTE = 18
|
||||
ICON_CURSOR_HAND = 19
|
||||
ICON_CURSOR_POINTER = 20
|
||||
ICON_CURSOR_CLASSIC = 21
|
||||
ICON_PENCIL = 22
|
||||
ICON_PENCIL_BIG = 23
|
||||
ICON_BRUSH_CLASSIC = 24
|
||||
ICON_BRUSH_PAINTER = 25
|
||||
ICON_WATER_DROP = 26
|
||||
ICON_COLOR_PICKER = 27
|
||||
ICON_RUBBER = 28
|
||||
ICON_COLOR_BUCKET = 29
|
||||
ICON_TEXT_T = 30
|
||||
ICON_TEXT_A = 31
|
||||
ICON_SCALE = 32
|
||||
ICON_RESIZE = 33
|
||||
ICON_FILTER_POINT = 34
|
||||
ICON_FILTER_BILINEAR = 35
|
||||
ICON_CROP = 36
|
||||
ICON_CROP_ALPHA = 37
|
||||
ICON_SQUARE_TOGGLE = 38
|
||||
ICON_SYMMETRY = 39
|
||||
ICON_SYMMETRY_HORIZONTAL = 40
|
||||
ICON_SYMMETRY_VERTICAL = 41
|
||||
ICON_LENS = 42
|
||||
ICON_LENS_BIG = 43
|
||||
ICON_EYE_ON = 44
|
||||
ICON_EYE_OFF = 45
|
||||
ICON_FILTER_TOP = 46
|
||||
ICON_FILTER = 47
|
||||
ICON_TARGET_POINT = 48
|
||||
ICON_TARGET_SMALL = 49
|
||||
ICON_TARGET_BIG = 50
|
||||
ICON_TARGET_MOVE = 51
|
||||
ICON_CURSOR_MOVE = 52
|
||||
ICON_CURSOR_SCALE = 53
|
||||
ICON_CURSOR_SCALE_RIGHT = 54
|
||||
ICON_CURSOR_SCALE_LEFT = 55
|
||||
ICON_UNDO = 56
|
||||
ICON_REDO = 57
|
||||
ICON_REREDO = 58
|
||||
ICON_MUTATE = 59
|
||||
ICON_ROTATE = 60
|
||||
ICON_REPEAT = 61
|
||||
ICON_SHUFFLE = 62
|
||||
ICON_EMPTYBOX = 63
|
||||
ICON_TARGET = 64
|
||||
ICON_TARGET_SMALL_FILL = 65
|
||||
ICON_TARGET_BIG_FILL = 66
|
||||
ICON_TARGET_MOVE_FILL = 67
|
||||
ICON_CURSOR_MOVE_FILL = 68
|
||||
ICON_CURSOR_SCALE_FILL = 69
|
||||
ICON_CURSOR_SCALE_RIGHT_FILL = 70
|
||||
ICON_CURSOR_SCALE_LEFT_FILL = 71
|
||||
ICON_UNDO_FILL = 72
|
||||
ICON_REDO_FILL = 73
|
||||
ICON_REREDO_FILL = 74
|
||||
ICON_MUTATE_FILL = 75
|
||||
ICON_ROTATE_FILL = 76
|
||||
ICON_REPEAT_FILL = 77
|
||||
ICON_SHUFFLE_FILL = 78
|
||||
ICON_EMPTYBOX_SMALL = 79
|
||||
ICON_BOX = 80
|
||||
ICON_BOX_TOP = 81
|
||||
ICON_BOX_TOP_RIGHT = 82
|
||||
ICON_BOX_RIGHT = 83
|
||||
ICON_BOX_BOTTOM_RIGHT = 84
|
||||
ICON_BOX_BOTTOM = 85
|
||||
ICON_BOX_BOTTOM_LEFT = 86
|
||||
ICON_BOX_LEFT = 87
|
||||
ICON_BOX_TOP_LEFT = 88
|
||||
ICON_BOX_CENTER = 89
|
||||
ICON_BOX_CIRCLE_MASK = 90
|
||||
ICON_POT = 91
|
||||
ICON_ALPHA_MULTIPLY = 92
|
||||
ICON_ALPHA_CLEAR = 93
|
||||
ICON_DITHERING = 94
|
||||
ICON_MIPMAPS = 95
|
||||
ICON_BOX_GRID = 96
|
||||
ICON_GRID = 97
|
||||
ICON_BOX_CORNERS_SMALL = 98
|
||||
ICON_BOX_CORNERS_BIG = 99
|
||||
ICON_FOUR_BOXES = 100
|
||||
ICON_GRID_FILL = 101
|
||||
ICON_BOX_MULTISIZE = 102
|
||||
ICON_ZOOM_SMALL = 103
|
||||
ICON_ZOOM_MEDIUM = 104
|
||||
ICON_ZOOM_BIG = 105
|
||||
ICON_ZOOM_ALL = 106
|
||||
ICON_ZOOM_CENTER = 107
|
||||
ICON_BOX_DOTS_SMALL = 108
|
||||
ICON_BOX_DOTS_BIG = 109
|
||||
ICON_BOX_CONCENTRIC = 110
|
||||
ICON_BOX_GRID_BIG = 111
|
||||
ICON_OK_TICK = 112
|
||||
ICON_CROSS = 113
|
||||
ICON_ARROW_LEFT = 114
|
||||
ICON_ARROW_RIGHT = 115
|
||||
ICON_ARROW_DOWN = 116
|
||||
ICON_ARROW_UP = 117
|
||||
ICON_ARROW_LEFT_FILL = 118
|
||||
ICON_ARROW_RIGHT_FILL = 119
|
||||
ICON_ARROW_DOWN_FILL = 120
|
||||
ICON_ARROW_UP_FILL = 121
|
||||
ICON_AUDIO = 122
|
||||
ICON_FX = 123
|
||||
ICON_WAVE = 124
|
||||
ICON_WAVE_SINUS = 125
|
||||
ICON_WAVE_SQUARE = 126
|
||||
ICON_WAVE_TRIANGULAR = 127
|
||||
ICON_CROSS_SMALL = 128
|
||||
ICON_PLAYER_PREVIOUS = 129
|
||||
ICON_PLAYER_PLAY_BACK = 130
|
||||
ICON_PLAYER_PLAY = 131
|
||||
ICON_PLAYER_PAUSE = 132
|
||||
ICON_PLAYER_STOP = 133
|
||||
ICON_PLAYER_NEXT = 134
|
||||
ICON_PLAYER_RECORD = 135
|
||||
ICON_MAGNET = 136
|
||||
ICON_LOCK_CLOSE = 137
|
||||
ICON_LOCK_OPEN = 138
|
||||
ICON_CLOCK = 139
|
||||
ICON_TOOLS = 140
|
||||
ICON_GEAR = 141
|
||||
ICON_GEAR_BIG = 142
|
||||
ICON_BIN = 143
|
||||
ICON_HAND_POINTER = 144
|
||||
ICON_LASER = 145
|
||||
ICON_COIN = 146
|
||||
ICON_EXPLOSION = 147
|
||||
ICON_1UP = 148
|
||||
ICON_PLAYER = 149
|
||||
ICON_PLAYER_JUMP = 150
|
||||
ICON_KEY = 151
|
||||
ICON_DEMON = 152
|
||||
ICON_TEXT_POPUP = 153
|
||||
ICON_GEAR_EX = 154
|
||||
ICON_CRACK = 155
|
||||
ICON_CRACK_POINTS = 156
|
||||
ICON_STAR = 157
|
||||
ICON_DOOR = 158
|
||||
ICON_EXIT = 159
|
||||
ICON_MODE_2D = 160
|
||||
ICON_MODE_3D = 161
|
||||
ICON_CUBE = 162
|
||||
ICON_CUBE_FACE_TOP = 163
|
||||
ICON_CUBE_FACE_LEFT = 164
|
||||
ICON_CUBE_FACE_FRONT = 165
|
||||
ICON_CUBE_FACE_BOTTOM = 166
|
||||
ICON_CUBE_FACE_RIGHT = 167
|
||||
ICON_CUBE_FACE_BACK = 168
|
||||
ICON_CAMERA = 169
|
||||
ICON_SPECIAL = 170
|
||||
ICON_LINK_NET = 171
|
||||
ICON_LINK_BOXES = 172
|
||||
ICON_LINK_MULTI = 173
|
||||
ICON_LINK = 174
|
||||
ICON_LINK_BROKE = 175
|
||||
ICON_TEXT_NOTES = 176
|
||||
ICON_NOTEBOOK = 177
|
||||
ICON_SUITCASE = 178
|
||||
ICON_SUITCASE_ZIP = 179
|
||||
ICON_MAILBOX = 180
|
||||
ICON_MONITOR = 181
|
||||
ICON_PRINTER = 182
|
||||
ICON_PHOTO_CAMERA = 183
|
||||
ICON_PHOTO_CAMERA_FLASH = 184
|
||||
ICON_HOUSE = 185
|
||||
ICON_HEART = 186
|
||||
ICON_CORNER = 187
|
||||
ICON_VERTICAL_BARS = 188
|
||||
ICON_VERTICAL_BARS_FILL = 189
|
||||
ICON_LIFE_BARS = 190
|
||||
ICON_INFO = 191
|
||||
ICON_CROSSLINE = 192
|
||||
ICON_HELP = 193
|
||||
ICON_FILETYPE_ALPHA = 194
|
||||
ICON_FILETYPE_HOME = 195
|
||||
ICON_LAYERS_VISIBLE = 196
|
||||
ICON_LAYERS = 197
|
||||
ICON_WINDOW = 198
|
||||
ICON_HIDPI = 199
|
||||
ICON_FILETYPE_BINARY = 200
|
||||
ICON_HEX = 201
|
||||
ICON_SHIELD = 202
|
||||
ICON_FILE_NEW = 203
|
||||
ICON_FOLDER_ADD = 204
|
||||
ICON_ALARM = 205
|
||||
ICON_CPU = 206
|
||||
ICON_ROM = 207
|
||||
ICON_STEP_OVER = 208
|
||||
ICON_STEP_INTO = 209
|
||||
ICON_STEP_OUT = 210
|
||||
ICON_RESTART = 211
|
||||
ICON_BREAKPOINT_ON = 212
|
||||
ICON_BREAKPOINT_OFF = 213
|
||||
ICON_BURGER_MENU = 214
|
||||
ICON_CASE_SENSITIVE = 215
|
||||
ICON_REG_EXP = 216
|
||||
ICON_FOLDER = 217
|
||||
ICON_FILE = 218
|
||||
ICON_SAND_TIMER = 219
|
||||
ICON_WARNING = 220
|
||||
ICON_HELP_BOX = 221
|
||||
ICON_INFO_BOX = 222
|
||||
ICON_PRIORITY = 223
|
||||
ICON_LAYERS_ISO = 224
|
||||
ICON_LAYERS2 = 225
|
||||
ICON_MLAYERS = 226
|
||||
ICON_MAPS = 227
|
||||
ICON_HOT = 228
|
||||
ICON_229 = 229
|
||||
ICON_230 = 230
|
||||
ICON_231 = 231
|
||||
ICON_232 = 232
|
||||
ICON_233 = 233
|
||||
ICON_234 = 234
|
||||
ICON_235 = 235
|
||||
ICON_236 = 236
|
||||
ICON_237 = 237
|
||||
ICON_238 = 238
|
||||
ICON_239 = 239
|
||||
ICON_240 = 240
|
||||
ICON_241 = 241
|
||||
ICON_242 = 242
|
||||
ICON_243 = 243
|
||||
ICON_244 = 244
|
||||
ICON_245 = 245
|
||||
ICON_246 = 246
|
||||
ICON_247 = 247
|
||||
ICON_248 = 248
|
||||
ICON_249 = 249
|
||||
ICON_250 = 250
|
||||
ICON_251 = 251
|
||||
ICON_252 = 252
|
||||
ICON_253 = 253
|
||||
ICON_254 = 254
|
||||
ICON_255 = 255
|
||||
|
||||
1
raylib/raylib/version.py
Normal file
1
raylib/raylib/version.py
Normal file
@@ -0,0 +1 @@
|
||||
__version__ = "5.5.0.8"
|
||||
61
raylib/setup.py
Normal file
61
raylib/setup.py
Normal file
@@ -0,0 +1,61 @@
|
||||
import glob
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.command.build_py import build_py
|
||||
|
||||
try:
|
||||
from wheel.bdist_wheel import bdist_wheel
|
||||
except ImportError:
|
||||
bdist_wheel = None
|
||||
|
||||
|
||||
class BuildRaylib(build_py):
|
||||
"""Run build.sh to compile the C library and CFFI extension 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)
|
||||
|
||||
# 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")
|
||||
if os.path.isfile(build_cffi):
|
||||
subprocess.check_call([sys.executable, build_cffi], cwd=pkg_dir)
|
||||
|
||||
super().run()
|
||||
|
||||
|
||||
cmdclass = {"build_py": BuildRaylib}
|
||||
|
||||
if bdist_wheel is not None:
|
||||
|
||||
class PlatformWheel(bdist_wheel):
|
||||
"""Produce a platform-specific wheel (contains native .a library)."""
|
||||
|
||||
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
|
||||
|
||||
|
||||
setup(cmdclass=cmdclass)
|
||||
177
release.sh
Executable file
177
release.sh
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
REPO=commaai/dependencies
|
||||
|
||||
echo
|
||||
echo "Publishing wheels to GitHub Releases ($REPO)"
|
||||
|
||||
shopt -s nullglob
|
||||
for toml in */pyproject.toml; do
|
||||
pkg="$(dirname "$toml")"
|
||||
module="${pkg//-/_}"
|
||||
version="$(python3 -c "import tomllib; print(tomllib.load(open('$toml', 'rb'))['project']['version'])")"
|
||||
tag="${pkg}/v${version}"
|
||||
|
||||
wheels=("dist/${module}-${version}-"*.whl)
|
||||
if [[ ${#wheels[@]} -eq 0 ]]; then
|
||||
echo "missing wheel for $pkg ($module-$version) in dist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[$pkg] Uploading ${#wheels[@]} wheel(s) to $tag"
|
||||
|
||||
gh release create "$tag" "${wheels[@]}" --repo "$REPO" --title "$pkg v$version" --notes "Platform wheels for $pkg $version" 2>/dev/null ||
|
||||
gh release upload "$tag" "${wheels[@]}" --repo "$REPO" --clobber
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
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'
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
import tomllib
|
||||
import sys
|
||||
|
||||
tmp_dir = pathlib.Path(sys.argv[1])
|
||||
repo = sys.argv[2]
|
||||
repo_url = f"https://github.com/{repo}"
|
||||
shim_setup = pathlib.Path("_shim_setup.py")
|
||||
|
||||
for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")):
|
||||
pkg = toml.parent.name
|
||||
module = pkg.replace("-", "_")
|
||||
data = tomllib.load(toml.open("rb"))
|
||||
version = str(data["project"]["version"])
|
||||
tag = f"{pkg}/v{version}"
|
||||
description = data["project"]["description"]
|
||||
patterns = data.get("tool", {}).get("setuptools", {}).get("package-data", {}).get(module, [""])
|
||||
datadir = patterns[0].split("/", 1)[0] if patterns and patterns[0] else ""
|
||||
scripts = data.get("project", {}).get("scripts", {}) or {}
|
||||
|
||||
repo_dir = tmp_dir / pkg
|
||||
pkg_dir = repo_dir / pkg
|
||||
mod_dir = pkg_dir / module
|
||||
mod_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# copy all .py files from the main module
|
||||
src_mod = pathlib.Path(pkg) / module
|
||||
for py_file in src_mod.glob("*.py"):
|
||||
shutil.copy2(py_file, mod_dir / py_file.name)
|
||||
|
||||
# copy extra packages (e.g. pyray for raylib, slim casadi for acados)
|
||||
# binaries (.so/.dylib) are fetched from the wheel at install time, so the
|
||||
# shim repo only carries Python sources to keep it small
|
||||
def _ignore_binaries(_dir, names):
|
||||
return [n for n in names if n.endswith((".so", ".dylib", ".a")) or ".so." in n or n == "__pycache__"]
|
||||
|
||||
# `packages` is either a flat list (["acados", "casadi"]) or a dict with
|
||||
# `find.include` patterns (["acados*", "casadi*"]) — handle both
|
||||
pkgs_val = data.get("tool", {}).get("setuptools", {}).get("packages", [])
|
||||
if isinstance(pkgs_val, list):
|
||||
include_patterns = list(pkgs_val)
|
||||
elif isinstance(pkgs_val, dict):
|
||||
include_patterns = pkgs_val.get("find", {}).get("include", [])
|
||||
else:
|
||||
include_patterns = []
|
||||
extra_packages = []
|
||||
for pattern in include_patterns:
|
||||
p = pattern.rstrip("*")
|
||||
if p and p != module and p != f"{module}/":
|
||||
src_extra = pathlib.Path(pkg) / p
|
||||
dst_extra = pkg_dir / p
|
||||
if src_extra.is_dir():
|
||||
shutil.copytree(src_extra, dst_extra, dirs_exist_ok=True, ignore=_ignore_binaries)
|
||||
else:
|
||||
# source not in the workspace (typically built lazily by build.sh and
|
||||
# not cached into the publish job). Drop a placeholder __init__.py so
|
||||
# setuptools.packages.find picks it up; the shim's setup.py overwrites
|
||||
# it from the wheel at install time.
|
||||
dst_extra.mkdir(parents=True, exist_ok=True)
|
||||
(dst_extra / "__init__.py").write_text("")
|
||||
extra_packages.append(pattern)
|
||||
|
||||
shutil.copy2(shim_setup, pkg_dir / "setup.py")
|
||||
|
||||
deps = data.get("project", {}).get("dependencies", [])
|
||||
|
||||
lines = [
|
||||
"[build-system]",
|
||||
'requires = ["setuptools>=64", "wheel", \'tomli; python_version < \"3.11\"\']',
|
||||
'build-backend = "setuptools.build_meta"',
|
||||
"",
|
||||
"[project]",
|
||||
f'name = "{pkg}"',
|
||||
f'version = "{version}"',
|
||||
f"description = {json.dumps(description + ' (pre-built)')}",
|
||||
'requires-python = ">=3.8"',
|
||||
]
|
||||
|
||||
if deps:
|
||||
lines.append(f"dependencies = {json.dumps(deps)}")
|
||||
|
||||
if scripts:
|
||||
lines += ["", "[project.scripts]"]
|
||||
for name, target in scripts.items():
|
||||
lines.append(f'"{name}" = {json.dumps(target)}')
|
||||
|
||||
# propagate the workspace's package-data so the shim wheel knows to ship
|
||||
# everything the upstream wheel ships (e.g. acados_template/, casadi/*.so).
|
||||
workspace_pkgdata = data.get("tool", {}).get("setuptools", {}).get("package-data", {})
|
||||
|
||||
# extra_packages may be plain names (["casadi"]) or globs (["casadi*"]).
|
||||
# Normalise to plain package names for both `packages` and `package-data`.
|
||||
extra_pkg_names = [p.rstrip("*").rstrip("/") for p in extra_packages]
|
||||
|
||||
lines += [
|
||||
"",
|
||||
"[tool.setuptools]",
|
||||
f"packages = {json.dumps([module] + extra_pkg_names)}",
|
||||
"",
|
||||
"[tool.setuptools.package-data]",
|
||||
]
|
||||
module_data = sorted(set(workspace_pkgdata.get(module, [f"{datadir}/**/*"]) + ["*.so"]))
|
||||
lines.append(f"{module} = {json.dumps(module_data)}")
|
||||
for name in extra_pkg_names:
|
||||
extra_data = workspace_pkgdata.get(name, ["**/*"])
|
||||
lines.append(f"{name} = {json.dumps(list(extra_data))}")
|
||||
|
||||
lines += [
|
||||
"",
|
||||
"[tool.shim]",
|
||||
f'repo_url = "{repo_url}"',
|
||||
f'tag = "{tag}"',
|
||||
f'datadir = "{datadir}"',
|
||||
]
|
||||
|
||||
(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 "$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"
|
||||
37
setup.sh
37
setup.sh
@@ -1,8 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
brew install nasm pkg-config
|
||||
# sets up build-time dependencies (NOT runtime dependencies)
|
||||
|
||||
run_as_root() {
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
"$@"
|
||||
elif command -v sudo &>/dev/null; then
|
||||
sudo "$@"
|
||||
else
|
||||
sudo apt-get update && sudo apt-get install -y nasm cmake g++ pkg-config
|
||||
echo "error: root privileges required for: $*" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
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 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 autoconf automake libtool
|
||||
fi
|
||||
|
||||
if ! command -v uv &>/dev/null; then
|
||||
command -v curl &>/dev/null || {
|
||||
echo "error: curl is required to install uv" >&2
|
||||
exit 1
|
||||
}
|
||||
UV_BIN_DIR="$HOME/.local/bin"
|
||||
mkdir -p "$UV_BIN_DIR"
|
||||
curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="$UV_BIN_DIR" sh
|
||||
export PATH="$UV_BIN_DIR:$PATH"
|
||||
command -v uv &>/dev/null || {
|
||||
echo "error: failed to install uv" >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
18
smoketest.sh
18
smoketest.sh
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
WHEEL_DIR="${1:?Usage: smoketest.sh <wheel-directory>}"
|
||||
WHEEL_DIR="$(cd "$WHEEL_DIR" && pwd)"
|
||||
|
||||
VENV_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$VENV_DIR"' EXIT
|
||||
python3 -m venv "$VENV_DIR"
|
||||
source "$VENV_DIR/bin/activate"
|
||||
pip install --upgrade pip >/dev/null
|
||||
pip install "$WHEEL_DIR"/*.whl
|
||||
|
||||
for toml in "$REPO_DIR"/*/pyproject.toml; do
|
||||
module="$(basename "$(dirname "$toml")" | tr '-' '_')"
|
||||
python3 -c "import $module; $module.smoketest()" && echo "$module: OK"
|
||||
done
|
||||
60
test.sh
60
test.sh
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
|
||||
# Create a temporary virtualenv
|
||||
VENV_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$VENV_DIR"' EXIT
|
||||
python3 -m venv "$VENV_DIR"
|
||||
source "$VENV_DIR/bin/activate"
|
||||
pip install --upgrade pip >/dev/null
|
||||
|
||||
# Auto-discover packages: any subdirectory containing a pyproject.toml
|
||||
PACKAGES=()
|
||||
for toml in "$REPO_DIR"/*/pyproject.toml; do
|
||||
[ -f "$toml" ] || continue
|
||||
PACKAGES+=("$(dirname "$toml")")
|
||||
done
|
||||
|
||||
if [ ${#PACKAGES[@]} -eq 0 ]; then
|
||||
echo "No packages found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FAILED=()
|
||||
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
name="$(basename "$pkg")"
|
||||
echo "========================================="
|
||||
echo "Testing: $name"
|
||||
echo "========================================="
|
||||
|
||||
# Install from git URL with subdirectory (simulates real-world usage)
|
||||
echo "[$name] pip install ..."
|
||||
pip install "$pkg" --verbose
|
||||
|
||||
# Verify import works
|
||||
module="${name//-/_}"
|
||||
echo "[$name] Verifying import of $module ..."
|
||||
python -c "import $module; print(f'{$module.__name__} OK')"
|
||||
|
||||
echo "[$name] PASSED"
|
||||
echo
|
||||
done
|
||||
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo "FAILED packages: ${FAILED[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All ${#PACKAGES[@]} package(s) passed."
|
||||
echo
|
||||
echo "Installed sizes:"
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
name="$(basename "$pkg")"
|
||||
module="${name//-/_}"
|
||||
mod_dir="$(python -c "import $module, os; print(os.path.dirname($module.__file__))")"
|
||||
size="$(du -sh "$mod_dir" | cut -f1)"
|
||||
echo " $name: $size"
|
||||
done
|
||||
42
test_wheels_in_image.sh
Executable file
42
test_wheels_in_image.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# a small script for testing our built wheels in a variety of linux distros
|
||||
|
||||
IMAGE="${1:?usage: ./test_wheels_in_image.sh <image>}"
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
# setup our deps - should only need a python3 build
|
||||
docker build -t wheeltest -f - . <<DOCKERFILE
|
||||
FROM $IMAGE
|
||||
RUN if command -v apk >/dev/null; then \
|
||||
apk add --no-cache python3 py3-pip bash; \
|
||||
elif command -v apt-get >/dev/null; then \
|
||||
apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-venv; \
|
||||
elif command -v dnf >/dev/null; then \
|
||||
dnf install -y python3 python3-pip; \
|
||||
elif command -v pacman >/dev/null; then \
|
||||
pacman -Sy --noconfirm python python-pip; \
|
||||
elif command -v zypper >/dev/null; then \
|
||||
zypper install -y python3 python3-pip; \
|
||||
elif command -v xbps-install >/dev/null; then \
|
||||
xbps-install -Sy python3 python3-pip bash; \
|
||||
fi
|
||||
DOCKERFILE
|
||||
|
||||
# install + smoketest
|
||||
docker run --rm -v "$PWD:/work" -w /work wheeltest bash -lc '
|
||||
set -euo pipefail
|
||||
python3 -m venv /tmp/venv
|
||||
source /tmp/venv/bin/activate
|
||||
pip install dist/*.whl
|
||||
for toml in */pyproject.toml; do
|
||||
module="$(basename "$(dirname "$toml")" | tr "-" "_")"
|
||||
python -c "import $module; $module.smoketest()" && echo "$module: OK"
|
||||
done
|
||||
'
|
||||
|
||||
echo
|
||||
echo "All good!"
|
||||
133
xvfb/build.sh
Executable file
133
xvfb/build.sh
Executable file
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
INSTALL_DIR="$DIR/xvfb/install"
|
||||
|
||||
# macOS: Xvfb is Linux-only. Ship an empty install dir so the wheel still
|
||||
# builds; smoketest() is a no-op on Darwin.
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{bin,lib,share/X11/xkb}
|
||||
echo "xvfb: macOS not supported, shipping empty install dir"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Linux: bundle the Xvfb binary, xkbcomp, xkb keymap data, and the closure
|
||||
# of shared libraries it needs (minus libc/libpthread/etc which the host
|
||||
# always provides). For CI/manylinux we pull from AlmaLinux 8 so the wheel
|
||||
# works on any glibc >= 2.28 distro; on a Debian/Ubuntu dev host we accept
|
||||
# whatever the system has (the local wheel just won't be as portable).
|
||||
if command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y -q xorg-x11-server-Xvfb xorg-x11-xkb-utils xkeyboard-config >/dev/null
|
||||
elif command -v apt-get >/dev/null 2>&1; then
|
||||
if [[ "$(id -u)" -eq 0 ]]; then SUDO=""
|
||||
elif command -v sudo >/dev/null 2>&1; then SUDO=sudo
|
||||
else echo "xvfb: need sudo or root to apt-get install" >&2; exit 1; fi
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq --no-install-recommends \
|
||||
xvfb x11-xkb-utils xkb-data patchelf
|
||||
else
|
||||
echo "xvfb: need dnf or apt-get to fetch upstream Xvfb" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v patchelf >/dev/null 2>&1; then
|
||||
echo "xvfb: patchelf is required but not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{bin,lib,share/X11/xkb}
|
||||
|
||||
# Xvfb may live in /usr/bin (RPM/Debian) — just locate it.
|
||||
XVFB_SRC="$(command -v Xvfb || true)"
|
||||
XKBCOMP_SRC="$(command -v xkbcomp || true)"
|
||||
if [[ -z "$XVFB_SRC" || -z "$XKBCOMP_SRC" ]]; then
|
||||
echo "xvfb: Xvfb or xkbcomp not found after install" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$XVFB_SRC" "$INSTALL_DIR/bin/Xvfb"
|
||||
cp "$XKBCOMP_SRC" "$INSTALL_DIR/bin/xkbcomp"
|
||||
chmod u+w "$INSTALL_DIR/bin/Xvfb" "$INSTALL_DIR/bin/xkbcomp"
|
||||
cp -a /usr/share/X11/xkb/. "$INSTALL_DIR/share/X11/xkb/"
|
||||
|
||||
# Two binary patches to make Xvfb relocatable:
|
||||
#
|
||||
# 1. "/usr/bin" -> "" (null bytes)
|
||||
# Xvfb's compile-time XkbBinDirectory points at /usr/bin and is used to
|
||||
# build an absolute path to xkbcomp. Blanking it makes the spawned
|
||||
# command just "xkbcomp", which popen() then resolves via PATH. Our
|
||||
# Python wrapper prepends the bundled bin/ to PATH.
|
||||
#
|
||||
# 2. "-R%s" -> "-I%s" (in the xkbcomp argv format string)
|
||||
# Xvfb passes its XkbBaseDirectory to xkbcomp via -R, expecting xkbcomp
|
||||
# to chdir there *and* add "." to the include path. xkbcomp 1.4.x only
|
||||
# chdirs — the include-path side was added later. Switching to -I makes
|
||||
# 1.4.2 actually search the path we hand it via -xkbdir.
|
||||
python3 - "$INSTALL_DIR/bin/Xvfb" <<'PY'
|
||||
import sys
|
||||
path = sys.argv[1]
|
||||
with open(path, "r+b") as f:
|
||||
data = bytearray(f.read())
|
||||
|
||||
def replace_unique(needle: bytes, replacement: bytes):
|
||||
assert len(needle) == len(replacement)
|
||||
idx = data.find(needle)
|
||||
if idx < 0:
|
||||
sys.exit(f"could not find {needle!r} in Xvfb binary")
|
||||
if data.find(needle, idx + 1) >= 0:
|
||||
sys.exit(f"multiple {needle!r} matches; refusing to patch")
|
||||
data[idx:idx + len(needle)] = replacement
|
||||
|
||||
replace_unique(b"/usr/bin\x00", b"\x00" * 9)
|
||||
replace_unique(b'"-R%s"\x00', b'"-I%s"\x00')
|
||||
|
||||
with open(path, "wb") as f:
|
||||
f.write(data)
|
||||
PY
|
||||
|
||||
# bundle the shared library closure. Recursively walk ldd output to catch
|
||||
# libs-of-libs (e.g. libXfont2 -> libfontenc -> libbz2). Skip core glibc
|
||||
# pieces; everything else gets copied alongside the binary.
|
||||
declare -A SEEN
|
||||
collect_libs() {
|
||||
local target="$1"
|
||||
while IFS= read -r line; do
|
||||
local lib
|
||||
lib=$(echo "$line" | awk '{print $3}')
|
||||
[[ -z "$lib" || "$lib" == "not" ]] && continue
|
||||
[[ ! -e "$lib" ]] && continue
|
||||
local base
|
||||
base=$(basename "$lib")
|
||||
case "$base" in
|
||||
libc.so.*|libpthread.so.*|libm.so.*|librt.so.*|libdl.so.*|libgcc_s.so.*|libresolv.so.*|libutil.so.*|ld-linux-*.so.*|linux-vdso.so.*|linux-gate.so.*)
|
||||
continue ;;
|
||||
esac
|
||||
[[ -n "${SEEN[$base]:-}" ]] && continue
|
||||
SEEN[$base]=1
|
||||
cp -L "$lib" "$INSTALL_DIR/lib/$base"
|
||||
chmod u+w "$INSTALL_DIR/lib/$base"
|
||||
collect_libs "$INSTALL_DIR/lib/$base"
|
||||
done < <(ldd "$target" 2>/dev/null || true)
|
||||
}
|
||||
collect_libs "$INSTALL_DIR/bin/Xvfb"
|
||||
collect_libs "$INSTALL_DIR/bin/xkbcomp"
|
||||
|
||||
# point the binaries (and the bundled libs) at our private lib dir so they
|
||||
# don't accidentally resolve against an incompatible host copy.
|
||||
patchelf --set-rpath '$ORIGIN/../lib' "$INSTALL_DIR/bin/Xvfb"
|
||||
patchelf --set-rpath '$ORIGIN/../lib' "$INSTALL_DIR/bin/xkbcomp"
|
||||
for so in "$INSTALL_DIR"/lib/*.so*; do
|
||||
patchelf --set-rpath '$ORIGIN' "$so" 2>/dev/null || true
|
||||
done
|
||||
|
||||
strip --strip-unneeded "$INSTALL_DIR/bin/Xvfb" "$INSTALL_DIR/bin/xkbcomp" 2>/dev/null || true
|
||||
find "$INSTALL_DIR/lib" -name '*.so*' -exec strip --strip-unneeded {} + 2>/dev/null || true
|
||||
|
||||
echo "Installed xvfb to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
18
xvfb/pyproject.toml
Normal file
18
xvfb/pyproject.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "xvfb"
|
||||
version = "1.20.11.post1"
|
||||
description = "Xvfb (X virtual framebuffer) headless X server"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[project.scripts]
|
||||
Xvfb = "xvfb:_run_xvfb"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["xvfb*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
xvfb = ["install/**/*"]
|
||||
58
xvfb/setup.py
Normal file
58
xvfb/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 BuildXvfb(build_py):
|
||||
"""Run build.sh to fetch and bundle Xvfb 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": BuildXvfb}
|
||||
|
||||
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()
|
||||
57
xvfb/xvfb/__init__.py
Normal file
57
xvfb/xvfb/__init__.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||
BIN_DIR = os.path.join(DIR, "bin")
|
||||
LIB_DIR = os.path.join(DIR, "lib")
|
||||
XKB_DIR = os.path.join(DIR, "share", "X11", "xkb")
|
||||
|
||||
XVFB_BIN = os.path.join(BIN_DIR, "Xvfb")
|
||||
XKBCOMP_BIN = os.path.join(BIN_DIR, "xkbcomp")
|
||||
|
||||
|
||||
# Common host paths where Mesa DRI drivers (e.g. swrast_dri.so) live. Xvfb
|
||||
# was built on AlmaLinux 8 with /usr/lib64/dri baked in; on other distros
|
||||
# (Debian/Ubuntu in particular) the drivers are elsewhere, and without them
|
||||
# Xvfb fails to bring up a GL provider and silently disables the GLX
|
||||
# extension. Probing the standard locations lets the host's drivers be
|
||||
# found regardless of distro.
|
||||
_DRI_PATHS = (
|
||||
"/usr/lib64/dri",
|
||||
"/usr/lib/x86_64-linux-gnu/dri",
|
||||
"/usr/lib/aarch64-linux-gnu/dri",
|
||||
"/usr/lib/dri",
|
||||
)
|
||||
|
||||
|
||||
def _run_xvfb():
|
||||
# The bundled Xvfb has its compile-time XkbBinDirectory blanked out so it
|
||||
# invokes xkbcomp via PATH lookup; prepend our bin dir so the bundled
|
||||
# xkbcomp wins. -xkbdir points the server at the bundled keymap data.
|
||||
env = os.environ.copy()
|
||||
env["PATH"] = BIN_DIR + os.pathsep + env.get("PATH", "")
|
||||
if "LIBGL_DRIVERS_PATH" not in env:
|
||||
found = [p for p in _DRI_PATHS if os.path.isdir(p)]
|
||||
if found:
|
||||
env["LIBGL_DRIVERS_PATH"] = os.pathsep.join(found)
|
||||
args = sys.argv[1:]
|
||||
if not any(a == "-xkbdir" for a in args):
|
||||
args = ["-xkbdir", XKB_DIR] + args
|
||||
os.execvpe(XVFB_BIN, [XVFB_BIN] + args, env)
|
||||
|
||||
|
||||
def smoketest():
|
||||
if sys.platform == "darwin":
|
||||
return
|
||||
assert os.path.isfile(XVFB_BIN), f"Xvfb not found at {XVFB_BIN}"
|
||||
assert os.path.isfile(XKBCOMP_BIN), f"xkbcomp not found at {XKBCOMP_BIN}"
|
||||
assert os.path.isdir(XKB_DIR), f"xkb data not found at {XKB_DIR}"
|
||||
|
||||
import subprocess
|
||||
# Xvfb prints usage to stderr and exits non-zero on `-help`; the banner
|
||||
# mentions Xvfb-specific flags like -screen and -fbdir. If those appear,
|
||||
# the binary loaded its bundled libs and ran far enough to print help.
|
||||
result = subprocess.run([XVFB_BIN, "-help"], capture_output=True, text=True)
|
||||
output = result.stderr + result.stdout
|
||||
assert "-screen scrn WxHxD" in output, \
|
||||
f"Xvfb -help did not produce expected output: {output}"
|
||||
@@ -7,18 +7,15 @@ cd "$DIR"
|
||||
VERSION="4.3.5"
|
||||
INSTALL_DIR="$DIR/zeromq/install"
|
||||
|
||||
# Idempotent: skip if already built
|
||||
if [ -f "$INSTALL_DIR/lib/libzmq.a" ]; then
|
||||
echo "zeromq already present, skipping build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
# Clone
|
||||
if [ ! -d "libzmq-src" ]; then
|
||||
git clone --depth 1 --branch "v${VERSION}" https://github.com/zeromq/libzmq.git libzmq-src
|
||||
# Clone/update source
|
||||
if [ ! -d "libzmq-src/.git" ]; then
|
||||
rm -rf libzmq-src
|
||||
git clone --depth 1 https://github.com/zeromq/libzmq.git libzmq-src
|
||||
fi
|
||||
git -C libzmq-src fetch --depth 1 origin "v${VERSION}"
|
||||
git -C libzmq-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
PREFIX="$DIR/build/prefix"
|
||||
@@ -30,6 +27,8 @@ cmake -S libzmq-src -B "$DIR/build" \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_C_FLAGS="-fPIC" \
|
||||
-DCMAKE_CXX_FLAGS="-fPIC" \
|
||||
-DWITH_LIBSODIUM=OFF \
|
||||
-DWITH_TLS=OFF \
|
||||
-DWITH_DOCS=OFF \
|
||||
@@ -52,8 +51,5 @@ cp "$PREFIX/lib/libzmq.a" "$INSTALL_DIR/lib/"
|
||||
cp "$PREFIX/include/zmq.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/zmq_utils.h" "$INSTALL_DIR/include/"
|
||||
|
||||
# Clean up
|
||||
rm -rf libzmq-src "$DIR/build"
|
||||
|
||||
echo "Installed zeromq to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -15,9 +15,6 @@ class BuildZeromq(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
marker = os.path.join(pkg_dir, "zeromq", "install", "lib", "libzmq.a")
|
||||
|
||||
if not os.path.exists(marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
|
||||
53
zstd/build.sh
Executable file
53
zstd/build.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
VERSION="1.5.6"
|
||||
INSTALL_DIR="$DIR/zstd/install"
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
# Clone/update source
|
||||
if [ ! -d "zstd-src/.git" ]; then
|
||||
rm -rf zstd-src
|
||||
git clone --depth 1 https://github.com/facebook/zstd.git zstd-src
|
||||
fi
|
||||
git -C zstd-src fetch --depth 1 origin "v${VERSION}"
|
||||
git -C zstd-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
PREFIX="$DIR/build/prefix"
|
||||
mkdir -p "$DIR/build"
|
||||
|
||||
cmake -S zstd-src/build/cmake -B "$DIR/build" \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_C_FLAGS="-fPIC" \
|
||||
-DZSTD_BUILD_PROGRAMS=OFF \
|
||||
-DZSTD_BUILD_TESTS=OFF \
|
||||
-DZSTD_BUILD_CONTRIB=OFF \
|
||||
-DZSTD_BUILD_SHARED=OFF \
|
||||
-DZSTD_BUILD_STATIC=ON
|
||||
|
||||
cmake --build "$DIR/build" -j"$NJOBS"
|
||||
cmake --install "$DIR/build"
|
||||
|
||||
# Copy to package install dir
|
||||
rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||
|
||||
# Library
|
||||
cp "$PREFIX/lib/libzstd.a" "$INSTALL_DIR/lib/"
|
||||
|
||||
# Headers
|
||||
cp "$PREFIX/include/zstd.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/zstd_errors.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/zdict.h" "$INSTALL_DIR/include/"
|
||||
|
||||
echo "Installed zstd to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
15
zstd/pyproject.toml
Normal file
15
zstd/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "zstd"
|
||||
version = "1.5.6"
|
||||
description = "Zstandard compression library (static build)"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["zstd*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
zstd = ["install/**/*"]
|
||||
58
zstd/setup.py
Normal file
58
zstd/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 BuildZstd(build_py):
|
||||
"""Run build.sh to compile zstd 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": BuildZstd}
|
||||
|
||||
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()
|
||||
10
zstd/zstd/__init__.py
Normal file
10
zstd/zstd/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
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")
|
||||
|
||||
|
||||
def smoketest():
|
||||
assert os.path.isfile(os.path.join(LIB_DIR, "libzstd.a")), "libzstd.a not found"
|
||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "zstd.h")), "zstd.h not found"
|
||||
Reference in New Issue
Block a user