export LD_LIBRARY_PATH=/opt/SDL2/lib
git clone https://github.com/pygame-community/pygame-ce.git
cd pygame-ce
python -m venv .venv
source .venv/bin/activate
python dev.py build --wheelUse auditwheel to add RPATH and copy the libraries into the wheel.
export LD_LIBRARY_PATH=/opt/SDL2/lib
sudo apt install patchelf
pip install auditwheel
auditwheel repair -w repaired dist/pygame_ce-3.0.0.dev1-cp312-cp312-linux_x86_64.whlFinally install the repaired wheel.
pip install repaired/pygame_ce-3.0.0.dev1-cp312-cp312-manylinux_2_38_x86_64.whl --force-reinstallThis wheel is ready to share in other systems.
To use the same build as pygame-ce, need to build the image and install the generated wheel.
First, create the docker image with the same dependencies. It takes some time to pull image and compile all dependencies.
cd pygame-ce
cd buildconfig/manylinux-build
make base-image-manylinux2010-x64Then, use cibuildwheel to build pygame-ce. It will create a docker container, build pygame-ce and export a .whl file back.
cibuildwheel will build many .whl for different Python versions. Edit pyproject.toml to build for a specific version.
[tool.cibuildwheel.linux]
build = "cp312-*"Then run cibuildwheel
cd pygame-ce
python -m venv .venv
source .venv/bin/activate
python -m pip install cibuildwheel auditwheel
CIBW_MANYLINUX_X86_64_IMAGE=pygame/manylinux2010_base_x86_64:latest CIBW_DEBUG_KEEP_CONTAINER=TRUE python -m cibuildwheel --platform linuxThe .whl file will contain all dependencies. Just install it
cd pygame-ce
source .venv/bin/activate
pip install wheelhouse/pygame_ce-3.0.0.dev1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl --force-reinstall