Skip to content

Commit

Permalink
Use ANGLE build from kivy/angle-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
misl6 committed Feb 7, 2024
1 parent 1e64ac1 commit 4ad4c07
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 57 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/osx_wheels_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ jobs:
- name: Install build dependencies
run: |
brew install pkg-config cmake ninja
- name: Build universal Kivy dependencies (needs depot_tools for ANGLE build)
- name: Build universal Kivy dependencies
run: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /tmp/depot_tools
export PATH=$PATH:/tmp/depot_tools
./tools/build_macos_dependencies.sh
- name: Install cibuildwheel
run: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test_osx_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ jobs:
- name: Install build dependencies
run: |
brew install pkg-config cmake ninja
- name: Install dependencies (needs depot_tools for ANGLE build)
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /tmp/depot_tools
export PATH=$PATH:/tmp/depot_tools
./tools/build_macos_dependencies.sh
install_kivy_test_run_pip_deps
- name: Install Kivy
Expand Down
64 changes: 13 additions & 51 deletions tools/build_macos_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ MACOS__LIBPNG__VERSION="1.6.40"
MACOS__LIBPNG__URL="https://download.sourceforge.net/libpng/libpng16/${MACOS__LIBPNG__VERSION}/libpng-${MACOS__LIBPNG__VERSION}.tar.gz"
MACOS__LIBPNG__FOLDER="libpng-${MACOS__LIBPNG__VERSION}"

MACOS__ANGLE__VERSION="chromium/6045"
MACOS__ANGLE__VERSION="chromium-6045_rev1"
MACOS__ANGLE__PACKAGE="angle-chromium__6045-macos-universal.zip"
MACOS__ANGLE_URL="https://github.com/kivy/angle-builder/releases/download/${MACOS__ANGLE__VERSION}/${MACOS__ANGLE__PACKAGE}"

# Clean the dependencies folder
rm -rf kivy-dependencies
Expand All @@ -42,6 +44,7 @@ curl -L $MACOS__SDL2_IMAGE__URL -o "${MACOS__SDL2_IMAGE__FOLDER}.tar.gz"
curl -L $MACOS__SDL2_MIXER__URL -o "${MACOS__SDL2_MIXER__FOLDER}.tar.gz"
curl -L $MACOS__SDL2_TTF__URL -o "${MACOS__SDL2_TTF__FOLDER}.tar.gz"
curl -L $MACOS__LIBPNG__URL -o "${MACOS__LIBPNG__FOLDER}.tar.gz"
curl -L $MACOS__ANGLE_URL -o $MACOS__ANGLE__PACKAGE
popd

# Extract the dependencies into build folder
Expand All @@ -62,62 +65,21 @@ mkdir kivy-dependencies/dist/Frameworks
mkdir kivy-dependencies/dist/include
mkdir kivy-dependencies/dist/lib

# Extract ANGLE in distribution folder
echo "Extracting ANGLE..."
pushd kivy-dependencies/dist
unzip "../download/${MACOS__ANGLE__PACKAGE}" -d "angle"
cp -r angle/include/* include
cp angle/*.dylib lib
rm -r "angle"
popd

LIBPNG_SEARCH_PATH="$(pwd)/kivy-dependencies/dist/Frameworks/png.framework/Headers"
FRAMEWORK_SEARCH_PATHS="$(pwd)/kivy-dependencies/dist/Frameworks"

# Build the dependencies
pushd kivy-dependencies/build

echo "-- Clone Google ANGLE"
git clone -b "${MACOS__ANGLE__VERSION}" --single-branch https://github.com/google/angle
pushd angle

echo "-- Create, activate and prepare virtual environment for ANGLE"
python3 -m venv venv
source venv/bin/activate
pip install setuptools

echo "-- Bootstrap ANGLE"
python scripts/bootstrap.py

echo "-- Sync ANGLE (this will take a while)"
gclient sync

echo "-- Generate ANGLE build files for x86_64"
gn gen out/Release_macOS_x86_64 --args='is_component_build=false is_debug=false target_cpu="x64" target_os="mac"'

echo "-- Generate ANGLE build files for arm64"
gn gen out/Release_macOS_arm64 --args='is_component_build=false is_debug=false target_cpu="arm64" target_os="mac"'

echo "-- Build ANGLE for x86_64"
autoninja -C out/Release_macOS_x86_64 libEGL libGLESv2

echo "-- Build ANGLE for arm64"
autoninja -C out/Release_macOS_arm64 libEGL libGLESv2

echo "-- Deactivate virtual environment"
deactivate

echo "-- Copy include files from ANGLE to the distribution folder"
cp -r include/* ../../dist/include

echo "-- Create a fat library for libEGL"
lipo -create out/Release_macOS_x86_64/libEGL.dylib out/Release_macOS_arm64/libEGL.dylib -output ../../dist/lib/libEGL.dylib

echo "-- Create a fat library for libGLESv2"
lipo -create out/Release_macOS_x86_64/libGLESv2.dylib out/Release_macOS_arm64/libGLESv2.dylib -output ../../dist/lib/libGLESv2.dylib

echo "-- Change the install name of libEGL.dylib to @rpath/libEGL.dylib"
install_name_tool -id @rpath/libEGL.dylib ../../dist/lib/libEGL.dylib

echo "-- Change the install name of libGLESv2.dylib to @rpath/libGLESv2.dylib"
install_name_tool -id @rpath/libGLESv2.dylib ../../dist/lib/libGLESv2.dylib

echo "-- ANGLE build complete"

popd


# libpng is neeeded by SDL2_ttf to render emojis
echo "-- Build libpng (Universal)"
pushd $MACOS__LIBPNG__FOLDER
Expand Down

0 comments on commit 4ad4c07

Please sign in to comment.