Skip to content

Commit

Permalink
Github workflow: Fix linking error on macOS
Browse files Browse the repository at this point in the history
 Homebrew has multiple versions of python which occasionally step on
 each other. Add the overwrite flag in the install process to
 explicity oveverwrite old links.

 Additionally add a call to brew upgrade to handle issues where
 new packages require updating already installed ones.
  • Loading branch information
jhoyt4 committed Feb 13, 2024
1 parent 62ad21b commit 2723561
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/buildmaster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,27 @@ jobs:
- name: Check cross-compile environment (macOS)
env:
ARCH: ${{ matrix.arch }}
PYTHONVERS: 3.12
run: |
SYSARCH=$(/usr/bin/uname -m)
PKGMGR_CMD='brew'
HB_PREFIX=$(${PKGMGR_CMD} --prefix)
echo "HB_PREFIX=$HB_PREFIX" >> $GITHUB_ENV
if [ "$SYSARCH" = "$ARCH" ]; then
# this is a cross-compile
PKGMGR_CMD="arch -${ARCH} $PKGMGR_CMD"
echo "CONFIGURE_CMD=arch -${ARCH} $CONFIGURE_CMD" >> $GITHUB_ENV
echo "MAKE_CMD=arch -${ARCH} $MAKE_CMD" >> $GITHUB_ENV
fi
echo "PKGMGR_CMD=$PKGMGR_CMD" >> $GITHUB_ENV
# Uninstall alternative python versions
INSTALLED_PYTHONS=$($PKGMGR_CMD list|grep 'python@')
for PYTH in $INSTALLED_PYTHONS; do
if [[ $PYTH != *"3.12"* ]]; then
$PKGMGR_CMD uninstall --ignore-dependencies $PYTH
fi
done
if: runner.os == 'macOS'

# N.B. These dependencies are for the master branch. Unlike the ansible
Expand All @@ -100,22 +111,23 @@ jobs:
env:
OS_VERS: ${{ matrix.os }}
run: |
brew update
${PKGMGR_CMD} install pkg-config ccache qt5 nasm libsamplerate taglib\
lzo libcec libbluray libass libhdhomerun dav1d x264 x265 libvpx \
openssl sound-touch lame freetype libass libiconv libxml2 libzip \
XviD zlib pyenv-virtualenv python-lxml python-requests \
python-setuptools
${PKGMGR_CMD} link qt5 --force
${PKGMGR_CMD} update
${PKGMGR_CMD} upgrade --force
${PKGMGR_CMD} install pkg-config ccache qt@5 nasm libsamplerate \
taglib lzo libcec libbluray libass libhdhomerun dav1d x264 x265 \
libvpx openssl sound-touch lame freetype libass libiconv libxml2 \
libzip XviD zlib pyenv-virtualenv python-lxml python-requests \
python-setuptools --force --overwrite
${PKGMGR_CMD} link qt@5 --force
${PKGMGR_CMD} link python --force --overwrite
# macos-14 updated the linker and needs to be run in "classic" mode
case $OS_VERS in
macos-14)
macos-14 | macos-13)
LDFLAGS="-Wl,-ld_classic"
;;
esac
# homebrew uses different prefixes on x86_64 and arm64, find the
# correct one and setup the correct build variables
HB_PREFIX=$(${PKGMGR_CMD} --prefix)
C_INCLUDE_PATH=$HB_PREFIX/include:$C_INCLUDE_PATH
echo "C_INCLUDE_PATH=$C_INCLUDE_PATH" >> $GITHUB_ENV
CPLUS_INCLUDE_PATH=$HB_PREFIX/include:$CPLUS_INCLUDE_PATH
Expand Down Expand Up @@ -169,7 +181,7 @@ jobs:

- name: Install plugin dependencies (macOS)
run: ${PKGMGR_CMD} install minizip flac libvorbis libcdio python-pycurl
python-oauthlib
python-oauthlib --force --overwrite
if: runner.os == 'macOS'

- name: Configure plugins
Expand Down

0 comments on commit 2723561

Please sign in to comment.