build(wheels): added wheel generation scripts and social logo
This commit is contained in:
37
utils/wheels/build-wheels-linux_aarch64.sh
Executable file
37
utils/wheels/build-wheels-linux_aarch64.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <git-repo-url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_URL="$1"
|
||||
WORK_DIR="$(pwd)"
|
||||
WHEEL_DIR="${WORK_DIR}/wheels_linux_aarch64"
|
||||
|
||||
echo "➤ Creating wheel output directory at ${WHEEL_DIR}"
|
||||
mkdir -p "${WHEEL_DIR}"
|
||||
|
||||
TMPDIR="$(mktemp -d)"
|
||||
echo "➤ Cloning ${REPO_URL} → ${TMPDIR}/project"
|
||||
git clone "${REPO_URL}" "${TMPDIR}/project"
|
||||
|
||||
for IMAGE in \
|
||||
tboudreaux/manylinux_2_28_aarch64_boost_1_88_0:latest
|
||||
do
|
||||
docker run --rm \
|
||||
-v "${WHEEL_DIR}":/io/wheels \
|
||||
-v "${TMPDIR}/project":/io/project \
|
||||
"${IMAGE}" \
|
||||
/bin/bash -eux -c '
|
||||
cd /io/project
|
||||
for PY in /opt/python/*/bin/python; do
|
||||
"$PY" -m pip install --upgrade pip setuptools wheel meson meson-python
|
||||
CC=clang CXX=clang++ "$PY" -m pip wheel . --config-settings=setup-args=-Dunity=on -w /io/wheels -vv
|
||||
auditwheel repair /io/wheels/*.whl -w /io/wheels
|
||||
done
|
||||
|
||||
echo "✅ Linux wheels ready in /io/wheels"
|
||||
'
|
||||
done
|
||||
37
utils/wheels/build-wheels-linux_x86_64.sh
Executable file
37
utils/wheels/build-wheels-linux_x86_64.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <git-repo-url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_URL="$1"
|
||||
WORK_DIR="$(pwd)"
|
||||
WHEEL_DIR="${WORK_DIR}/wheels_linux_x86_64"
|
||||
|
||||
echo "➤ Creating wheel output directory at ${WHEEL_DIR}"
|
||||
mkdir -p "${WHEEL_DIR}"
|
||||
|
||||
TMPDIR="$(mktemp -d)"
|
||||
echo "➤ Cloning ${REPO_URL} → ${TMPDIR}/project"
|
||||
git clone "${REPO_URL}" "${TMPDIR}/project"
|
||||
|
||||
for IMAGE in \
|
||||
tboudreaux/manylinux_2_28_x86_64_boost_1_88_0:latest
|
||||
do
|
||||
docker run --rm \
|
||||
-v "${WHEEL_DIR}":/io/wheels \
|
||||
-v "${TMPDIR}/project":/io/project \
|
||||
"${IMAGE}" \
|
||||
/bin/bash -eux -c '
|
||||
cd /io/project
|
||||
for PY in /opt/python/*/bin/python; do
|
||||
"$PY" -m pip install --upgrade pip setuptools wheel meson meson-python
|
||||
CC=clang CXX=clang++ "$PY" -m pip wheel . --config-settings=setup-args=-Dunity=on -w /io/wheels -vv
|
||||
auditwheel repair /io/wheels/*.whl -w /io/wheels
|
||||
done
|
||||
|
||||
echo "✅ Linux wheels ready in /io/wheels"
|
||||
'
|
||||
done
|
||||
70
utils/wheels/build-wheels-macos_aarch64.sh
Executable file
70
utils/wheels/build-wheels-macos_aarch64.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $(uname -m) != "arm64" ]]; then
|
||||
echo "Error: This script is intended to run on an Apple Silicon (arm64) Mac."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <git-repo-url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Initial Setup ---
|
||||
REPO_URL="$1"
|
||||
WORK_DIR="$(pwd)"
|
||||
WHEEL_DIR="${WORK_DIR}/wheels_macos_aarch64_tmp"
|
||||
FINAL_WHEEL_DIR="${WORK_DIR}/wheels_macos_aarch64"
|
||||
|
||||
echo "➤ Creating wheel output directories"
|
||||
mkdir -p "${WHEEL_DIR}"
|
||||
mkdir -p "${FINAL_WHEEL_DIR}"
|
||||
|
||||
TMPDIR="$(mktemp -d)"
|
||||
echo "➤ Cloning ${REPO_URL} → ${TMPDIR}/project"
|
||||
git clone --depth 1 "${REPO_URL}" "${TMPDIR}/project"
|
||||
cd "${TMPDIR}/project"
|
||||
|
||||
# --- macOS Build Configuration ---
|
||||
export MACOSX_DEPLOYMENT_TARGET=12.0
|
||||
|
||||
PYTHON_VERSIONS=("3.8.20" "3.9.23" "3.10.18" "3.11.13" "3.12.11" "3.13.5" "3.13.5t" "3.14.0rc1" "3.14.0rc1t" 'pypy3.10-7.3.19' "pypy3.11-7.3.20")
|
||||
|
||||
if ! command -v pyenv &> /dev/null; then
|
||||
echo "Error: pyenv not found. Please install it to manage Python versions."
|
||||
exit 1
|
||||
fi
|
||||
eval "$(pyenv init -)"
|
||||
|
||||
for PY_VERSION in "${PYTHON_VERSIONS[@]}"; do
|
||||
(
|
||||
set -e
|
||||
|
||||
if ! pyenv versions --bare --filter="${PY_VERSION}." &>/dev/null; then
|
||||
echo "⚠️ Python version matching '${PY_VERSION}.*' not found by pyenv. Skipping."
|
||||
continue
|
||||
fi
|
||||
|
||||
pyenv shell "${PY_VERSION}"
|
||||
|
||||
PY="$(pyenv which python)"
|
||||
echo "➤ Building for $($PY --version) on macOS arm64 (target: ${MACOSX_DEPLOYMENT_TARGET})"
|
||||
|
||||
"$PY" -m pip install --upgrade pip setuptools wheel meson meson-python delocate
|
||||
|
||||
CC=clang CXX=clang++ "$PY" -m pip wheel . \
|
||||
--config-settings=setup-args=-Dunity=on \
|
||||
-w "${WHEEL_DIR}" -vv
|
||||
|
||||
echo "➤ Repairing wheel(s) with delocate"
|
||||
delocate-wheel -w "${FINAL_WHEEL_DIR}" "${WHEEL_DIR}"/*.whl
|
||||
|
||||
rm "${WHEEL_DIR}"/*.whl
|
||||
|
||||
)
|
||||
done
|
||||
|
||||
rm -rf "${TMPDIR}"
|
||||
rm -rf "${WHEEL_DIR}"
|
||||
|
||||
14
utils/wheels/installPyEnvVersions.sh
Executable file
14
utils/wheels/installPyEnvVersions.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
pyenv install 3.8.20
|
||||
pyenv install 3.9.23
|
||||
pyenv install 3.10.18
|
||||
pyenv install 3.11.13
|
||||
pyenv install 3.12.11
|
||||
pyenv install 3.13.5
|
||||
pyenv install 3.13.5t
|
||||
pyenv install 3.14.0rc1
|
||||
pyenv install 3.14.0rc1t
|
||||
pyenv install pypy3.10-7.3.19
|
||||
pyenv install pypy3.11-7.3.20
|
||||
|
||||
28
utils/wheels/readme.md
Normal file
28
utils/wheels/readme.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Wheel Generation
|
||||
This directory contains scripts to generate precompiled python wheels for GridFire
|
||||
|
||||
# Notes
|
||||
- MacOS wheels can only be generated on macos
|
||||
- aarch64 wheels can only be generated on aarch64 machines
|
||||
- x86_64 wheels can only be generated on x86_64 machines
|
||||
- linux wheels can be generated on any linux machine, but the target architecture must match the machine architecture
|
||||
- Running each script will take **a very long time** (could be upwards of half of a day depending on your system) and will require roughly 2GB of disk space
|
||||
- When generating MacOS wheels, you must have all the correct versions of python installed with `pyenv`. Run the script `utils/wheels/installPyEnvVersions.sh` to install the correct versions of python.
|
||||
|
||||
# Usage
|
||||
Once you know you are on the correct machine, run the script for your desired architecture and operating system. For example, to generate a macos x86_64 wheel, run:
|
||||
|
||||
```bash
|
||||
./build-wheels-macos-aarch64.sh https://github.com/4D-STAR/GridFire
|
||||
```
|
||||
|
||||
Once you have all the wheels generated (which will likely require multiple systems), copy all the wheels into a single
|
||||
directory (lets assume its called `wheels` and in the root of the directory) and then run (from the root of the repository):
|
||||
|
||||
```bash
|
||||
python -m pip install --upgrade build
|
||||
python -m build --sdist --outdir wheels
|
||||
twine upload wheels/*
|
||||
```
|
||||
|
||||
Thie will also take a while (it needs to upload all the wheels to PyPI) but will result in all the wheels being uploaded to PyPI.
|
||||
Reference in New Issue
Block a user