Skip to content

Commit

Permalink
Merge pull request #2212 from pygame/pypy-manylinux2010
Browse files Browse the repository at this point in the history
pypy and manylinux2010
  • Loading branch information
illume committed Oct 20, 2020
2 parents d9a1884 + 157c7de commit 92714bd
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 39 deletions.
60 changes: 52 additions & 8 deletions buildconfig/manylinux-build/Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,77 @@
REPO_ROOT = $(abspath ../..)

wheels-x64:
wheels-manylinux-x64:
docker run --rm -v ${REPO_ROOT}:/io pygame/manylinux1_base_x86_64 /io/buildconfig/manylinux-build/build-wheels.sh

wheels-x86:
wheels-manylinux-x86:
docker run --rm -v ${REPO_ROOT}:/io pygame/manylinux1_base_i686 /io/buildconfig/manylinux-build/build-wheels.sh

wheels-x64:
docker run --rm -v ${REPO_ROOT}:/io pygame/manylinux2010_base_x86_64 /io/buildconfig/manylinux-build/build-wheels.sh buildpypy

wheels-x86:
docker run --rm -v ${REPO_ROOT}:/io pygame/manylinux2010_base_i686 /io/buildconfig/manylinux-build/build-wheels.sh buildpypy


wheels: wheels-x64 wheels-x86
wheels-manylinux: wheels-manylinux-x64 wheels-manylinux-x86



base-image-manylinux-x64:
docker build --build-arg BASE_IMAGE=manylinux1_x86_64 -t pygame/manylinux1_base_x86_64 -f docker_base/Dockerfile-x86_64 docker_base

base-image-manylinux-x86:
docker build --build-arg BASE_IMAGE=manylinux1_i686 -t pygame/manylinux1_base_i686 -f docker_base/Dockerfile-i686 docker_base

base-images-manylinux: base-image-manylinux-x64 base-image-manylinux-x86



base-image-x64:
docker build -t pygame/manylinux1_base_x86_64 -f docker_base/Dockerfile-x86_64 docker_base
docker build -t pygame/manylinux2010_base_x86_64 -f docker_base/Dockerfile-x86_64 docker_base --build-arg BASE_IMAGE=manylinux2010_x86_64

base-image-x86:
docker build -t pygame/manylinux1_base_i686 -f docker_base/Dockerfile-i686 docker_base
docker build -t pygame/manylinux2010_base_i686 -f docker_base/Dockerfile-i686 docker_base --build-arg BASE_IMAGE=manylinux2010_i686

base-images: base-image-x64 base-image-x86

push-x64:



push-manylinux-x64:
docker push pygame/manylinux1_base_x86_64

push-x86:
push-manylinux-x86:
docker push pygame/manylinux1_base_i686

push-manylinux: push-manylinux-x64 push-manylinux-x86


push-x64:
docker push pygame/manylinux2010_base_x86_64

push-x86:
docker push pygame/manylinux2010_base_i686

push: push-x64 push-x86

pull-x64:



pull-manylinux-x64:
docker pull pygame/manylinux1_base_x86_64

pull-x86:
pull-manylinux-x86:
docker pull pygame/manylinux1_base_i686

pull-manylinux: pull-manylinux-x64 pull-manylinux-x86

pull-x64:
docker pull pygame/manylinux2010_base_x86_64

pull-x86:
docker pull pygame/manylinux2010_base_i686

pull: pull-x64 pull-x86

11 changes: 11 additions & 0 deletions buildconfig/manylinux-build/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,14 @@ These aren't meant to be copypasta'd in. Perhaps these can be worked into a scri
pip install twine

python .travis_osx_upload_whl.py --no-git


Getting a shell
---------------

To be able to run bash:

docker run --name test -it pygame/manylinux2010_base_x86_64



29 changes: 26 additions & 3 deletions buildconfig/manylinux-build/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ set -e -x

SUPPORTED_PYTHONS="cp27-cp27mu cp35-cp35m cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39"

if [[ "$1" == "buildpypy" ]]; then
SUPPORTED_PYTHONS="${SUPPORTED_PYTHONS} pp27-pypy_73 pp36-pypy36_pp73 pp37-pypy37_pp73"
fi


export PORTMIDI_INC_PORTTIME=1

# To 'solve' this issue:
# >>> process 338: D-Bus library appears to be incorrectly set up; failed to read
# machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
if [ ! -f /var/lib/dbus/machine-id ]; then
dbus-uuidgen > /var/lib/dbus/machine-id
fi


# -msse4 is required by old gcc in centos, for the SSE4.2 used in image.c
# -g0 removes debugging symbols reducing file size greatly.
# -03 is full optimization on.
Expand All @@ -16,7 +29,12 @@ ls -la /io
for PYVER in $SUPPORTED_PYTHONS; do
rm -rf /io/Setup /io/build/
PYBIN="/opt/python/${PYVER}/bin"
${PYBIN}/pip wheel --global-option="build_ext" --global-option="-j4" -vvv /io/ -w wheelhouse/
PYTHON="/opt/python/${PYVER}/bin/python"
if [ ! -f ${PYBIN}/python ]; then
PYTHON="/opt/python/${PYVER}/bin/pypy"
fi

${PYTHON} -m pip wheel --global-option="build_ext" --global-option="-j4" -vvv /io/ -w wheelhouse/
done

# Bundle external shared libraries into the wheels
Expand All @@ -31,6 +49,11 @@ export SDL_VIDEODRIVER=dummy
# Install packages and test
for PYVER in $SUPPORTED_PYTHONS; do
PYBIN="/opt/python/${PYVER}/bin"
${PYBIN}/pip install pygame --no-index -f /io/buildconfig/manylinux-build/wheelhouse
(cd $HOME; ${PYBIN}/python -m pygame.tests --exclude opengl,music,timing)
PYTHON="/opt/python/${PYVER}/bin/python"
if [ ! -f ${PYBIN}/python ]; then
PYTHON="/opt/python/${PYVER}/bin/pypy"
fi

${PYTHON} -m pip install pygame --no-index -f /io/buildconfig/manylinux-build/wheelhouse
(cd $HOME; ${PYTHON} -m pygame.tests --exclude opengl,music,timing)
done
8 changes: 6 additions & 2 deletions buildconfig/manylinux-build/docker_base/Dockerfile-i686
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM quay.io/pypa/manylinux1_i686
ARG BASE_IMAGE=manylinux1_i686
FROM quay.io/pypa/$BASE_IMAGE
ENV MAKEFLAGS="-j 4"

# Set up repoforge
Expand All @@ -16,7 +17,7 @@ RUN linux32 yum install -y zlib-devel libjpeg-devel libX11-devel freetype-devel
java-1.7.0-openjdk-devel jpackage-utils xz libtiff-devel \
giflib-devel mikmod-devel subversion
RUN linux32 yum install -y libsndfile-devel libsndfile smpeg-devel dbus-devel \
pulseaudio-libs-devel cmake
pulseaudio-libs-devel cmake dejavu-sans-fonts fontconfig

# Build and install PNG
ADD libpng /png_build/
Expand Down Expand Up @@ -59,3 +60,6 @@ ENV MAKEFLAGS=
# Build and install SDL and portmidi
ADD portmidi /portmidi_build/
RUN ["linux32", "bash", "/portmidi_build/build-portmidi.sh"]

ADD pypy /pypy_build/
RUN if [ "$BASE_IMAGE" = "manylinux2010_base_i686" ] ; then /pypy_build/getpypy32.sh ; else echo "no pypy on manylinux1" ; fi
9 changes: 7 additions & 2 deletions buildconfig/manylinux-build/docker_base/Dockerfile-x86_64
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM quay.io/pypa/manylinux1_x86_64
ARG BASE_IMAGE=manylinux1_x86_64
FROM quay.io/pypa/$BASE_IMAGE
ENV MAKEFLAGS="-j 4"

# Set up repoforge
Expand All @@ -15,7 +16,7 @@ RUN yum install -y zlib-devel libjpeg-devel libX11-devel\
mesa-libGLU-devel audiofile-devel \
cmake java-1.7.0-openjdk-devel jpackage-utils libtiff-devel \
mikmod-devel smpeg-devel giflib-devel libsndfile-devel dbus-devel \
pulseaudio-libs-devel xz subversion
pulseaudio-libs-devel xz subversion dejavu-sans-fonts fontconfig

# Build and install PNG
ADD libpng /png_build/
Expand Down Expand Up @@ -57,3 +58,7 @@ ENV MAKEFLAGS=
# Build and install SDL and portmidi
ADD portmidi /portmidi_build/
RUN ["bash", "/portmidi_build/build-portmidi.sh"]

ADD pypy /pypy_build/
RUN if [ "$BASE_IMAGE" = "manylinux2010_x86_64" ] ; then /pypy_build/getpypy64.sh ; else echo "no pypy on manylinux1" ; fi

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ else
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk
JRE_LIB_DIR=i386
fi
ls ${JAVA_HOME}
ls ${JAVA_HOME}/jre
ls ${JAVA_HOME}/jre/lib
ls ${JAVA_HOME}/jre/lib/$JRE_LIB_DIR
ls ${JAVA_HOME}/jre/lib/$JRE_LIB_DIR/server
# ls ${JAVA_HOME}
# ls ${JAVA_HOME}/jre
# ls ${JAVA_HOME}/jre/lib
# ls ${JAVA_HOME}/jre/lib/$JRE_LIB_DIR
# ls ${JAVA_HOME}/jre/lib/$JRE_LIB_DIR/server

cd portmidi/
patch -p1 < ../no-java.patch
#cmake -DJAVA_JVM_LIBRARY=${JAVA_HOME}/jre/lib/${JRE_LIB_DIR}/server/libjvm.so .
cmake -DCMAKE_BUILD_TYPE=Release .
make
Expand Down
69 changes: 69 additions & 0 deletions buildconfig/manylinux-build/docker_base/portmidi/no-java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Allow portmidi to build without its Java interface.

diff -rupN portmidi.orig/CMakeLists.txt portmidi/CMakeLists.txt
--- portmidi.orig/CMakeLists.txt 2019-04-12 14:13:22.542505935 +0100
+++ portmidi/CMakeLists.txt 2019-04-12 14:13:56.612622878 +0100
@@ -73,5 +73,5 @@ add_subdirectory(pm_test)
add_subdirectory(pm_dylib)

# Cannot figure out how to make an xcode Java application with CMake
-add_subdirectory(pm_java)
+#add_subdirectory(pm_java)

diff -rupN portmidi.orig/pm_common/CMakeLists.txt portmidi/pm_common/CMakeLists.txt
--- portmidi.orig/pm_common/CMakeLists.txt 2019-04-12 14:13:22.543505938 +0100
+++ portmidi/pm_common/CMakeLists.txt 2019-04-12 14:18:34.351576295 +0100
@@ -67,14 +67,14 @@ if(UNIX)
message(STATUS "SYSROOT: " ${CMAKE_OSX_SYSROOT})
else(APPLE)
# LINUX settings...
- include(FindJNI)
- message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
- message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
- message(STATUS "JAVA_INCLUDE_PATH2 is " ${JAVA_INCLUDE_PATH2})
- message(STATUS "JAVA_JVM_LIBRARY is " ${JAVA_JVM_LIBRARY})
- set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
+ #include(FindJNI)
+ #message(STATUS "JAVA_JVM_LIB_PATH is " ${JAVA_JVM_LIB_PATH})
+ #message(STATUS "JAVA_INCLUDE_PATH is " ${JAVA_INCLUDE_PATH})
+ #message(STATUS "JAVA_INCLUDE_PATH2 is " ${JAVA_INCLUDE_PATH2})
+ #message(STATUS "JAVA_JVM_LIBRARY is " ${JAVA_JVM_LIBRARY})
+ #set(JAVA_INCLUDE_PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
# libjvm.so is found relative to JAVA_INCLUDE_PATH:
- set(JAVAVM_LIB ${JAVA_JVM_LIBRARY}/libjvm.so)
+ #set(JAVAVM_LIB ${JAVA_JVM_LIBRARY}/libjvm.so)

set(LINUXSRC pmlinuxalsa pmlinux finddefault)
prepend_path(LIBSRC ../pm_linux/ ${LINUXSRC})
@@ -99,7 +99,7 @@ else(UNIX)
set(PM_NEEDED_LIBS winmm.lib)
endif(WIN32)
endif(UNIX)
-set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
+#set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})

# this completes the list of library sources by adding shared code
list(APPEND LIBSRC pmutil portmidi)
@@ -110,16 +110,16 @@ set_target_properties(portmidi-static PR
target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})

# define the jni library
-include_directories(${JAVA_INCLUDE_PATHS})
+#include_directories(${JAVA_INCLUDE_PATHS})

-set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
-add_library(pmjni SHARED ${JNISRC})
-target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
-set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
+#set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
+#add_library(pmjni SHARED ${JNISRC})
+#target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
+#set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")

# install the libraries (Linux and Mac OS X command line)
if(UNIX)
- INSTALL(TARGETS portmidi-static pmjni
+ INSTALL(TARGETS portmidi-static
LIBRARY DESTINATION /usr/local/lib
ARCHIVE DESTINATION /usr/local/lib)
# .h files installed by pm_dylib/CMakeLists.txt, so don't need them here
35 changes: 35 additions & 0 deletions buildconfig/manylinux-build/docker_base/pypy/getpypy32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e -x

if [[ "$1" == "manylinux1_i686" ]]; then
exit 0;
fi

cd /pypy_build/

PYPY27="pypy2.7-v7.3.2-linux32"
PYPY36="pypy3.6-v7.3.2-linux32"
PYPY37="pypy3.7-v7.3.2-linux32"

curl -sL https://downloads.python.org/pypy/${PYPY27}.tar.bz2 > ${PYPY27}.tar.bz2
curl -sL https://downloads.python.org/pypy/${PYPY36}.tar.bz2 > ${PYPY36}.tar.bz2
curl -sL https://downloads.python.org/pypy/${PYPY37}.tar.bz2 > ${PYPY37}.tar.bz2
sha512sum -c pypy32.sha512

mkdir -p /opt/python/pp27-pypy_73/
mkdir -p /opt/python/pp36-pypy36_pp73/
mkdir -p /opt/python/pp37-pypy37_pp73/
tar xvf ${PYPY27}.tar.bz2 -C /opt/python/pp27-pypy_73/ --strip 1
tar xvf ${PYPY36}.tar.bz2 -C /opt/python/pp36-pypy36_pp73/ --strip 1
tar xvf ${PYPY37}.tar.bz2 -C /opt/python/pp37-pypy37_pp73/ --strip 1

/opt/python/pp27-pypy_73/bin/pypy -m ensurepip
/opt/python/pp36-pypy36_pp73/bin/pypy -m ensurepip
/opt/python/pp37-pypy37_pp73/bin/pypy -m ensurepip

/opt/python/pp27-pypy_73/bin/pypy -m pip install wheel
/opt/python/pp36-pypy36_pp73/bin/pypy -m pip install wheel
/opt/python/pp37-pypy37_pp73/bin/pypy -m pip install wheel


cd ..
30 changes: 30 additions & 0 deletions buildconfig/manylinux-build/docker_base/pypy/getpypy64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e -x

cd /pypy_build/

PYPY27="pypy2.7-v7.3.2-linux64"
PYPY36="pypy3.6-v7.3.2-linux64"
PYPY37="pypy3.7-v7.3.2-linux64"

curl -sL https://downloads.python.org/pypy/${PYPY27}.tar.bz2 > ${PYPY27}.tar.bz2
curl -sL https://downloads.python.org/pypy/${PYPY36}.tar.bz2 > ${PYPY36}.tar.bz2
curl -sL https://downloads.python.org/pypy/${PYPY37}.tar.bz2 > ${PYPY37}.tar.bz2
sha512sum -c pypy64.sha512

mkdir -p /opt/python/pp27-pypy_73/
mkdir -p /opt/python/pp36-pypy36_pp73/
mkdir -p /opt/python/pp37-pypy37_pp73/
tar xvf ${PYPY27}.tar.bz2 -C /opt/python/pp27-pypy_73/ --strip 1
tar xvf ${PYPY36}.tar.bz2 -C /opt/python/pp36-pypy36_pp73/ --strip 1
tar xvf ${PYPY37}.tar.bz2 -C /opt/python/pp37-pypy37_pp73/ --strip 1

/opt/python/pp27-pypy_73/bin/pypy -m ensurepip
/opt/python/pp36-pypy36_pp73/bin/pypy -m ensurepip
/opt/python/pp37-pypy37_pp73/bin/pypy -m ensurepip

/opt/python/pp27-pypy_73/bin/pypy -m pip install wheel
/opt/python/pp36-pypy36_pp73/bin/pypy -m pip install wheel
/opt/python/pp37-pypy37_pp73/bin/pypy -m pip install wheel

cd ..
3 changes: 3 additions & 0 deletions buildconfig/manylinux-build/docker_base/pypy/pypy32.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
9d6ffa257c9291955cd638755471ef0bbc1ac00f56cc052b91d0475870cde482feb58920fa37aa410999b67592f7122ef787262a63f2ee51a5ac3460819dbc48 pypy2.7-v7.3.2-linux32.tar.bz2
fcd56593c3b7dab8fd1466caf2c5d1d4812b3c3cdec906b4cfd19f5e73d43dfa26b85fae4a8dc8a81d9f7b13f31299d004c8a3a8e433e3ea4486a7dcdaa79d03 pypy3.6-v7.3.2-linux32.tar.bz2
ca23fd09a0b445eea3373f011f9515c43ca11fecdd23cc34ed0f8c962eaef1047adbd5db4b825dcf6df62154cd6f4ccdb1d5d8809484d06018821aba260cc649 pypy3.7-v7.3.2-linux32.tar.bz2
3 changes: 3 additions & 0 deletions buildconfig/manylinux-build/docker_base/pypy/pypy64.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cabe458f4c17e317a66c8c32a793d0895e5e45c6e5d97b51712af98dd699df2f6a15ad124d7f7dce027e58b659813ca9c0d89bab30aaf51910375b7fe1d36916 pypy2.7-v7.3.2-linux64.tar.bz2
c5063394f417fb9c7aa44e541f76ff832848f97df6854207f750339c32cf0cc54a653576f1340ede1a30aa6c3344e336245053ac3bd39a4b62e1e16dd0b52764 pypy3.6-v7.3.2-linux64.tar.bz2
2fc0bacd1125f7691afaf25d37ea6c8602ddc379c1f03fe8910c4cbe2265b8780cfe3b781c3a551eadbed30847c279feb60f9ea0331242afa32114a92d1b8c38 pypy3.7-v7.3.2-linux64.tar.bz2
4 changes: 2 additions & 2 deletions test/sysfont_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_create_aliases(self):
def test_initsysfonts(self):
import pygame.sysfont
pygame.sysfont.initsysfonts()
self.assertTrue(len(pygame.sysfont.get_fonts()) > 1)
self.assertTrue(len(pygame.sysfont.get_fonts()) > 0)

@unittest.skipIf("Darwin" not in platform.platform(), "Not mac we skip.")
def test_initsysfonts_darwin(self):
Expand All @@ -32,7 +32,7 @@ def test_sysfont(self):
def test_initsysfonts_unix(self):
import pygame.sysfont

self.assertTrue(len(pygame.sysfont.get_fonts()) > 1)
self.assertTrue(len(pygame.sysfont.get_fonts()) > 0)

@unittest.skipIf("Windows" not in platform.platform(),
"Not windows we skip.")
Expand Down
Loading

0 comments on commit 92714bd

Please sign in to comment.