Skip to content

Commit 86d7690

Browse files
authored
Merge pull request #1922 from pygame-community/ankith26-mac-fix
Fix mac freetype dylib circular import issue, make sure CI generated wheels are self-contained
2 parents 2fffd66 + f673855 commit 86d7690

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/workflows/build-macos.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,16 @@ jobs:
131131
export MAC_ARCH="${{ matrix.macarch }}"
132132
brew install pkg-config
133133
cd buildconfig/macdependencies
134+
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps
134135
bash ./install_mac_deps.sh
135136
136137
CIBW_BEFORE_BUILD: |
137138
pip install requests numpy Sphinx
138139
python setup.py docs
140+
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps
141+
142+
# To remove any speculations about the wheel not being self-contained
143+
CIBW_BEFORE_TEST: rm -rf ${{ github.workspace }}/pygame_mac_deps
139144

140145
CIBW_TEST_COMMAND: python -m pygame.tests -v --exclude opengl,timing --time_out 300
141146

buildconfig/manylinux-build/docker_base/freetype/build-freetype.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ make install
4747
if [[ "$OSTYPE" == "darwin"* ]]; then
4848
# Install to mac deps cache dir as well
4949
make install DESTDIR=${MACDEP_CACHE_PREFIX_PATH}
50+
51+
# We do a little hack...
52+
# When freetype finds harfbuzz with pkg-config, we tell freetype a little
53+
# lie that harfbuzz doesn't depend on freetype (even though it does).
54+
# This ensures no direct circular dylib link happen.
55+
# This is a bit of a brittle hack: This command removes the entire line that
56+
# contains "freetype". This is fine for now when the harfbuzz we are
57+
# building has no other dependencies
58+
sed -i '' '/freetype/d' /usr/local/lib/pkgconfig/harfbuzz.pc
59+
sed -i '' 's/ \/usr\/local\/lib\/libfreetype.la//g' /usr/local/lib/libharfbuzz.la
5060
fi
5161

5262
cd ..
@@ -56,6 +66,9 @@ cd $FREETYPE
5666

5767
# fully clean previous install
5868
make clean
69+
if [[ "$OSTYPE" == "darwin"* ]]; then
70+
make uninstall
71+
fi
5972

6073
./configure $ARCHS_CONFIG_FLAG --with-harfbuzz=yes
6174
make

0 commit comments

Comments
 (0)