Compare commits
22 Commits
json11/v20
...
libusb/v1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14d916d054 | ||
|
|
62afc9ea71 | ||
|
|
c55046f7f0 | ||
|
|
a78417ecd1 | ||
|
|
d14d45aef4 | ||
|
|
224cbbb783 | ||
|
|
53271a60fa | ||
|
|
8d9b59b9d0 | ||
|
|
950d288e77 | ||
|
|
331d94a683 | ||
|
|
2e9aed768a | ||
|
|
65674ad817 | ||
|
|
61379f09ec | ||
|
|
21bb9ab18e | ||
|
|
2341b89849 | ||
|
|
7d158432af | ||
|
|
c81badf4a5 | ||
|
|
122939fdf2 | ||
|
|
9690fd5160 | ||
|
|
c835b206c6 | ||
|
|
70b6bf1c40 | ||
|
|
d67b3e906e |
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@@ -23,13 +23,15 @@ jobs:
|
|||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
key: build-cache-v1-${{ matrix.platform }}-${{ hashFiles('build.sh', 'setup.sh', '*/pyproject.toml', '*/setup.py', '*/build.sh') }}
|
key: build-cache-v2-${{ matrix.platform }}-${{ hashFiles('build.sh', 'setup.sh', '*/pyproject.toml', '*/setup.py', '*/build.sh') }}
|
||||||
restore-keys: build-cache-v1-${{ matrix.platform }}-
|
restore-keys: build-cache-v2-${{ matrix.platform }}-
|
||||||
path: |
|
path: |
|
||||||
.uv-cache
|
.uv-cache
|
||||||
*/*/install
|
*/*/install
|
||||||
*/*/toolchain
|
*/*/toolchain
|
||||||
*/*/bin
|
*/*/bin
|
||||||
|
*/*-src
|
||||||
|
*/build
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
env:
|
env:
|
||||||
MANYLINUX: ${{ runner.os == 'Linux' && '1' || '0' }}
|
MANYLINUX: ${{ runner.os == 'Linux' && '1' || '0' }}
|
||||||
@@ -90,8 +92,8 @@ jobs:
|
|||||||
path: dist
|
path: dist
|
||||||
- uses: actions/cache/restore@v4
|
- uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
key: build-cache-v1-${{ matrix.platform }}-${{ hashFiles('build.sh', 'setup.sh', '*/pyproject.toml', '*/setup.py', '*/build.sh') }}
|
key: build-cache-v2-${{ matrix.platform }}-${{ hashFiles('build.sh', 'setup.sh', '*/pyproject.toml', '*/setup.py', '*/build.sh') }}
|
||||||
restore-keys: build-cache-v1-${{ matrix.platform }}-
|
restore-keys: build-cache-v2-${{ matrix.platform }}-
|
||||||
path: |
|
path: |
|
||||||
.uv-cache
|
.uv-cache
|
||||||
*/*/install
|
*/*/install
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
|||||||
repo/
|
repo/
|
||||||
.venv/
|
.venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
uv.lock
|
||||||
|
|
||||||
# agents
|
# agents
|
||||||
.claude/
|
.claude/
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
"""Shim setup.py: downloads pre-built wheels from GitHub Releases at install time."""
|
"""Shim setup.py: downloads pre-built wheels from GitHub Releases at install time."""
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import time
|
||||||
import zipfile
|
import zipfile
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
from urllib.error import URLError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -32,7 +34,8 @@ PLATFORM_MAP = {
|
|||||||
|
|
||||||
class InstallPrebuilt(build_py):
|
class InstallPrebuilt(build_py):
|
||||||
def run(self):
|
def run(self):
|
||||||
data_dir = os.path.join(_HERE, MODULE, DATADIR)
|
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")):
|
if not os.path.exists(os.path.join(data_dir, "bin")):
|
||||||
key = (platform.system(), platform.machine())
|
key = (platform.system(), platform.machine())
|
||||||
@@ -44,7 +47,16 @@ class InstallPrebuilt(build_py):
|
|||||||
url = f"{REPO_URL}/releases/download/{TAG}/{whl_name}"
|
url = f"{REPO_URL}/releases/download/{TAG}/{whl_name}"
|
||||||
|
|
||||||
print(f"Downloading {url} ...")
|
print(f"Downloading {url} ...")
|
||||||
raw = urlopen(url).read()
|
for attempt in range(3):
|
||||||
|
try:
|
||||||
|
raw = urlopen(url, timeout=60).read()
|
||||||
|
break
|
||||||
|
except (URLError, OSError) as e:
|
||||||
|
if attempt == 2:
|
||||||
|
raise
|
||||||
|
wait = 2 ** attempt
|
||||||
|
print(f"Download failed ({e}), retrying in {wait}s ...")
|
||||||
|
time.sleep(wait)
|
||||||
|
|
||||||
print(f"Extracting {DATADIR} ...")
|
print(f"Extracting {DATADIR} ...")
|
||||||
with zipfile.ZipFile(BytesIO(raw)) as zf:
|
with zipfile.ZipFile(BytesIO(raw)) as zf:
|
||||||
@@ -67,6 +79,24 @@ class InstallPrebuilt(build_py):
|
|||||||
os.chmod(dest, 0o755)
|
os.chmod(dest, 0o755)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Also extract compiled extension modules (.so)
|
||||||
|
ext_prefix = f"{MODULE}/"
|
||||||
|
ext_alt_prefix = f"{MODULE}-{VERSION}.data/purelib/{MODULE}/"
|
||||||
|
for info in zf.infolist():
|
||||||
|
if not info.filename.endswith('.so'):
|
||||||
|
continue
|
||||||
|
for p in (ext_prefix, ext_alt_prefix):
|
||||||
|
if info.filename.startswith(p):
|
||||||
|
rel = info.filename[len(p):]
|
||||||
|
if rel and '/' not in rel:
|
||||||
|
dest = os.path.join(module_dir, 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)
|
||||||
|
break
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
build.sh
10
build.sh
@@ -34,6 +34,9 @@ fi
|
|||||||
if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
||||||
export PATH="/opt/python/cp312-cp312/bin:$PATH"
|
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
|
./setup.sh
|
||||||
|
|
||||||
if [[ -z "${BUILD_SH_REUSE_MANYLINUX_ARTIFACTS:-}" ]]; then
|
if [[ -z "${BUILD_SH_REUSE_MANYLINUX_ARTIFACTS:-}" ]]; then
|
||||||
@@ -45,10 +48,15 @@ if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export CMAKE_C_COMPILER_LAUNCHER=ccache
|
||||||
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
|
|
||||||
echo "Building workspace packages into dist"
|
echo "Building workspace packages into dist"
|
||||||
START_SECS=$SECONDS
|
START_SECS=$SECONDS
|
||||||
|
|
||||||
uv build --all-packages --wheel --out-dir dist --no-create-gitignore --no-build-logs
|
mkdir -p dist/
|
||||||
|
rm -rf dist/*
|
||||||
|
uv build --all-packages --wheel --out-dir dist --no-create-gitignore
|
||||||
|
|
||||||
if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
if [[ -n "${BUILD_SH_IN_MANYLINUX:-}" ]]; then
|
||||||
VENV_DIR="$ROOT_DIR/.venv-manylinux"
|
VENV_DIR="$ROOT_DIR/.venv-manylinux"
|
||||||
|
|||||||
@@ -4,24 +4,19 @@ set -e
|
|||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
VERSION="1.0.8"
|
VERSION="bzip2-1.0.8"
|
||||||
INSTALL_DIR="$DIR/bzip2/install"
|
INSTALL_DIR="$DIR/bzip2/install"
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libbz2.a" ]; then
|
|
||||||
echo "bzip2 already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
CC="ccache ${CC:-cc}"
|
||||||
|
|
||||||
# Download
|
# Clone/update source
|
||||||
if [ ! -d "bzip2-src" ]; then
|
if [ ! -d "bzip2-src/.git" ]; then
|
||||||
curl -L "https://sourceware.org/pub/bzip2/bzip2-${VERSION}.tar.gz" -o bzip2.tar.gz
|
rm -rf bzip2-src
|
||||||
mkdir -p bzip2-src
|
git clone --depth 1 https://gitlab.com/bzip2/bzip2.git bzip2-src
|
||||||
tar xzf bzip2.tar.gz -C bzip2-src --strip-components=1
|
|
||||||
rm bzip2.tar.gz
|
|
||||||
fi
|
fi
|
||||||
|
git -C bzip2-src fetch --depth 1 origin "$VERSION"
|
||||||
|
git -C bzip2-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
# Build static library with -fPIC
|
# Build static library with -fPIC
|
||||||
cd bzip2-src
|
cd bzip2-src
|
||||||
@@ -38,8 +33,5 @@ cp bzip2-src/libbz2.a "$INSTALL_DIR/lib/"
|
|||||||
# Headers
|
# Headers
|
||||||
cp bzip2-src/bzlib.h "$INSTALL_DIR/include/"
|
cp bzip2-src/bzlib.h "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf bzip2-src
|
|
||||||
|
|
||||||
echo "Installed bzip2 to $INSTALL_DIR"
|
echo "Installed bzip2 to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildBzip2(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "bzip2", "install", "lib", "libbz2.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,15 @@ cd "$DIR"
|
|||||||
VERSION="1.0.1"
|
VERSION="1.0.1"
|
||||||
INSTALL_DIR="$DIR/capnproto/install"
|
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)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Clone
|
# Clone/update source
|
||||||
if [ ! -d "capnproto-src" ]; then
|
if [ ! -d "capnproto-src/.git" ]; then
|
||||||
git clone --depth 1 --branch "v${VERSION}" https://github.com/capnproto/capnproto.git capnproto-src
|
rm -rf capnproto-src
|
||||||
|
git clone --depth 1 https://github.com/capnproto/capnproto.git capnproto-src
|
||||||
fi
|
fi
|
||||||
|
git -C capnproto-src fetch --depth 1 origin "v${VERSION}"
|
||||||
|
git -C capnproto-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
@@ -64,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
|
ar d "$INSTALL_DIR/lib/libkj.a" "$obj" 2>/dev/null || true
|
||||||
done
|
done
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf capnproto-src "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed capnproto to $INSTALL_DIR"
|
echo "Installed capnproto to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildCapnproto(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "capnproto", "install", "bin", "capnp")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,16 @@ cd "$DIR"
|
|||||||
VERSION="2.16.0"
|
VERSION="2.16.0"
|
||||||
INSTALL_DIR="$DIR/cppcheck/install"
|
INSTALL_DIR="$DIR/cppcheck/install"
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -x "$INSTALL_DIR/cppcheck" ]; then
|
|
||||||
echo "cppcheck already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
CXX="ccache ${CXX:-c++}"
|
||||||
|
|
||||||
# Clone
|
# Clone/update source
|
||||||
if [ ! -d "cppcheck-src" ]; then
|
if [ ! -d "cppcheck-src/.git" ]; then
|
||||||
git clone --depth 1 --branch "$VERSION" https://github.com/danmar/cppcheck.git cppcheck-src
|
rm -rf cppcheck-src
|
||||||
|
git clone --depth 1 https://github.com/danmar/cppcheck.git cppcheck-src
|
||||||
fi
|
fi
|
||||||
|
git -C cppcheck-src fetch --depth 1 origin "$VERSION"
|
||||||
|
git -C cppcheck-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
cd cppcheck-src
|
cd cppcheck-src
|
||||||
@@ -35,8 +33,5 @@ cp -r cppcheck-src/cfg "$INSTALL_DIR/"
|
|||||||
cp -r cppcheck-src/platforms "$INSTALL_DIR/"
|
cp -r cppcheck-src/platforms "$INSTALL_DIR/"
|
||||||
strip "$INSTALL_DIR/cppcheck" 2>/dev/null || true
|
strip "$INSTALL_DIR/cppcheck" 2>/dev/null || true
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf cppcheck-src
|
|
||||||
|
|
||||||
echo "Installed cppcheck to $INSTALL_DIR"
|
echo "Installed cppcheck to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildCppcheck(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "cppcheck", "install", "cppcheck")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -7,28 +7,19 @@ cd "$DIR"
|
|||||||
VERSION="3.4.0"
|
VERSION="3.4.0"
|
||||||
INSTALL_DIR="$DIR/eigen/install"
|
INSTALL_DIR="$DIR/eigen/install"
|
||||||
|
|
||||||
# Idempotent: skip if already present
|
# Clone/update source
|
||||||
if [ -d "$INSTALL_DIR/eigen3/Eigen" ]; then
|
if [ ! -d "eigen-src/.git" ]; then
|
||||||
echo "eigen already present, skipping download."
|
rm -rf eigen-src
|
||||||
exit 0
|
git clone --depth 1 https://gitlab.com/libeigen/eigen.git eigen-src
|
||||||
fi
|
fi
|
||||||
|
git -C eigen-src fetch --depth 1 origin "$VERSION"
|
||||||
|
git -C eigen-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
TARBALL="eigen-${VERSION}.tar.gz"
|
# Copy headers
|
||||||
URL="https://gitlab.com/libeigen/eigen/-/archive/${VERSION}/${TARBALL}"
|
|
||||||
|
|
||||||
echo "Downloading Eigen ${VERSION} ..."
|
|
||||||
curl -fSL -o "$TARBALL" "$URL"
|
|
||||||
|
|
||||||
echo "Extracting headers ..."
|
|
||||||
rm -rf "$INSTALL_DIR"
|
rm -rf "$INSTALL_DIR"
|
||||||
mkdir -p "$INSTALL_DIR/eigen3"
|
mkdir -p "$INSTALL_DIR/eigen3"
|
||||||
|
cp -r eigen-src/Eigen "$INSTALL_DIR/eigen3/"
|
||||||
# Extract only the Eigen/ and unsupported/Eigen/ header directories
|
cp -r eigen-src/unsupported "$INSTALL_DIR/eigen3/"
|
||||||
tar --strip-components=1 -xzf "$TARBALL" -C "$INSTALL_DIR/eigen3" \
|
|
||||||
"eigen-${VERSION}/Eigen" \
|
|
||||||
"eigen-${VERSION}/unsupported"
|
|
||||||
|
|
||||||
rm -f "$TARBALL"
|
|
||||||
|
|
||||||
echo "Installed eigen to $INSTALL_DIR"
|
echo "Installed eigen to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildEigen(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "eigen", "install", "eigen3", "Eigen")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.isdir(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -5,23 +5,22 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
FFMPEG_VERSION="7.1"
|
FFMPEG_VERSION="7.1"
|
||||||
|
ZLIB_VERSION="da607da739fa6047df13e66a2af6b8bec7c2a498" # v1.3.2
|
||||||
|
X264_BRANCH="stable"
|
||||||
INSTALL_DIR="$DIR/ffmpeg/install"
|
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)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
CC="ccache ${CC:-cc}"
|
||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
mkdir -p "$DIR/build"
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
# --- Build zlib (static) ---
|
# --- Build zlib (static) ---
|
||||||
if [ ! -d "zlib-src" ]; then
|
if [ ! -d "zlib-src/.git" ]; then
|
||||||
git clone https://github.com/madler/zlib.git zlib-src
|
rm -rf zlib-src
|
||||||
git -C zlib-src checkout da607da739fa6047df13e66a2af6b8bec7c2a498 # pin to v1.3.2
|
git clone --depth 1 https://github.com/madler/zlib.git zlib-src
|
||||||
fi
|
fi
|
||||||
|
git -C zlib-src fetch --depth 1 origin "$ZLIB_VERSION"
|
||||||
|
git -C zlib-src checkout --force "$ZLIB_VERSION"
|
||||||
|
|
||||||
cd zlib-src
|
cd zlib-src
|
||||||
./configure --prefix="$PREFIX" --static
|
./configure --prefix="$PREFIX" --static
|
||||||
@@ -30,9 +29,12 @@ make install
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
# --- Build x264 (static) ---
|
# --- Build x264 (static) ---
|
||||||
if [ ! -d "x264-src" ]; then
|
if [ ! -d "x264-src/.git" ]; then
|
||||||
git clone --depth 1 --branch stable https://code.videolan.org/videolan/x264.git x264-src
|
rm -rf x264-src
|
||||||
|
git clone --depth 1 https://code.videolan.org/videolan/x264.git x264-src
|
||||||
fi
|
fi
|
||||||
|
git -C x264-src fetch --depth 1 origin "$X264_BRANCH"
|
||||||
|
git -C x264-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
cd x264-src
|
cd x264-src
|
||||||
CFLAGS="-fno-finite-math-only" ./configure \
|
CFLAGS="-fno-finite-math-only" ./configure \
|
||||||
@@ -47,13 +49,17 @@ make install
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
# --- Build FFmpeg ---
|
# --- Build FFmpeg ---
|
||||||
if [ ! -d "ffmpeg-src" ]; then
|
if [ ! -d "ffmpeg-src/.git" ]; then
|
||||||
git clone --depth 1 --branch "n${FFMPEG_VERSION}" https://github.com/FFmpeg/FFmpeg.git ffmpeg-src
|
rm -rf ffmpeg-src
|
||||||
|
git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg-src
|
||||||
fi
|
fi
|
||||||
|
git -C ffmpeg-src fetch --depth 1 origin "n${FFMPEG_VERSION}"
|
||||||
|
git -C ffmpeg-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
cd ffmpeg-src
|
cd ffmpeg-src
|
||||||
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" \
|
||||||
./configure \
|
./configure \
|
||||||
|
--cc="${CC:-cc}" \
|
||||||
--prefix="$PREFIX" \
|
--prefix="$PREFIX" \
|
||||||
--enable-gpl \
|
--enable-gpl \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
@@ -100,8 +106,5 @@ done
|
|||||||
# Strip binaries
|
# Strip binaries
|
||||||
strip "$INSTALL_DIR/bin/ffmpeg" "$INSTALL_DIR/bin/ffprobe" 2>/dev/null || true
|
strip "$INSTALL_DIR/bin/ffmpeg" "$INSTALL_DIR/bin/ffprobe" 2>/dev/null || true
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf zlib-src x264-src ffmpeg-src "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed ffmpeg to $INSTALL_DIR"
|
echo "Installed ffmpeg to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildFFmpeg(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "ffmpeg", "install", "bin", "ffmpeg")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ TOOLCHAIN_BASE="arm-gnu-toolchain-${TOOLCHAIN_VERSION}"
|
|||||||
GCC_VERSION="13.2.1"
|
GCC_VERSION="13.2.1"
|
||||||
|
|
||||||
INSTALL_DIR="$DIR/gcc_arm_none_eabi/toolchain"
|
INSTALL_DIR="$DIR/gcc_arm_none_eabi/toolchain"
|
||||||
|
VERSION_FILE="$INSTALL_DIR/.version"
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
# Skip if already at correct version
|
||||||
if [ -x "$INSTALL_DIR/bin/arm-none-eabi-gcc" ]; then
|
if [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$TOOLCHAIN_VERSION" ]; then
|
||||||
echo "Toolchain already present, skipping download."
|
echo "Toolchain $TOOLCHAIN_VERSION already present, skipping."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -112,6 +113,7 @@ find "$INSTALL_DIR" -type f \( -executable -o -name '*.so' \) -exec strip {} + 2
|
|||||||
# --- clean up download artifacts ---
|
# --- clean up download artifacts ---
|
||||||
rm -rf "$EXTRACT_DIR"
|
rm -rf "$EXTRACT_DIR"
|
||||||
rm -f "$TARBALL"
|
rm -f "$TARBALL"
|
||||||
|
echo "$TOOLCHAIN_VERSION" > "$VERSION_FILE"
|
||||||
|
|
||||||
echo "Installed to $INSTALL_DIR"
|
echo "Installed to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
|
|
||||||
from setuptools.command.build_py import build_py
|
from setuptools.command.build_py import build_py
|
||||||
from setuptools.dist import Distribution
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from wheel.bdist_wheel import bdist_wheel
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
@@ -17,13 +15,8 @@ class BuildToolchain(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
toolchain_marker = os.path.join(
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
pkg_dir, "gcc_arm_none_eabi", "toolchain", "bin", "arm-none-eabi-gcc"
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ cd "$DIR"
|
|||||||
|
|
||||||
VERSION="3.6.1"
|
VERSION="3.6.1"
|
||||||
INSTALL_DIR="$DIR/git_lfs/bin"
|
INSTALL_DIR="$DIR/git_lfs/bin"
|
||||||
|
VERSION_FILE="$INSTALL_DIR/.version"
|
||||||
|
|
||||||
# Idempotent: skip if already present
|
# Skip if already at correct version
|
||||||
if [ -x "$INSTALL_DIR/git-lfs" ]; then
|
if [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$VERSION" ]; then
|
||||||
echo "git-lfs already present, skipping download."
|
echo "git-lfs $VERSION already present, skipping."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ fi
|
|||||||
chmod +x "$INSTALL_DIR/git-lfs"
|
chmod +x "$INSTALL_DIR/git-lfs"
|
||||||
|
|
||||||
rm -f "$FILENAME"
|
rm -f "$FILENAME"
|
||||||
|
echo "$VERSION" > "$VERSION_FILE"
|
||||||
|
|
||||||
echo "Installed git-lfs to $INSTALL_DIR"
|
echo "Installed git-lfs to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildGitLfs(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "git_lfs", "bin", "git-lfs")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
109
imgui/build.sh
Executable file
109
imgui/build.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/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"
|
||||||
|
# rlImGui
|
||||||
|
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
|
||||||
|
# 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 rlimgui
|
||||||
|
if [ ! -d "rlimgui-src/.git" ]; then
|
||||||
|
rm -rf rlimgui-src
|
||||||
|
git clone --depth 1 https://github.com/raylib-extras/rlImGui.git rlimgui-src
|
||||||
|
fi
|
||||||
|
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
|
||||||
|
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
|
||||||
|
|
||||||
|
# Clone/update GLFW
|
||||||
|
if [ ! -d "glfw-src/.git" ]; then
|
||||||
|
rm -rf glfw-src
|
||||||
|
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
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src" "$INSTALL_DIR/lib"
|
||||||
|
|
||||||
|
# imgui
|
||||||
|
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
||||||
|
imgui-src/imstb_rectpack.h imgui-src/imstb_textedit.h imgui-src/imstb_truetype.h \
|
||||||
|
"$INSTALL_DIR/include/"
|
||||||
|
cp imgui-src/imgui.cpp imgui-src/imgui_draw.cpp imgui-src/imgui_tables.cpp \
|
||||||
|
imgui-src/imgui_widgets.cpp imgui-src/imgui_demo.cpp \
|
||||||
|
"$INSTALL_DIR/src/"
|
||||||
|
cp imgui-src/backends/imgui_impl_opengl3.h imgui-src/backends/imgui_impl_opengl3_loader.h \
|
||||||
|
imgui-src/backends/imgui_impl_glfw.h \
|
||||||
|
"$INSTALL_DIR/include/"
|
||||||
|
cp imgui-src/backends/imgui_impl_opengl3.cpp imgui-src/backends/imgui_impl_glfw.cpp \
|
||||||
|
"$INSTALL_DIR/src/"
|
||||||
|
|
||||||
|
# implot
|
||||||
|
cp implot-src/implot.h implot-src/implot_internal.h "$INSTALL_DIR/include/"
|
||||||
|
cp implot-src/implot.cpp implot-src/implot_items.cpp "$INSTALL_DIR/src/"
|
||||||
|
|
||||||
|
# rlimgui
|
||||||
|
cp rlimgui-src/rlImGui.h rlimgui-src/rlImGuiColors.h rlimgui-src/imgui_impl_raylib.h \
|
||||||
|
"$INSTALL_DIR/include/"
|
||||||
|
cp rlimgui-src/extras/FA6FreeSolidFontData.h rlimgui-src/extras/IconsFontAwesome6.h \
|
||||||
|
"$INSTALL_DIR/include/extras/"
|
||||||
|
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
|
||||||
|
|
||||||
|
# glfw
|
||||||
|
cp glfw-src/build/src/libglfw3.a "$INSTALL_DIR/lib/"
|
||||||
|
cp -r glfw-src/include/GLFW "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
|
echo "Installed imgui to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
13
imgui/imgui/__init__.py
Normal file
13
imgui/imgui/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
SRC_DIR = os.path.join(DIR, "src")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
||||||
|
assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found"
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libglfw3.a")), "libglfw3.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "GLFW", "glfw3.h")), "GLFW/glfw3.h not found"
|
||||||
@@ -3,13 +3,13 @@ requires = ["setuptools>=64", "wheel"]
|
|||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "openssl3"
|
name = "imgui"
|
||||||
version = "3.4.1"
|
version = "1.92.7"
|
||||||
description = "OpenSSL cryptography library (static build)"
|
description = "Dear ImGui + ImPlot + rlImGui + GLFW 3.4 (static)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
include = ["openssl3*"]
|
include = ["imgui*"]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
openssl3 = ["install/**/*"]
|
imgui = ["install/**/*"]
|
||||||
@@ -10,21 +10,18 @@ except ImportError:
|
|||||||
bdist_wheel = None
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
class BuildOpenssl(build_py):
|
class BuildImgui(build_py):
|
||||||
"""Run build.sh to compile OpenSSL before collecting package data."""
|
"""Run build.sh to download imgui sources before collecting package data."""
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "openssl3", "install", "lib", "libcrypto.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
cmdclass = {"build_py": BuildOpenssl}
|
cmdclass = {"build_py": BuildImgui}
|
||||||
|
|
||||||
if bdist_wheel is not None:
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
@@ -6,36 +6,26 @@ cd "$DIR"
|
|||||||
|
|
||||||
VERSION="db00e9369a92aa74bf630a2ffb092a4b0b132c01"
|
VERSION="db00e9369a92aa74bf630a2ffb092a4b0b132c01"
|
||||||
INSTALL_DIR="$DIR/json11/install"
|
INSTALL_DIR="$DIR/json11/install"
|
||||||
VERSION_FILE="$INSTALL_DIR/VERSION"
|
CXX="ccache ${CXX:-c++}"
|
||||||
|
|
||||||
# Idempotent: skip if already built at this source revision.
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libjson11.a" ] && [ -f "$INSTALL_DIR/include/json11/json11.hpp" ] && \
|
|
||||||
[ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$VERSION" ]; then
|
|
||||||
echo "json11 already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$DIR/json11-src/.git" ]; then
|
if [ ! -d "$DIR/json11-src/.git" ]; then
|
||||||
git clone https://github.com/dropbox/json11.git json11-src
|
git clone --depth 1 https://github.com/dropbox/json11.git json11-src
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git -C json11-src fetch --force origin
|
git -C json11-src fetch --depth 1 origin "$VERSION"
|
||||||
git -C json11-src checkout --force "$VERSION"
|
git -C json11-src checkout --force "$VERSION"
|
||||||
|
|
||||||
BUILD_DIR="$DIR/build"
|
BUILD_DIR="$DIR/build"
|
||||||
rm -rf "$BUILD_DIR" "$INSTALL_DIR"
|
mkdir -p "$BUILD_DIR"
|
||||||
mkdir -p "$BUILD_DIR" "$INSTALL_DIR/lib" "$INSTALL_DIR/include/json11"
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/lib" "$INSTALL_DIR/include/json11"
|
||||||
|
|
||||||
CXX="${CXX:-c++}"
|
CXX="${CXX:-c++}"
|
||||||
AR="${AR:-ar}"
|
AR="${AR:-ar}"
|
||||||
|
|
||||||
"$CXX" -std=c++11 -fPIC -O2 -c "$DIR/json11-src/json11.cpp" -o "$BUILD_DIR/json11.o"
|
$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"
|
"$AR" rcs "$INSTALL_DIR/lib/libjson11.a" "$BUILD_DIR/json11.o"
|
||||||
cp "$DIR/json11-src/json11.hpp" "$INSTALL_DIR/include/json11/json11.hpp"
|
cp "$DIR/json11-src/json11.hpp" "$INSTALL_DIR/include/json11/json11.hpp"
|
||||||
echo "$VERSION" > "$VERSION_FILE"
|
|
||||||
|
|
||||||
# Keep workspace small and deterministic across builds.
|
|
||||||
rm -rf "$DIR/json11-src" "$BUILD_DIR"
|
|
||||||
|
|
||||||
echo "Installed json11 to $INSTALL_DIR"
|
echo "Installed json11 to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildJson11(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "json11", "install", "lib", "libjson11.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,15 @@ cd "$DIR"
|
|||||||
VERSION="3.1.0"
|
VERSION="3.1.0"
|
||||||
INSTALL_DIR="$DIR/libjpeg/install"
|
INSTALL_DIR="$DIR/libjpeg/install"
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libjpeg.a" ]; then
|
|
||||||
echo "libjpeg already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Clone
|
# Clone/update source
|
||||||
if [ ! -d "libjpeg-turbo-src" ]; then
|
if [ ! -d "libjpeg-turbo-src/.git" ]; then
|
||||||
git clone --depth 1 --branch "${VERSION}" https://github.com/libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo-src
|
rm -rf libjpeg-turbo-src
|
||||||
|
git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo-src
|
||||||
fi
|
fi
|
||||||
|
git -C libjpeg-turbo-src fetch --depth 1 origin "${VERSION}"
|
||||||
|
git -C libjpeg-turbo-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
@@ -50,8 +47,5 @@ cp "$PREFIX/include/jconfig.h" "$INSTALL_DIR/include/"
|
|||||||
cp "$PREFIX/include/jerror.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/jerror.h" "$INSTALL_DIR/include/"
|
||||||
cp "$PREFIX/include/jmorecfg.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/jmorecfg.h" "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf libjpeg-turbo-src "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed libjpeg to $INSTALL_DIR"
|
echo "Installed libjpeg to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildLibjpeg(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "libjpeg", "install", "lib", "libjpeg.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
52
libusb/build.sh
Executable file
52
libusb/build.sh
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="1.0.29"
|
||||||
|
ARCHIVE="libusb-${VERSION}.tar.bz2"
|
||||||
|
URL="https://github.com/libusb/libusb/releases/download/v${VERSION}/${ARCHIVE}"
|
||||||
|
INSTALL_DIR="$DIR/libusb/install"
|
||||||
|
SRC_DIR="$DIR/libusb-src"
|
||||||
|
VERSION_FILE="$SRC_DIR/.version"
|
||||||
|
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
export CC="ccache ${CC:-cc}"
|
||||||
|
|
||||||
|
if [ ! -f "$VERSION_FILE" ] || [ "$(cat "$VERSION_FILE")" != "$VERSION" ]; then
|
||||||
|
rm -rf "$SRC_DIR"
|
||||||
|
mkdir -p "$SRC_DIR"
|
||||||
|
curl -fSL "$URL" | tar xj --strip-components=1 -C "$SRC_DIR"
|
||||||
|
echo "$VERSION" > "$VERSION_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PREFIX="$DIR/build/prefix"
|
||||||
|
rm -rf "$DIR/build"
|
||||||
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
|
CONFIGURE_ARGS=(
|
||||||
|
--prefix="$PREFIX"
|
||||||
|
--disable-shared
|
||||||
|
--enable-static
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
|
CONFIGURE_ARGS+=(--disable-udev)
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$SRC_DIR"
|
||||||
|
CFLAGS="-O2 -fPIC" ./configure "${CONFIGURE_ARGS[@]}"
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/lib/pkgconfig" "$INSTALL_DIR/include/libusb-1.0"
|
||||||
|
|
||||||
|
cp "$PREFIX/lib/libusb-1.0.a" "$INSTALL_DIR/lib/"
|
||||||
|
cp "$PREFIX/lib/pkgconfig/libusb-1.0.pc" "$INSTALL_DIR/lib/pkgconfig/"
|
||||||
|
cp "$PREFIX/include/libusb-1.0/libusb.h" "$INSTALL_DIR/include/libusb-1.0/"
|
||||||
|
|
||||||
|
echo "Installed libusb to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
12
libusb/libusb/__init__.py
Normal file
12
libusb/libusb/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
PKGCONFIG_DIR = os.path.join(LIB_DIR, "pkgconfig")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libusb-1.0.a")), "libusb-1.0.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "libusb-1.0", "libusb.h")), "libusb.h not found"
|
||||||
|
assert os.path.isfile(os.path.join(PKGCONFIG_DIR, "libusb-1.0.pc")), "libusb-1.0.pc not found"
|
||||||
15
libusb/pyproject.toml
Normal file
15
libusb/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "libusb"
|
||||||
|
version = "1.0.29"
|
||||||
|
description = "libusb USB device access library (static build)"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["libusb*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
libusb = ["install/**/*"]
|
||||||
58
libusb/setup.py
Normal file
58
libusb/setup.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
|
try:
|
||||||
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
|
except ImportError:
|
||||||
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
|
class BuildLibusb(build_py):
|
||||||
|
"""Run build.sh to compile libusb before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildLibusb}
|
||||||
|
|
||||||
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
|
class PlatformWheel(bdist_wheel):
|
||||||
|
"""Produce a platform-specific, Python-version-agnostic wheel."""
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
super().finalize_options()
|
||||||
|
self.root_is_pure = False
|
||||||
|
|
||||||
|
def get_tag(self):
|
||||||
|
system = platform.system()
|
||||||
|
machine = platform.machine()
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
plat = f"linux_{machine}"
|
||||||
|
elif system == "Darwin":
|
||||||
|
plat = "macosx_11_0_arm64"
|
||||||
|
else:
|
||||||
|
plat = f"{system.lower()}_{machine}"
|
||||||
|
|
||||||
|
return "py3", "none", plat
|
||||||
|
|
||||||
|
cmdclass["bdist_wheel"] = PlatformWheel
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
@@ -6,25 +6,17 @@ cd "$DIR"
|
|||||||
|
|
||||||
VERSION="6067afde563c3946eebd94f146b3824ab7a97a9c"
|
VERSION="6067afde563c3946eebd94f146b3824ab7a97a9c"
|
||||||
INSTALL_DIR="$DIR/libyuv/install"
|
INSTALL_DIR="$DIR/libyuv/install"
|
||||||
VERSION_FILE="$INSTALL_DIR/VERSION"
|
|
||||||
|
|
||||||
# Idempotent: skip if already built at this source revision.
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libyuv.a" ] && [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$VERSION" ]; then
|
|
||||||
echo "libyuv already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
if [ ! -d "libyuv-src/.git" ]; then
|
if [ ! -d "libyuv-src/.git" ]; then
|
||||||
git clone https://chromium.googlesource.com/libyuv/libyuv libyuv-src
|
git clone --depth 1 https://chromium.googlesource.com/libyuv/libyuv libyuv-src
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git -C libyuv-src fetch --force origin
|
git -C libyuv-src fetch --depth 1 origin "$VERSION"
|
||||||
git -C libyuv-src checkout --force "$VERSION"
|
git -C libyuv-src checkout --force "$VERSION"
|
||||||
|
|
||||||
BUILD_DIR="$DIR/build/build"
|
BUILD_DIR="$DIR/build"
|
||||||
rm -rf "$DIR/build"
|
|
||||||
mkdir -p "$BUILD_DIR"
|
mkdir -p "$BUILD_DIR"
|
||||||
|
|
||||||
cmake -S "$DIR/libyuv-src" -B "$BUILD_DIR" \
|
cmake -S "$DIR/libyuv-src" -B "$BUILD_DIR" \
|
||||||
@@ -47,10 +39,6 @@ rm -rf "$INSTALL_DIR"
|
|||||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||||
cp "$LIBYUV_STATIC" "$INSTALL_DIR/lib/libyuv.a"
|
cp "$LIBYUV_STATIC" "$INSTALL_DIR/lib/libyuv.a"
|
||||||
cp -r "$DIR/libyuv-src/include/." "$INSTALL_DIR/include/"
|
cp -r "$DIR/libyuv-src/include/." "$INSTALL_DIR/include/"
|
||||||
echo "$VERSION" > "$VERSION_FILE"
|
|
||||||
|
|
||||||
# Keep workspace small and deterministic across builds.
|
|
||||||
rm -rf "$DIR/libyuv-src" "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed libyuv to $INSTALL_DIR"
|
echo "Installed libyuv to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildLibyuv(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "libyuv", "install", "lib", "libyuv.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
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/**/*"]
|
||||||
@@ -10,21 +10,18 @@ except ImportError:
|
|||||||
bdist_wheel = None
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
class BuildPython3Dev(build_py):
|
class BuildNanosvg(build_py):
|
||||||
"""Run build.sh to download CPython headers before collecting package data."""
|
"""Run build.sh to download nanosvg headers before collecting package data."""
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "python3_dev", "install", "include", "Python.h")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
cmdclass = {"build_py": BuildPython3Dev}
|
cmdclass = {"build_py": BuildNanosvg}
|
||||||
|
|
||||||
if bdist_wheel is not None:
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
@@ -6,31 +6,25 @@ cd "$DIR"
|
|||||||
|
|
||||||
VERSION="6.5"
|
VERSION="6.5"
|
||||||
INSTALL_DIR="$DIR/ncurses/install"
|
INSTALL_DIR="$DIR/ncurses/install"
|
||||||
|
VERSION_FILE="$DIR/ncurses-src/.version"
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libncurses.a" ]; then
|
|
||||||
echo "ncurses already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
export CC="ccache ${CC:-cc}"
|
||||||
|
|
||||||
# Download
|
# Download tarball (v6.5 tag doesn't exist on the GitHub mirror)
|
||||||
TARBALL="ncurses-${VERSION}.tar.gz"
|
if [ ! -f "$VERSION_FILE" ] || [ "$(cat "$VERSION_FILE")" != "$VERSION" ]; then
|
||||||
if [ ! -f "$TARBALL" ]; then
|
rm -rf ncurses-src
|
||||||
curl -fsSL "https://ftp.gnu.org/gnu/ncurses/${TARBALL}" -o "$TARBALL"
|
mkdir -p ncurses-src
|
||||||
fi
|
curl -fSL "https://ftp.gnu.org/gnu/ncurses/ncurses-${VERSION}.tar.gz" \
|
||||||
|
| tar xz --strip-components=1 -C ncurses-src
|
||||||
# Extract
|
echo "$VERSION" > "$VERSION_FILE"
|
||||||
if [ ! -d "ncurses-${VERSION}" ]; then
|
|
||||||
tar xf "$TARBALL"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
mkdir -p "$DIR/build"
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
cd "ncurses-${VERSION}"
|
cd ncurses-src
|
||||||
CFLAGS="-fPIC" ./configure \
|
CFLAGS="-fPIC" ./configure \
|
||||||
--prefix="$PREFIX" \
|
--prefix="$PREFIX" \
|
||||||
--without-shared \
|
--without-shared \
|
||||||
@@ -66,8 +60,5 @@ cp "$PREFIX/include/unctrl.h" "$INSTALL_DIR/include/"
|
|||||||
cp "$PREFIX/include/term.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/term.h" "$INSTALL_DIR/include/"
|
||||||
cp "$PREFIX/include/termcap.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/termcap.h" "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf "ncurses-${VERSION}" "$TARBALL" "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed ncurses to $INSTALL_DIR"
|
echo "Installed ncurses to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildNcurses(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "ncurses", "install", "lib", "libncurses.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|
||||||
cd "$DIR"
|
|
||||||
|
|
||||||
VERSION="3.4.1"
|
|
||||||
INSTALL_DIR="$DIR/openssl3/install"
|
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libcrypto.a" ]; then
|
|
||||||
echo "openssl already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
|
||||||
|
|
||||||
# Download
|
|
||||||
TARBALL="openssl-${VERSION}.tar.gz"
|
|
||||||
if [ ! -d "openssl-src" ]; then
|
|
||||||
curl -fSL -o "$TARBALL" "https://github.com/openssl/openssl/releases/download/openssl-${VERSION}/${TARBALL}"
|
|
||||||
mkdir -p openssl-src
|
|
||||||
tar -xf "$TARBALL" -C openssl-src --strip-components=1
|
|
||||||
rm -f "$TARBALL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure
|
|
||||||
PREFIX="$DIR/build/prefix"
|
|
||||||
cd openssl-src
|
|
||||||
|
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
|
||||||
TARGET="darwin64-arm64-cc"
|
|
||||||
else
|
|
||||||
MACHINE="$(uname -m)"
|
|
||||||
if [ "$MACHINE" = "x86_64" ]; then
|
|
||||||
TARGET="linux-x86_64"
|
|
||||||
elif [ "$MACHINE" = "aarch64" ]; then
|
|
||||||
TARGET="linux-aarch64"
|
|
||||||
else
|
|
||||||
TARGET="linux-${MACHINE}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
./Configure "$TARGET" \
|
|
||||||
--prefix="$PREFIX" \
|
|
||||||
--libdir=lib \
|
|
||||||
no-shared \
|
|
||||||
no-tests \
|
|
||||||
no-docs \
|
|
||||||
no-apps \
|
|
||||||
-fPIC \
|
|
||||||
-Os
|
|
||||||
|
|
||||||
# Build
|
|
||||||
make -j"$NJOBS"
|
|
||||||
make install_sw
|
|
||||||
|
|
||||||
cd "$DIR"
|
|
||||||
|
|
||||||
# Copy to package install dir
|
|
||||||
rm -rf "$INSTALL_DIR"
|
|
||||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
|
||||||
|
|
||||||
# Libraries
|
|
||||||
cp "$PREFIX/lib/libcrypto.a" "$INSTALL_DIR/lib/"
|
|
||||||
cp "$PREFIX/lib/libssl.a" "$INSTALL_DIR/lib/"
|
|
||||||
|
|
||||||
# Headers
|
|
||||||
cp -r "$PREFIX/include/openssl" "$INSTALL_DIR/include/"
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf openssl-src "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed openssl to $INSTALL_DIR"
|
|
||||||
du -sh "$INSTALL_DIR"
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
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, "libcrypto.a")), "libcrypto.a not found"
|
|
||||||
assert os.path.isfile(os.path.join(LIB_DIR, "libssl.a")), "libssl.a not found"
|
|
||||||
assert os.path.isdir(os.path.join(INCLUDE_DIR, "openssl")), "openssl headers not found"
|
|
||||||
@@ -7,12 +7,14 @@ members = [
|
|||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
"gcc-arm-none-eabi",
|
"gcc-arm-none-eabi",
|
||||||
"git-lfs",
|
"git-lfs",
|
||||||
|
"imgui",
|
||||||
"json11",
|
"json11",
|
||||||
|
"libusb",
|
||||||
"libjpeg",
|
"libjpeg",
|
||||||
"libyuv",
|
"libyuv",
|
||||||
|
"nanosvg",
|
||||||
"ncurses",
|
"ncurses",
|
||||||
"openssl3",
|
"qt5",
|
||||||
"python3-dev",
|
|
||||||
"raylib",
|
"raylib",
|
||||||
"zeromq",
|
"zeromq",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|
||||||
cd "$DIR"
|
|
||||||
|
|
||||||
VERSION="3.12.8"
|
|
||||||
INSTALL_DIR="$DIR/python3_dev/install"
|
|
||||||
|
|
||||||
# Idempotent: skip if already present
|
|
||||||
if [ -f "$INSTALL_DIR/include/Python.h" ]; then
|
|
||||||
echo "python3-dev headers already present, skipping."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARBALL="Python-${VERSION}.tgz"
|
|
||||||
URL="https://www.python.org/ftp/python/${VERSION}/${TARBALL}"
|
|
||||||
|
|
||||||
echo "Downloading CPython ${VERSION} source ..."
|
|
||||||
curl -fSL -o "$TARBALL" "$URL"
|
|
||||||
|
|
||||||
echo "Extracting ..."
|
|
||||||
tar xzf "$TARBALL"
|
|
||||||
|
|
||||||
cd "Python-${VERSION}"
|
|
||||||
|
|
||||||
# Run configure to generate pyconfig.h for this platform
|
|
||||||
echo "Running configure to generate pyconfig.h ..."
|
|
||||||
./configure --disable-shared --without-ensurepip > /dev/null 2>&1
|
|
||||||
|
|
||||||
cd "$DIR"
|
|
||||||
|
|
||||||
# Copy headers
|
|
||||||
rm -rf "$INSTALL_DIR"
|
|
||||||
mkdir -p "$INSTALL_DIR/include"
|
|
||||||
|
|
||||||
cp -r "Python-${VERSION}/Include/"* "$INSTALL_DIR/include/"
|
|
||||||
cp "Python-${VERSION}/pyconfig.h" "$INSTALL_DIR/include/"
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf "Python-${VERSION}" "$TARBALL"
|
|
||||||
|
|
||||||
echo "Installed python3-dev headers to $INSTALL_DIR"
|
|
||||||
du -sh "$INSTALL_DIR"
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
|
||||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
|
||||||
|
|
||||||
|
|
||||||
def smoketest():
|
|
||||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "Python.h")), "Python.h not found"
|
|
||||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "pyconfig.h")), "pyconfig.h not found"
|
|
||||||
159
qt5/build.sh
Executable file
159
qt5/build.sh
Executable file
@@ -0,0 +1,159 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
QT_VERSION="5.15.18"
|
||||||
|
QT_TAG="v${QT_VERSION}-lts-lgpl"
|
||||||
|
INSTALL_DIR="$DIR/qt5/install"
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
if command -v dnf &>/dev/null; then
|
||||||
|
dnf install -y \
|
||||||
|
mesa-libGL-devel \
|
||||||
|
fontconfig-devel \
|
||||||
|
freetype-devel \
|
||||||
|
libxcb-devel \
|
||||||
|
xcb-util-devel \
|
||||||
|
xcb-util-image-devel \
|
||||||
|
xcb-util-keysyms-devel \
|
||||||
|
xcb-util-renderutil-devel \
|
||||||
|
xcb-util-wm-devel \
|
||||||
|
libxkbcommon-devel \
|
||||||
|
libxkbcommon-x11-devel \
|
||||||
|
libX11-devel \
|
||||||
|
perl-IPC-Cmd
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
apt-get update && apt-get install -y \
|
||||||
|
libgl-dev \
|
||||||
|
libfontconfig1-dev libfreetype-dev \
|
||||||
|
libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev \
|
||||||
|
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev \
|
||||||
|
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \
|
||||||
|
libxcb-randr0-dev libxcb-render-util0-dev \
|
||||||
|
libxcb-xinerama0-dev libxcb-xkb-dev \
|
||||||
|
libxkbcommon-dev libxkbcommon-x11-dev \
|
||||||
|
libx11-xcb-dev
|
||||||
|
else
|
||||||
|
sudo apt-get update && sudo apt-get install -y \
|
||||||
|
libgl-dev \
|
||||||
|
libfontconfig1-dev libfreetype-dev \
|
||||||
|
libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev \
|
||||||
|
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev \
|
||||||
|
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \
|
||||||
|
libxcb-randr0-dev libxcb-render-util0-dev \
|
||||||
|
libxcb-xinerama0-dev libxcb-xkb-dev \
|
||||||
|
libxkbcommon-dev libxkbcommon-x11-dev \
|
||||||
|
libx11-xcb-dev
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clone/update qtbase
|
||||||
|
if [ ! -d "qtbase-src/.git" ]; then
|
||||||
|
rm -rf qtbase-src
|
||||||
|
git clone --depth 1 https://code.qt.io/qt/qtbase.git qtbase-src
|
||||||
|
fi
|
||||||
|
git -C qtbase-src fetch --depth 1 origin "$QT_TAG"
|
||||||
|
git -C qtbase-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
# Clean install dir and build artifacts to avoid stale cache issues
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
|
||||||
|
# Build qtbase (disable modules cabana doesn't need)
|
||||||
|
cd qtbase-src
|
||||||
|
make distclean 2>/dev/null || true
|
||||||
|
./configure \
|
||||||
|
-release \
|
||||||
|
-prefix "$INSTALL_DIR" \
|
||||||
|
-opensource -confirm-license \
|
||||||
|
-nomake examples \
|
||||||
|
-nomake tests \
|
||||||
|
-no-dbus \
|
||||||
|
-no-icu \
|
||||||
|
-opengl desktop
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Clone/update qtcharts
|
||||||
|
if [ ! -d "qtcharts-src/.git" ]; then
|
||||||
|
rm -rf qtcharts-src
|
||||||
|
git clone --depth 1 https://code.qt.io/qt/qtcharts.git qtcharts-src
|
||||||
|
fi
|
||||||
|
git -C qtcharts-src fetch --depth 1 origin "$QT_TAG"
|
||||||
|
git -C qtcharts-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
# Build qtcharts
|
||||||
|
cd qtcharts-src
|
||||||
|
make distclean 2>/dev/null || true
|
||||||
|
"$INSTALL_DIR/bin/qmake"
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Cleanup (don't let individual failures kill the build)
|
||||||
|
set +e
|
||||||
|
rm -rf "$INSTALL_DIR/doc" "$INSTALL_DIR/mkspecs" "$INSTALL_DIR/lib/cmake" "$INSTALL_DIR/lib/pkgconfig"
|
||||||
|
find "$INSTALL_DIR/lib" -name '*.prl' -delete 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/lib" -name '*.la' -delete 2>/dev/null || true
|
||||||
|
|
||||||
|
# Remove unnecessary binaries (qmake alone is 28MB, only needed for qtcharts build above)
|
||||||
|
find "$INSTALL_DIR/bin" -not -name moc -not -name rcc -not -name uic -not -type d -delete 2>/dev/null || true
|
||||||
|
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
# Remove unnecessary shared libs (keep only what cabana links)
|
||||||
|
KEEP_LIBS="Qt5Core Qt5Gui Qt5Widgets Qt5Charts Qt5OpenGL Qt5XcbQpa Qt5EglFSDeviceIntegration Qt5EglFsKmsSupport"
|
||||||
|
for f in "$INSTALL_DIR/lib/"lib*.so; do
|
||||||
|
name="${f##*/lib}"; name="${name%.so}"
|
||||||
|
echo "$KEEP_LIBS" | grep -qw "$name" || rm -f "$INSTALL_DIR/lib/lib${name}".so*
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove unnecessary include dirs
|
||||||
|
KEEP_INCLUDES="QtCore QtGui QtWidgets QtCharts QtOpenGL"
|
||||||
|
for d in "$INSTALL_DIR/include/"*/; do
|
||||||
|
name="$(basename "$d")"
|
||||||
|
echo "$KEEP_INCLUDES" | grep -qw "$name" || rm -rf "$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove static libs
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name '*.a' -delete
|
||||||
|
|
||||||
|
# Replace symlinks with copies (wheels can't store symlinks)
|
||||||
|
find "$INSTALL_DIR" -type l | while read -r link; do
|
||||||
|
target="$(readlink -f "$link")"
|
||||||
|
if [ -f "$target" ]; then
|
||||||
|
rm "$link"; cp "$target" "$link"
|
||||||
|
elif [ -d "$target" ]; then
|
||||||
|
rm "$link"; cp -r "$target" "$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Deduplicate versioned .so: keep only .so and .so.5 (SONAME)
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name 'lib*.so.5.15.18' -delete
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name 'lib*.so.5.15' -delete
|
||||||
|
|
||||||
|
# Strip
|
||||||
|
find "$INSTALL_DIR" -type f \( -name '*.so*' -o -path '*/bin/*' \) -exec strip --strip-unneeded {} + 2>/dev/null || true
|
||||||
|
else
|
||||||
|
# macOS: replace symlinks, strip frameworks
|
||||||
|
find "$INSTALL_DIR" -type l | while read -r link; do
|
||||||
|
target="$(readlink -f "$link")"
|
||||||
|
if [ -f "$target" ]; then
|
||||||
|
rm "$link"; cp "$target" "$link"
|
||||||
|
elif [ -d "$target" ]; then
|
||||||
|
rm "$link"; cp -r "$target" "$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
find "$INSTALL_DIR" -type f -name '*.dylib' -exec strip -x {} + 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/bin" -type f -exec strip -x {} + 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name '*.a' -delete 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
echo "Installed Qt5 to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
@@ -3,13 +3,13 @@ requires = ["setuptools>=64", "wheel"]
|
|||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "python3-dev"
|
name = "qt5"
|
||||||
version = "3.12.8"
|
version = "5.15.18"
|
||||||
description = "CPython development headers"
|
description = "Qt 5.15 (QtBase + QtCharts)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
include = ["python3_dev*"]
|
include = ["qt5*"]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
python3_dev = ["install/**/*"]
|
qt5 = ["install/**/*"]
|
||||||
19
qt5/qt5/__init__.py
Normal file
19
qt5/qt5/__init__.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
BIN_DIR = os.path.join(DIR, "bin")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(BIN_DIR, "moc")), "moc not found"
|
||||||
|
assert os.path.isfile(os.path.join(BIN_DIR, "rcc")), "rcc not found"
|
||||||
|
import glob
|
||||||
|
import platform
|
||||||
|
if platform.system() == "Darwin":
|
||||||
|
assert os.path.isdir(os.path.join(LIB_DIR, "QtCore.framework")), "QtCore.framework not found"
|
||||||
|
assert os.path.isdir(os.path.join(LIB_DIR, "QtCharts.framework")), "QtCharts.framework not found"
|
||||||
|
else:
|
||||||
|
assert glob.glob(os.path.join(LIB_DIR, "libQt5Core.so*")), "libQt5Core.so not found"
|
||||||
|
assert glob.glob(os.path.join(LIB_DIR, "libQt5Charts.so*")), "libQt5Charts.so not found"
|
||||||
58
qt5/setup.py
Normal file
58
qt5/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 BuildQt5(build_py):
|
||||||
|
"""Run build.sh to compile Qt5 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": BuildQt5}
|
||||||
|
|
||||||
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
|
class PlatformWheel(bdist_wheel):
|
||||||
|
"""Produce a platform-specific, Python-version-agnostic wheel."""
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
super().finalize_options()
|
||||||
|
self.root_is_pure = False
|
||||||
|
|
||||||
|
def get_tag(self):
|
||||||
|
system = platform.system()
|
||||||
|
machine = platform.machine()
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
plat = f"linux_{machine}"
|
||||||
|
elif system == "Darwin":
|
||||||
|
plat = "macosx_11_0_arm64"
|
||||||
|
else:
|
||||||
|
plat = f"{system.lower()}_{machine}"
|
||||||
|
|
||||||
|
return "py3", "none", plat
|
||||||
|
|
||||||
|
cmdclass["bdist_wheel"] = PlatformWheel
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
@@ -6,13 +6,8 @@ cd "$DIR"
|
|||||||
|
|
||||||
INSTALL_DIR="$DIR/raylib/install"
|
INSTALL_DIR="$DIR/raylib/install"
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libraylib.a" ]; then
|
|
||||||
echo "raylib already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
CC="ccache ${CC:-cc}"
|
||||||
|
|
||||||
# Detect platform: PLATFORM_COMMA for comma devices, PLATFORM_DESKTOP otherwise
|
# Detect platform: PLATFORM_COMMA for comma devices, PLATFORM_DESKTOP otherwise
|
||||||
RAYLIB_PLATFORM="${RAYLIB_PLATFORM:-PLATFORM_DESKTOP}"
|
RAYLIB_PLATFORM="${RAYLIB_PLATFORM:-PLATFORM_DESKTOP}"
|
||||||
@@ -33,6 +28,15 @@ if [[ "$(uname)" == "Linux" ]]; then
|
|||||||
sudo apt-get update && sudo apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
|
sudo apt-get update && sudo apt-get install -y libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
elif [ "$RAYLIB_PLATFORM" = "PLATFORM_OFFSCREEN" ]; then
|
||||||
|
# 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
|
else
|
||||||
# desktop: needs X11/GL dev packages
|
# desktop: needs X11/GL dev packages
|
||||||
if command -v dnf &>/dev/null; then
|
if command -v dnf &>/dev/null; then
|
||||||
@@ -48,19 +52,20 @@ if [[ "$(uname)" == "Linux" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone and build raylib C library
|
# Clone and build raylib C library
|
||||||
RAYLIB_COMMIT="aa6ade09ac4bfb2847a356535f2d9f87e49ab089"
|
RAYLIB_COMMIT="d9d7cc1353ec0f73c97e84ddf0973983d1ee25e2"
|
||||||
|
|
||||||
if [ ! -d "raylib-src" ]; then
|
if [ ! -d "raylib-src/.git" ]; then
|
||||||
git clone -b master --no-tags https://github.com/commaai/raylib.git raylib-src
|
rm -rf raylib-src
|
||||||
|
git clone --depth 1 -b platform-offscreen --no-tags https://github.com/commaai/raylib.git raylib-src
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd raylib-src
|
cd raylib-src
|
||||||
git fetch origin "$RAYLIB_COMMIT"
|
git fetch --depth 1 origin "$RAYLIB_COMMIT"
|
||||||
git reset --hard "$RAYLIB_COMMIT"
|
git reset --hard "$RAYLIB_COMMIT"
|
||||||
git clean -xdff .
|
|
||||||
|
|
||||||
cd src
|
cd src
|
||||||
make -j"$NJOBS" PLATFORM="$RAYLIB_PLATFORM"
|
make clean
|
||||||
|
make -j"$NJOBS" PLATFORM="$RAYLIB_PLATFORM" CC="${CC:-gcc}"
|
||||||
|
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
@@ -71,13 +76,46 @@ mkdir -p "$INSTALL_DIR"/{lib,include}
|
|||||||
cp raylib-src/src/libraylib.a "$INSTALL_DIR/lib/"
|
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/"
|
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
|
# Download raygui header
|
||||||
RAYGUI_COMMIT="76b36b597edb70ffaf96f046076adc20d67e7827"
|
RAYGUI_COMMIT="76b36b597edb70ffaf96f046076adc20d67e7827"
|
||||||
curl -fsSLo "$INSTALL_DIR/include/raygui.h" \
|
curl -fsSLo "$INSTALL_DIR/include/raygui.h" \
|
||||||
"https://raw.githubusercontent.com/raysan5/raygui/$RAYGUI_COMMIT/src/raygui.h"
|
"https://raw.githubusercontent.com/raysan5/raygui/$RAYGUI_COMMIT/src/raygui.h"
|
||||||
|
|
||||||
# Clean up source
|
|
||||||
rm -rf raylib-src
|
|
||||||
|
|
||||||
echo "Installed raylib to $INSTALL_DIR"
|
echo "Installed raylib to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools>=64", "wheel"]
|
requires = ["setuptools>=64", "wheel", "cffi>=1.17.1"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "raylib"
|
name = "raylib"
|
||||||
version = "5.5.0.2"
|
version = "5.5.0.8"
|
||||||
description = "raylib + pyray Python bindings (commaai fork)"
|
description = "raylib + pyray Python bindings (commaai fork)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
dependencies = ["cffi>=1.17.1"]
|
dependencies = ["cffi>=1.17.1"]
|
||||||
@@ -13,4 +13,4 @@ dependencies = ["cffi>=1.17.1"]
|
|||||||
include = ["raylib*", "pyray*"]
|
include = ["raylib*", "pyray*"]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
raylib = ["install/**/*"]
|
raylib = ["install/**/*", "_raylib_cffi*.so"]
|
||||||
|
|||||||
@@ -1,26 +1,60 @@
|
|||||||
import os
|
import os
|
||||||
|
import platform as _platform
|
||||||
|
|
||||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
LIB_DIR = os.path.join(DIR, "lib")
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
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():
|
def smoketest():
|
||||||
assert os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")), "libraylib.a not found"
|
assert os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")), "libraylib.a not found"
|
||||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "raylib.h")), "raylib.h not found"
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "raylib.h")), "raylib.h not found"
|
||||||
|
|
||||||
|
|
||||||
# Build CFFI extension on first import if not already compiled
|
# Build CFFI extension on first import if not already compiled,
|
||||||
|
# or rebuild if the target platform changed since last build.
|
||||||
def _ensure_cffi_built():
|
def _ensure_cffi_built():
|
||||||
import glob
|
import glob
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
pkg_dir = os.path.dirname(__file__)
|
pkg_dir = os.path.dirname(__file__)
|
||||||
if not glob.glob(os.path.join(pkg_dir, "_raylib_cffi*")):
|
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")
|
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")):
|
if os.path.isfile(build_script) and os.path.isfile(os.path.join(LIB_DIR, "libraylib.a")):
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([sys.executable, build_script], cwd=os.path.dirname(pkg_dir))
|
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:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ def build_ffi():
|
|||||||
'-framework', 'CoreVideo',
|
'-framework', 'CoreVideo',
|
||||||
]
|
]
|
||||||
libraries = []
|
libraries = []
|
||||||
extra_compile_args = ["-Wno-error=incompatible-function-pointer-types", "-D_CFFI_NO_LIMITED_API"]
|
extra_compile_args = ["-Wno-error=incompatible-function-pointer-types"]
|
||||||
else:
|
else:
|
||||||
print("BUILDING FOR LINUX")
|
print("BUILDING FOR LINUX")
|
||||||
extra_link_args = [
|
extra_link_args = [
|
||||||
@@ -104,15 +104,26 @@ def build_ffi():
|
|||||||
if RAYLIB_PLATFORM == "PLATFORM_COMMA":
|
if RAYLIB_PLATFORM == "PLATFORM_COMMA":
|
||||||
extra_link_args.remove('-lGL')
|
extra_link_args.remove('-lGL')
|
||||||
extra_link_args += ['-lGLESv2', '-lEGL', '-lgbm', '-ldrm']
|
extra_link_args += ['-lGLESv2', '-lEGL', '-lgbm', '-ldrm']
|
||||||
|
elif RAYLIB_PLATFORM == "PLATFORM_OFFSCREEN":
|
||||||
|
# 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:
|
else:
|
||||||
extra_link_args += ['-lX11']
|
extra_link_args += ['-lX11']
|
||||||
extra_compile_args = ["-Wno-incompatible-pointer-types", "-D_CFFI_NO_LIMITED_API"]
|
extra_compile_args = ["-Wno-incompatible-pointer-types"]
|
||||||
libraries = []
|
libraries = []
|
||||||
|
|
||||||
print("extra_link_args: " + str(extra_link_args))
|
print("extra_link_args: " + str(extra_link_args))
|
||||||
ffibuilder.set_source("raylib._raylib_cffi",
|
ffibuilder.set_source("raylib._raylib_cffi",
|
||||||
ffi_includes,
|
ffi_includes,
|
||||||
py_limited_api=False,
|
py_limited_api=True,
|
||||||
include_dirs=[RAYLIB_INCLUDE_PATH],
|
include_dirs=[RAYLIB_INCLUDE_PATH],
|
||||||
extra_link_args=extra_link_args,
|
extra_link_args=extra_link_args,
|
||||||
extra_compile_args=extra_compile_args,
|
extra_compile_args=extra_compile_args,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "5.5.0.2"
|
__version__ = "5.5.0.8"
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from setuptools.command.build_py import build_py
|
from setuptools.command.build_py import build_py
|
||||||
@@ -12,15 +14,19 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
class BuildRaylib(build_py):
|
class BuildRaylib(build_py):
|
||||||
"""Run build.sh to compile the C library before collecting package data."""
|
"""Run build.sh to compile the C library and CFFI extension before collecting package data."""
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "raylib", "install", "lib", "libraylib.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
if not os.path.exists(marker):
|
# Build CFFI extension so it's included in the wheel
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
cffi_so = glob.glob(os.path.join(pkg_dir, "raylib", "_raylib_cffi*"))
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
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()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
29
release.sh
29
release.sh
@@ -58,9 +58,28 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")):
|
|||||||
pkg_dir = tmp_dir / pkg
|
pkg_dir = tmp_dir / pkg
|
||||||
mod_dir = pkg_dir / module
|
mod_dir = pkg_dir / module
|
||||||
mod_dir.mkdir(parents=True, exist_ok=True)
|
mod_dir.mkdir(parents=True, exist_ok=True)
|
||||||
shutil.copy2(pathlib.Path(pkg) / module / "__init__.py", mod_dir / "__init__.py")
|
|
||||||
|
# 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)
|
||||||
|
include_patterns = data.get("tool", {}).get("setuptools", {}).get("packages", {}).get("find", {}).get("include", [])
|
||||||
|
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
|
||||||
|
if src_extra.is_dir():
|
||||||
|
dst_extra = pkg_dir / p
|
||||||
|
shutil.copytree(src_extra, dst_extra, dirs_exist_ok=True)
|
||||||
|
extra_packages.append(pattern)
|
||||||
|
|
||||||
shutil.copy2(shim_setup, pkg_dir / "setup.py")
|
shutil.copy2(shim_setup, pkg_dir / "setup.py")
|
||||||
|
|
||||||
|
deps = data.get("project", {}).get("dependencies", [])
|
||||||
|
|
||||||
lines = [
|
lines = [
|
||||||
"[build-system]",
|
"[build-system]",
|
||||||
'requires = ["setuptools>=64", "wheel", \'tomli; python_version < \"3.11\"\']',
|
'requires = ["setuptools>=64", "wheel", \'tomli; python_version < \"3.11\"\']',
|
||||||
@@ -73,18 +92,22 @@ for toml in sorted(pathlib.Path(".").glob("*/pyproject.toml")):
|
|||||||
'requires-python = ">=3.8"',
|
'requires-python = ">=3.8"',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if deps:
|
||||||
|
lines.append(f"dependencies = {json.dumps(deps)}")
|
||||||
|
|
||||||
if scripts:
|
if scripts:
|
||||||
lines += ["", "[project.scripts]"]
|
lines += ["", "[project.scripts]"]
|
||||||
for name, target in scripts.items():
|
for name, target in scripts.items():
|
||||||
lines.append(f'"{name}" = {json.dumps(target)}')
|
lines.append(f'"{name}" = {json.dumps(target)}')
|
||||||
|
|
||||||
|
find_include = [f"{module}*"] + extra_packages
|
||||||
lines += [
|
lines += [
|
||||||
"",
|
"",
|
||||||
"[tool.setuptools.packages.find]",
|
"[tool.setuptools.packages.find]",
|
||||||
f'include = ["{module}*"]',
|
f"include = {json.dumps(find_include)}",
|
||||||
"",
|
"",
|
||||||
"[tool.setuptools.package-data]",
|
"[tool.setuptools.package-data]",
|
||||||
f'{module} = ["{datadir}/**/*"]',
|
f'{module} = ["{datadir}/**/*", "*.so"]',
|
||||||
"",
|
"",
|
||||||
"[tool.shim]",
|
"[tool.shim]",
|
||||||
f'repo_url = "{repo_url}"',
|
f'repo_url = "{repo_url}"',
|
||||||
|
|||||||
6
setup.sh
6
setup.sh
@@ -15,12 +15,12 @@ run_as_root() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
brew install nasm pkg-config
|
brew install nasm pkg-config ccache
|
||||||
elif command -v dnf &>/dev/null; then
|
elif command -v dnf &>/dev/null; then
|
||||||
dnf install -y nasm cmake gcc-c++ pkgconfig git perl-IPC-Cmd
|
dnf install -y nasm cmake gcc-c++ pkgconfig git perl-IPC-Cmd ccache
|
||||||
elif command -v apt-get &>/dev/null; then
|
elif command -v apt-get &>/dev/null; then
|
||||||
run_as_root apt-get update
|
run_as_root apt-get update
|
||||||
run_as_root apt-get install -y nasm cmake g++ pkg-config curl
|
run_as_root apt-get install -y nasm cmake g++ pkg-config curl ccache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v uv &>/dev/null; then
|
if ! command -v uv &>/dev/null; then
|
||||||
|
|||||||
@@ -7,18 +7,15 @@ cd "$DIR"
|
|||||||
VERSION="4.3.5"
|
VERSION="4.3.5"
|
||||||
INSTALL_DIR="$DIR/zeromq/install"
|
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)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Clone
|
# Clone/update source
|
||||||
if [ ! -d "libzmq-src" ]; then
|
if [ ! -d "libzmq-src/.git" ]; then
|
||||||
git clone --depth 1 --branch "v${VERSION}" https://github.com/zeromq/libzmq.git libzmq-src
|
rm -rf libzmq-src
|
||||||
|
git clone --depth 1 https://github.com/zeromq/libzmq.git libzmq-src
|
||||||
fi
|
fi
|
||||||
|
git -C libzmq-src fetch --depth 1 origin "v${VERSION}"
|
||||||
|
git -C libzmq-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
@@ -54,8 +51,5 @@ cp "$PREFIX/lib/libzmq.a" "$INSTALL_DIR/lib/"
|
|||||||
cp "$PREFIX/include/zmq.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/zmq.h" "$INSTALL_DIR/include/"
|
||||||
cp "$PREFIX/include/zmq_utils.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"
|
echo "Installed zeromq to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildZeromq(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "zeromq", "install", "lib", "libzmq.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,15 @@ cd "$DIR"
|
|||||||
VERSION="1.5.6"
|
VERSION="1.5.6"
|
||||||
INSTALL_DIR="$DIR/zstd/install"
|
INSTALL_DIR="$DIR/zstd/install"
|
||||||
|
|
||||||
# Idempotent: skip if already built
|
|
||||||
if [ -f "$INSTALL_DIR/lib/libzstd.a" ]; then
|
|
||||||
echo "zstd already present, skipping build."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Clone
|
# Clone/update source
|
||||||
if [ ! -d "zstd-src" ]; then
|
if [ ! -d "zstd-src/.git" ]; then
|
||||||
git clone --depth 1 --branch "v${VERSION}" https://github.com/facebook/zstd.git zstd-src
|
rm -rf zstd-src
|
||||||
|
git clone --depth 1 https://github.com/facebook/zstd.git zstd-src
|
||||||
fi
|
fi
|
||||||
|
git -C zstd-src fetch --depth 1 origin "v${VERSION}"
|
||||||
|
git -C zstd-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
PREFIX="$DIR/build/prefix"
|
PREFIX="$DIR/build/prefix"
|
||||||
@@ -52,8 +49,5 @@ cp "$PREFIX/include/zstd.h" "$INSTALL_DIR/include/"
|
|||||||
cp "$PREFIX/include/zstd_errors.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/zstd_errors.h" "$INSTALL_DIR/include/"
|
||||||
cp "$PREFIX/include/zdict.h" "$INSTALL_DIR/include/"
|
cp "$PREFIX/include/zdict.h" "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf zstd-src "$DIR/build"
|
|
||||||
|
|
||||||
echo "Installed zstd to $INSTALL_DIR"
|
echo "Installed zstd to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ class BuildZstd(build_py):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
marker = os.path.join(pkg_dir, "zstd", "install", "lib", "libzstd.a")
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
if not os.path.exists(marker):
|
|
||||||
build_script = os.path.join(pkg_dir, "build.sh")
|
|
||||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
|
||||||
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user