Skip to content

Commit

Permalink
Merge pull request #1997 from pygame-community/ankith26-manylinux-way…
Browse files Browse the repository at this point in the history
…land

Add wayland and kmsdrm support to manylinux wheels
  • Loading branch information
Starbuck5 authored Mar 5, 2024
2 parents ec62643 + 1d305b2 commit 9597f81
Show file tree
Hide file tree
Showing 27 changed files with 346 additions and 19 deletions.
5 changes: 1 addition & 4 deletions buildconfig/manylinux-build/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,5 @@ TODO

Maybe these need adding?

- wayland, https://wayland.freedesktop.org/building.html http://www.linuxfromscratch.org/blfs/view/svn/general/wayland-protocols.html
- audio resampling for SDL: libsamplerate (handles samplerate conversions better)
- vulkan, via mesa?
- xinput,
- xrandr,

42 changes: 38 additions & 4 deletions buildconfig/manylinux-build/docker_base/Dockerfile-aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ RUN rpm --import /tmp/RPM-GPG-KEY.dag.txt

#RUN rpm -i /tmp/${RPMFORGE_FILE}

# systemd is needed for udev (for SDL and pulse)
# it's okay to install X11 and friends from outdated centos repos because newer
# libs are dynamically loaded at runtime
RUN yum install -y zlib-devel dbus-devel fontconfig xz systemd-devel \
mesa-libGLU-devel libcap-devel libxkbcommon-devel \
libcap-devel libxkbcommon-devel \
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
libXi-devel libXScrnSaver-devel

Expand Down Expand Up @@ -44,6 +45,42 @@ RUN ["bash", "/pkg-config_build/build-pkg-config.sh"]
ADD buildtools /buildtools/
RUN ["bash", "/buildtools/install.sh"]

ADD libffi /libffi_build/
RUN ["bash", "/libffi_build/build-libffi.sh"]

ADD libxml2 /libxml2_build/
RUN ["bash", "/libxml2_build/build-libxml2.sh"]

ADD wayland /wayland_build/
RUN ["bash", "/wayland_build/build-wayland.sh"]

ADD libdecor /libdecor_build/
RUN ["bash", "/libdecor_build/build-libdecor.sh"]

ADD xorg/macros /xorg_build/macros/
RUN ["bash", "/xorg_build/macros/build-macros.sh"]

ADD xorg/libpciaccess /xorg_build/libpciaccess/
RUN ["bash", "/xorg_build/libpciaccess/build-libpciaccess.sh"]

ADD mesa/libdrm /mesa_build/libdrm/
RUN ["bash", "/mesa_build/libdrm/build-libdrm.sh"]

ADD xorg/libxshmfence /xorg_build/libxshmfence/
RUN ["bash", "/xorg_build/libxshmfence/build-libxshmfence.sh"]

ADD mesa/glslang /mesa_build/glslang/
RUN ["bash", "/mesa_build/glslang/build-glslang.sh"]

ADD mesa/mako /mesa_build/mako/
RUN ["bash", "/mesa_build/mako/build-mako.sh"]

ADD mesa/flex /mesa_build/flex/
RUN ["bash", "/mesa_build/flex/build-flex.sh"]

ADD mesa/mesa /mesa_build/mesa/
RUN ["bash", "/mesa_build/mesa/build-mesa.sh"]

#ADD zlib-ng /zlib-ng_build/
#RUN ["bash", "/zlib-ng_build/build-zlib-ng.sh"]

Expand Down Expand Up @@ -94,9 +131,6 @@ RUN ["bash", "/pulseaudio_build/build-pulseaudio.sh"]
ADD libxmp /libxmp_build/
RUN ["bash", "/libxmp_build/build-libxmp.sh"]

ADD libffi /libffi_build/
RUN ["bash", "/libffi_build/build-libffi.sh"]

# explicit install not needed anymore
# ADD gettext /gettext_build/
# RUN ["bash", "/gettext_build/build-gettext.sh"]
Expand Down
44 changes: 39 additions & 5 deletions buildconfig/manylinux-build/docker_base/Dockerfile-i686
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ RUN rpm --import /tmp/RPM-GPG-KEY.dag.txt

#RUN rpm -i /tmp/${RPMFORGE_FILE}

# systemd is needed for udev (for SDL and pulse)
# it's okay to install X11 and friends from outdated centos repos because newer
# libs are dynamically loaded at runtime
RUN linux32 yum install -y zlib-devel dbus-devel fontconfig xz systemd-devel \
mesa-libGLU-devel libcap-devel libxkbcommon-devel \
libcap-devel libxkbcommon-devel \
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
libXi-devel libXScrnSaver-devel

Expand Down Expand Up @@ -44,6 +45,42 @@ RUN ["linux32", "bash", "/pkg-config_build/build-pkg-config.sh"]
ADD buildtools /buildtools/
RUN ["linux32", "bash", "/buildtools/install.sh"]

ADD libffi /libffi_build/
RUN ["linux32", "bash", "/libffi_build/build-libffi.sh"]

ADD libxml2 /libxml2_build/
RUN ["linux32", "bash", "/libxml2_build/build-libxml2.sh"]

ADD wayland /wayland_build/
RUN ["linux32", "bash", "/wayland_build/build-wayland.sh"]

ADD libdecor /libdecor_build/
RUN ["linux32", "bash", "/libdecor_build/build-libdecor.sh"]

ADD xorg/macros /xorg_build/macros/
RUN ["linux32", "bash", "/xorg_build/macros/build-macros.sh"]

ADD xorg/libpciaccess /xorg_build/libpciaccess/
RUN ["linux32", "bash", "/xorg_build/libpciaccess/build-libpciaccess.sh"]

ADD mesa/libdrm /mesa_build/libdrm/
RUN ["linux32", "bash", "/mesa_build/libdrm/build-libdrm.sh"]

ADD xorg/libxshmfence /xorg_build/libxshmfence/
RUN ["linux32", "bash", "/xorg_build/libxshmfence/build-libxshmfence.sh"]

ADD mesa/glslang /mesa_build/glslang/
RUN ["linux32", "bash", "/mesa_build/glslang/build-glslang.sh"]

ADD mesa/mako /mesa_build/mako/
RUN ["linux32", "bash", "/mesa_build/mako/build-mako.sh"]

ADD mesa/flex /mesa_build/flex/
RUN ["linux32", "bash", "/mesa_build/flex/build-flex.sh"]

ADD mesa/mesa /mesa_build/mesa/
RUN ["linux32", "bash", "/mesa_build/mesa/build-mesa.sh"]

#ADD zlib-ng /zlib-ng_build/
#RUN ["linux32", "bash", "/zlib-ng_build/build-zlib-ng.sh"]

Expand Down Expand Up @@ -94,15 +131,12 @@ RUN ["linux32", "bash", "/pulseaudio_build/build-pulseaudio.sh"]
ADD libxmp /libxmp_build/
RUN ["linux32", "bash", "/libxmp_build/build-libxmp.sh"]

ADD libffi /libffi_build/
RUN ["bash", "/libffi_build/build-libffi.sh"]

# explicit install not needed anymore
# ADD gettext /gettext_build/
# RUN ["bash", "/gettext_build/build-gettext.sh"]

ADD glib /glib_build/
RUN ["bash", "/glib_build/build-glib.sh"]
RUN ["linux32", "bash", "/glib_build/build-glib.sh"]

ADD fluidsynth /fluidsynth_build/
RUN ["linux32", "bash", "/fluidsynth_build/build-fluidsynth.sh"]
Expand Down
42 changes: 38 additions & 4 deletions buildconfig/manylinux-build/docker_base/Dockerfile-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ RUN rpm --import /tmp/RPM-GPG-KEY.dag.txt

#RUN rpm -i /tmp/${RPMFORGE_FILE}

# systemd is needed for udev (for SDL and pulse)
# it's okay to install X11 and friends from outdated centos repos because newer
# libs are dynamically loaded at runtime
RUN yum install -y zlib-devel dbus-devel fontconfig xz systemd-devel \
mesa-libGLU-devel libcap-devel libxkbcommon-devel \
libcap-devel libxkbcommon-devel \
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
libXi-devel libXScrnSaver-devel

Expand Down Expand Up @@ -44,6 +45,42 @@ RUN ["bash", "/pkg-config_build/build-pkg-config.sh"]
ADD buildtools /buildtools/
RUN ["bash", "/buildtools/install.sh"]

ADD libffi /libffi_build/
RUN ["bash", "/libffi_build/build-libffi.sh"]

ADD libxml2 /libxml2_build/
RUN ["bash", "/libxml2_build/build-libxml2.sh"]

ADD wayland /wayland_build/
RUN ["bash", "/wayland_build/build-wayland.sh"]

ADD libdecor /libdecor_build/
RUN ["bash", "/libdecor_build/build-libdecor.sh"]

ADD xorg/macros /xorg_build/macros/
RUN ["bash", "/xorg_build/macros/build-macros.sh"]

ADD xorg/libpciaccess /xorg_build/libpciaccess/
RUN ["bash", "/xorg_build/libpciaccess/build-libpciaccess.sh"]

ADD mesa/libdrm /mesa_build/libdrm/
RUN ["bash", "/mesa_build/libdrm/build-libdrm.sh"]

ADD xorg/libxshmfence /xorg_build/libxshmfence/
RUN ["bash", "/xorg_build/libxshmfence/build-libxshmfence.sh"]

ADD mesa/glslang /mesa_build/glslang/
RUN ["bash", "/mesa_build/glslang/build-glslang.sh"]

ADD mesa/mako /mesa_build/mako/
RUN ["bash", "/mesa_build/mako/build-mako.sh"]

ADD mesa/flex /mesa_build/flex/
RUN ["bash", "/mesa_build/flex/build-flex.sh"]

ADD mesa/mesa /mesa_build/mesa/
RUN ["bash", "/mesa_build/mesa/build-mesa.sh"]

#ADD zlib-ng /zlib-ng_build/
#RUN ["bash", "/zlib-ng_build/build-zlib-ng.sh"]

Expand Down Expand Up @@ -94,9 +131,6 @@ RUN ["bash", "/pulseaudio_build/build-pulseaudio.sh"]
ADD libxmp /libxmp_build/
RUN ["bash", "/libxmp_build/build-libxmp.sh"]

ADD libffi /libffi_build/
RUN ["bash", "/libffi_build/build-libffi.sh"]

# explicit install not needed anymore
# ADD gettext /gettext_build/
# RUN ["bash", "/gettext_build/build-gettext.sh"]
Expand Down
25 changes: 25 additions & 0 deletions buildconfig/manylinux-build/docker_base/libdecor/build-libdecor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

LIBDECOR_VER=0.2.2
LIBDECOR="libdecor-$LIBDECOR_VER"

curl -sL --retry 10 https://gitlab.freedesktop.org/libdecor/libdecor/-/releases/${LIBDECOR_VER}/downloads/${LIBDECOR}.tar.xz > ${LIBDECOR}.tar.xz
sha512sum -c libdecor.sha512sum

tar xf $LIBDECOR.tar.xz
cd $LIBDECOR

# This is a hack because I'm lazy :)
# libdecor depends on cairo which is a kinda heavy dependency and need more
# scripting work. But libdecor shared lib is not actually present in the
# manylinux wheel and is dynamically loaded by SDL at runtime (if available on
# users system)
# So we override the plugin builds to skip cairo (and only build dummy plugin)
echo "plugin_include_path = include_directories('.')" > src/plugins/meson.build
echo "subdir('dummy')" > src/plugins/meson.build

meson build/ $PG_BASE_MESON_FLAGS -Ddemo=false
ninja -C build/ install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ed1dfb86c28f0c84950ea5653e1ae6a83bf274e5ea51c0977ea134481536dffd31e65146c0a0aa8b67a6cad4fb8bc551b4266b04c93493547d43131dc04ea380 libdecor-0.2.2.tar.xz
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ sha512sum -c libffi.sha512
tar xzf ${LIBFFI}.tar.gz
cd $LIBFFI

./configure $PG_BASE_CONFIGURE_FLAGS
# --disable-multi-os-directory is passed so that /usr/local/lib is used
./configure $PG_BASE_CONFIGURE_FLAGS --disable-docs --disable-multi-os-directory
make
make install
18 changes: 18 additions & 0 deletions buildconfig/manylinux-build/docker_base/libxml2/build-libxml2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

LIBXML2_VER=2.11
LIBXML2_PATCH=7
LIBXML2="libxml2-$LIBXML2_VER.$LIBXML2_PATCH"

curl -sL --retry 10 https://download.gnome.org/sources/libxml2/${LIBXML2_VER}/${LIBXML2}.tar.xz > ${LIBXML2}.tar.xz
sha512sum -c libxml2.sha512

tar xf ${LIBXML2}.tar.xz
cd $LIBXML2

./configure $PG_BASE_CONFIGURE_FLAGS --disable-static --with-python=no
make
make install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
202b0523d982eb5269dcb4644d8ab2ea31404771069462cdd6c5cd7e6672e0e50371ceb334133bb8f2c0a42f133e8f40c3f582bba5fc71ab168a2b18d4cfd81d libxml2-2.11.7.tar.xz
17 changes: 17 additions & 0 deletions buildconfig/manylinux-build/docker_base/mesa/flex/build-flex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

FLEX_VER="2.6.4"
FLEX="flex-$FLEX_VER"

curl -sL --retry 10 https://github.com/westes/flex/releases/download/v$FLEX_VER/$FLEX.tar.gz > $FLEX.tar.gz
sha512sum -c flex.sha512sum

tar xzf $FLEX.tar.gz
cd $FLEX

./configure $PG_BASE_CONFIGURE_FLAGS
make
make install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e9785f3d620a204b7d20222888917dc065c2036cae28667065bf7862dfa1b25235095a12fd04efdbd09bfd17d3452e6b9ef953a8c1137862ff671c97132a082e flex-2.6.4.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

GLSLANG_VER=14.0.0
GLSLANG="glslang-$GLSLANG_VER"
curl -sL --retry 10 https://github.com/KhronosGroup/glslang/archive/refs/tags/${GLSLANG_VER}.tar.gz > ${GLSLANG}.tar.gz

sha512sum -c glslang.sha512sum
tar xzf ${GLSLANG}.tar.gz
cd $GLSLANG

mkdir build
cd build

cmake .. $PG_BASE_CMAKE_FLAGS -DENABLE_OPT=0 -DGLSLANG_TESTS=0
make
make install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
45ec1a23a390319b9270761cf8befb832ac8b4bc215b211c41a543553a97e5ccf17c134c34d8fdbed6efe887a9a7c2f0a955d1bfe1add9e04cc3e95b12e1973a glslang-14.0.0.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

# The drm already available on manylinux docker images is too old for mesa, so
# we need to compile the latest from source

DRM_VER="libdrm-2.4.120"
DRM="drm-$DRM_VER"

curl -sL --retry 10 https://gitlab.freedesktop.org/mesa/drm/-/archive/$DRM_VER/$DRM.tar.gz > $DRM.tar.gz
sha512sum -c libdrm.sha512sum

tar xzf $DRM.tar.gz
cd $DRM

# build with meson+ninja
meson build/ $PG_BASE_MESON_FLAGS -Dman-pages=disabled -Dvalgrind=disabled -Dtests=false
ninja -C build/ install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
31428ec49476af3bb7acbe088ebb2411f2f69013af63afd0832546df1a45a7f45ebb472dce3f07946b9202e41deba7aae3590c2e721c56b6d64de908704ae308 drm-libdrm-2.4.120.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

# pin for build stability, remember to keep updated
python3 -m pip install mako==1.3.2
32 changes: 32 additions & 0 deletions buildconfig/manylinux-build/docker_base/mesa/mesa/build-mesa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e -x

cd $(dirname `readlink -f "$0"`)

# We need mesa for opengl, gbm (SDL kmsdrm driver needs it), egl (SDL
# wayland driver needs this) and glx (SDL needs it)
# we don't support vulkan yet

MESA_VER="mesa-24.0.1"
MESA="mesa-$MESA_VER" # yes mesa comes twice in the name

curl -sL --retry 10 https://gitlab.freedesktop.org/mesa/mesa/-/archive/$MESA_VER/$MESA.tar.gz > $MESA.tar.gz
sha512sum -c mesa.sha512sum

tar xzf $MESA.tar.gz
cd $MESA

# For now, we don't compile in LLVM because of its weight. Because of this, we
# can't compile in support for the radeonsi driver
if [ `uname -m` == "aarch64" ]; then
# On aarch64 we allow mesa to use all drivers it wants to pick by default
# (because radeonsi is not used on arm platforms)
GALLIUM_DRIVERS="auto"
else
# all default except radeonsi
GALLIUM_DRIVERS="r300,r600,nouveau,virgl,svga,swrast,iris,crocus,i915"
fi

# build with meson+ninja
meson build/ $PG_BASE_MESON_FLAGS -Dgallium-drivers=$GALLIUM_DRIVERS -Dvulkan-drivers=[]
ninja -C build/ install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
66a6cea1712f3b20744c0865c10523313653be39fc5a75e8201dbf50188cad819bd52a6013d1bd7be3d622de948b750ceb41dc73649cdea2abbaa6bb016cc4a7 mesa-mesa-24.0.1.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cd $(dirname `readlink -f "$0"`)
COMPILED_PKGCONFIG_DIRS=$(pkg-config --variable pc_path pkg-config)

# append path(s) where other installs put .pc files
COMPILED_PKGCONFIG_DIRS="$PG_DEP_PREFIX/lib/pkgconfig:${COMPILED_PKGCONFIG_DIRS}"
COMPILED_PKGCONFIG_DIRS="$PG_DEP_PREFIX/lib/pkgconfig:$PG_DEP_PREFIX/share/pkgconfig:${COMPILED_PKGCONFIG_DIRS}"

PKGCONFIG=pkg-config-0.29.2

Expand Down
Loading

0 comments on commit 9597f81

Please sign in to comment.