Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH Actions make /usr/local cache for mac deps
- Loading branch information
Ankith
committed
Oct 12, 2021
1 parent
553a63d
commit 122b60f
Showing
23 changed files
with
381 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This uses manylinux build scripts to build dependencies | ||
# on mac. | ||
# | ||
# Warning: this should probably not be run on your own mac. | ||
# Since it will install all these deps all over the place, | ||
# and they may conflict with existing installs you have. | ||
|
||
set -e -x | ||
|
||
export MACDEP_CACHE_PREFIX_PATH=${GITHUB_WORKSPACE}/pygame_mac_deps | ||
|
||
bash ./clean_usr_local.sh | ||
mkdir $MACDEP_CACHE_PREFIX_PATH | ||
|
||
# to use the gnu readlink, needs `brew install coreutils` | ||
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" | ||
|
||
# for great speed. | ||
export MAKEFLAGS="-j 4" | ||
export MACOSX_DEPLOYMENT_TARGET=10.9 | ||
|
||
cd ../manylinux-build/docker_base | ||
|
||
# Now start installing dependencies | ||
# --------------------------------- | ||
|
||
# sdl_image deps | ||
bash zlib/build-zlib.sh | ||
bash libpng/build-png.sh # depends on zlib | ||
bash libjpeg/build-jpeg.sh | ||
bash libtiff/build-tiff.sh | ||
bash libwebp/build-webp.sh | ||
|
||
# sdl_ttf deps | ||
# export EXTRA_CONFIG_FREETYPE=--without-harfbuzz | ||
# bash freetype/build-freetype.sh | ||
# bash harfbuzz/build-harfbuzz.sh | ||
# export EXTRA_CONFIG_FREETYPE= | ||
bash freetype/build-freetype.sh | ||
|
||
# sdl_mixer deps | ||
bash libmodplug/build-libmodplug.sh | ||
bash ogg/build-ogg.sh | ||
bash flac/build-flac.sh | ||
bash mpg123/build-mpg123.sh | ||
|
||
# fluidsynth (for sdl_mixer) | ||
bash gettext/build-gettext.sh | ||
bash glib/build-glib.sh # depends on gettext | ||
bash sndfile/build-sndfile.sh | ||
sudo mkdir -p /usr/local/lib64 # the install tries to put something in here | ||
sudo mkdir -p ${MACDEP_CACHE_PREFIX_PATH}/usr/local/lib64 | ||
sudo bash fluidsynth/build-fluidsynth.sh # sudo otherwise install doesn't work. | ||
|
||
bash sdl_libs/build-sdl2-libs.sh | ||
|
||
# for pygame.midi | ||
bash portmidi/build-portmidi.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Cleans /usr/local for the install of mac deps, deleting things that are not | ||
# required, or things that will be replaced with something else | ||
|
||
|
||
# First clean up some homebrew stuff we don't want linked in | ||
# ---------------------------------------------------------- | ||
|
||
rm -rf /usr/local/bin/curl | ||
rm -rf /usr/local/opt/curl | ||
rm -rf /usr/local/bin/git | ||
rm -rf /usr/local/opt/git | ||
# Use the apple provided curl, and git. | ||
# The homebrew ones depend on libs we don't want to include. | ||
# ln -s /usr/bin/curl /usr/local/bin/curl | ||
ln -s /usr/bin/git /usr/local/bin/git | ||
|
||
rm -rf /usr/local/lib/libtiff* | ||
rm -rf /usr/local/lib/libsndfile* | ||
rm -rf /usr/local/lib/glib* | ||
rm -rf /usr/local/lib/libglib* | ||
rm -rf /usr/local/lib/libgthread* | ||
rm -rf /usr/local/lib/libintl* | ||
rm -rf /usr/local/lib/libbrotlidec* | ||
rm -rf /usr/local/lib/libopus* | ||
rm -rf /usr/local/opt/freetype | ||
|
||
rm -rf /usr/local/Cellar/libtiff | ||
rm -rf /usr/local/Cellar/libsndfile | ||
rm -rf /usr/local/Cellar/glib | ||
rm -rf /usr/local/Cellar/brotli | ||
rm -rf /usr/local/Cellar/pcre | ||
rm -rf /usr/local/Cellar/opus | ||
rm -rf /usr/local/Cellar/freetype | ||
|
||
rm -rf /usr/local/opt/gettext | ||
|
||
rm -rf /usr/local/share/doc/tiff-* | ||
rm -rf /usr/local/share/doc/libsndfile | ||
rm -rf /usr/local/share/glib-2.0 | ||
rm -rf /usr/local/share/gdb/auto-load | ||
|
||
rm -rf /usr/local/include/glib-2.0 | ||
rm -rf /usr/local/include/gio-unix-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
A python helper script to install built (cached) mac deps into /usr/local | ||
""" | ||
|
||
import shutil | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
def rmpath(path: Path, verbose: bool = False): | ||
""" | ||
Tries to remove a path of any kind | ||
""" | ||
if path.is_symlink(): | ||
if verbose: | ||
print(f"- Removing existing symlink at '{path}'") | ||
|
||
path.unlink() | ||
|
||
elif path.is_file(): | ||
if verbose: | ||
print(f"- Removing existing file at '{path}'") | ||
|
||
path.unlink() | ||
|
||
elif path.is_dir(): | ||
if verbose: | ||
print(f"- Removing existing directory at '{path}'") | ||
|
||
shutil.rmtree(path) | ||
|
||
|
||
def symtree(srcdir: Path, destdir: Path, verbose: bool = False): | ||
""" | ||
This function creates symlinks pointing to srcdir, from destdir, such that | ||
existing folders and files in the tree of destdir are retained | ||
""" | ||
if not destdir.is_dir(): | ||
# dest dir does not exist at all, create dir symlink | ||
rmpath(destdir, verbose) | ||
if verbose: | ||
print( | ||
f"- Creating directory symlink from '{destdir}' pointing to '{srcdir}'" | ||
) | ||
|
||
destdir.symlink_to(srcdir) | ||
return | ||
|
||
for path in srcdir.glob("*"): | ||
destpath = destdir / path.name | ||
if path.is_dir(): | ||
symtree(path, destpath, verbose) | ||
else: | ||
rmpath(destpath, verbose) | ||
if verbose: | ||
print(f"- Creating file symlink from '{destpath}' pointing to '{path}'") | ||
|
||
destpath.symlink_to(path) | ||
|
||
|
||
symtree(Path(sys.argv[1]), Path("/"), verbose=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,9 @@ | ||
# This uses manylinux build scripts to build dependencies | ||
# on mac. | ||
# | ||
# Warning: this should probably not be run on your own mac. | ||
# Since it will install all these deps all over the place, | ||
# and they may conflict with existing installs you have. | ||
|
||
# A script to install mac deps in /usr/local | ||
set -e -x | ||
cd ../manylinux-build/docker_base | ||
|
||
# to use the gnu readlink, needs `brew install coreutils` | ||
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" | ||
|
||
# for great speed. | ||
export MAKEFLAGS="-j 4" | ||
export MACOSX_DEPLOYMENT_TARGET=10.9 | ||
|
||
|
||
# First clean up some homebrew stuff we don't want linked in | ||
# ---------------------------------------------------------- | ||
|
||
rm -rf /usr/local/bin/curl | ||
rm -rf /usr/local/opt/curl | ||
rm -rf /usr/local/bin/git | ||
rm -rf /usr/local/opt/git | ||
# Use the apple provided curl, and git. | ||
# The homebrew ones depend on libs we don't want to include. | ||
# ln -s /usr/bin/curl /usr/local/bin/curl | ||
ln -s /usr/bin/git /usr/local/bin/git | ||
|
||
rm -rf /usr/local/lib/libtiff* | ||
rm -rf /usr/local/lib/libsndfile* | ||
rm -rf /usr/local/lib/glib* | ||
rm -rf /usr/local/lib/libglib* | ||
rm -rf /usr/local/lib/libgthread* | ||
rm -rf /usr/local/lib/libintl* | ||
rm -rf /usr/local/lib/libbrotlidec* | ||
rm -rf /usr/local/lib/libopus* | ||
rm -rf /usr/local/opt/freetype | ||
|
||
rm -rf /usr/local/Cellar/libtiff | ||
rm -rf /usr/local/Cellar/libsndfile | ||
rm -rf /usr/local/Cellar/glib | ||
rm -rf /usr/local/Cellar/brotli | ||
rm -rf /usr/local/Cellar/pcre | ||
rm -rf /usr/local/Cellar/opus | ||
rm -rf /usr/local/Cellar/freetype | ||
|
||
rm -rf /usr/local/opt/gettext | ||
|
||
rm -rf /usr/local/share/doc/tiff-* | ||
rm -rf /usr/local/share/doc/libsndfile | ||
rm -rf /usr/local/share/glib-2.0 | ||
rm -rf /usr/local/share/gdb/auto-load | ||
|
||
rm -rf /usr/local/include/glib-2.0 | ||
rm -rf /usr/local/include/gio-unix-2.0 | ||
|
||
|
||
# Now start installing dependencies | ||
# --------------------------------- | ||
|
||
# sdl_image deps | ||
bash zlib/build-zlib.sh | ||
bash libpng/build-png.sh # depends on zlib | ||
bash libjpeg/build-jpeg.sh | ||
bash libtiff/build-tiff.sh | ||
bash libwebp/build-webp.sh | ||
|
||
# sdl_ttf deps | ||
# export EXTRA_CONFIG_FREETYPE=--without-harfbuzz | ||
# bash freetype/build-freetype.sh | ||
# bash harfbuzz/build-harfbuzz.sh | ||
# export EXTRA_CONFIG_FREETYPE= | ||
bash freetype/build-freetype.sh | ||
|
||
# sdl_mixer deps | ||
bash libmodplug/build-libmodplug.sh | ||
bash ogg/build-ogg.sh | ||
bash flac/build-flac.sh | ||
bash mpg123/build-mpg123.sh | ||
|
||
# fluidsynth (for sdl_mixer) | ||
bash gettext/build-gettext.sh | ||
bash glib/build-glib.sh # depends on gettext | ||
bash sndfile/build-sndfile.sh | ||
sudo mkdir -p /usr/local/lib64 # the install tries to put something in here | ||
sudo bash fluidsynth/build-fluidsynth.sh # sudo otherwise install doesn't work. | ||
|
||
bash sdl_libs/build-sdl2-libs.sh | ||
bash ./clean_usr_local.sh | ||
sudo python3 install_mac_deps.py ${GITHUB_WORKSPACE}/pygame_mac_deps | ||
|
||
# for pygame.midi | ||
bash portmidi/build-portmidi.sh | ||
# strangely somehow the built pygame links against the libportmidi.dylib here: | ||
cp /usr/local/lib/libportmidi.dylib /Users/runner/work/pygame/pygame/libportmidi.dylib | ||
# strangely somehow the built pygame links against the libportmidi.dylib here, so | ||
# copy the dylib | ||
cp /usr/local/lib/libportmidi.dylib ${GITHUB_WORKSPACE}/libportmidi.dylib |
Oops, something went wrong.