Add macOS builds to AppVeyor

This replaces macOS builds in Travis-ci deprecated
by e46f854b52
This commit is contained in:
Alejandro Martinez
2025-04-21 20:13:54 -03:00
parent 5ba6988597
commit e40ceddadf
8 changed files with 235 additions and 226 deletions

55
appveyor/macos/after_build.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
set -ev
cd src
echo "About to create dmg file and fix up"
mkdir GoldenCheetah.app/Contents/Frameworks
# Add VLC dylibs and plugins
cp ../VLC/lib/libvlc.dylib ../VLC/lib/libvlccore.dylib GoldenCheetah.app/Contents/Frameworks
cp -R ../VLC/plugins GoldenCheetah.app/Contents/Frameworks
# This is a hack to include libicudata.*.dylib, not handled by macdployqt[fix]
cp /usr/local/opt/icu4c/lib/libicudata.*.dylib GoldenCheetah.app/Contents/Frameworks
# Copy python framework and change permissions to fix paths
cp -R /Library/Frameworks/Python.framework GoldenCheetah.app/Contents/Frameworks
chmod -R +w GoldenCheetah.app/Contents/Frameworks
# Update deployed Python framework path
install_name_tool -id @executable_path/../Frameworks/Python.framework/Versions/3.7/Python ./GoldenCheetah.app/Contents/Frameworks/Python.framework/Versions/3.7/Python
# Update GoldenCheetah binary to reference deployed lib
install_name_tool -change /Library/Frameworks/Python.framework/Versions/3.7/Python @executable_path/../Frameworks/Python.framework/Versions/3.7/Python ./GoldenCheetah.app/Contents/MacOS/GoldenCheetah
# Update Python binary to reference deployed lib instead of the Cellar one
OLD_PATH=`otool -L GoldenCheetah.app/Contents/Frameworks/Python.framework/Versions/3.7/bin/python3.7 | grep "Library" | cut -f 1 -d ' '`
echo $OLD_PATH
install_name_tool -change $OLD_PATH "@executable_path/../Python" GoldenCheetah.app/Contents/Frameworks/Python.framework/Versions/3.7/bin/python3.7
install_name_tool -change $OLD_PATH "@executable_path/../../../../Python" GoldenCheetah.app/Contents/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
# Add mandatory Python dependencies
rm -r GoldenCheetah.app/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
cp -R ../site-packages GoldenCheetah.app/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7
# Initial deployment using macdeployqt
macdeployqt GoldenCheetah.app -verbose=2 -executable=GoldenCheetah.app/Contents/MacOS/GoldenCheetah
# Fix QtWebEngineProcess due to bug in macdployqt from homebrew
if [ ! -f GoldenCheetah.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess ]; then
cp -Rafv /usr/local/Cellar/qt/5.15.?/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents GoldenCheetah.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app
fi
pushd GoldenCheetah.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS
for LIB in QtGui QtCore QtWebEngineCore QtQuick QtWebChannel QtNetwork QtPositioning QtQmlModels QtQml
do
OLD_PATH=`otool -L QtWebEngineProcess | grep ${LIB}.framework | cut -f 1 -d ' '`
NEW_PATH="@loader_path/../../../../../../../${LIB}.framework/${LIB}"
echo ${OLD_PATH} ${NEW_PATH}
install_name_tool -change ${OLD_PATH} ${NEW_PATH} QtWebEngineProcess
done
popd
# Final deployment to generate dmg (may take longer than 10' without output)
macdeployqt GoldenCheetah.app -verbose=2 -fs=hfs+ -dmg
echo "Renaming dmg file to branch and build number ready for deploy"
mv GoldenCheetah.dmg ../GoldenCheetah_v3.7_x64.dmg
exit

84
appveyor/macos/before_build.sh Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/bash
set -ev
# Get config
cp qwt/qwtconfig.pri.in qwt/qwtconfig.pri
cp src/gcconfig.pri.in src/gcconfig.pri
# Bison
echo QMAKE_YACC=/usr/local/opt/bison@2.7/bin/bison >> src/gcconfig.pri
# Enable compress library
echo LIBZ_LIBS = -lz >> src/gcconfig.pri
# GSL
echo GSL_INCLUDES = /usr/local/include >> src/gcconfig.pri
echo GSL_LIBS = -L/usr/local/lib -lgsl -lgslcblas -lm >> src/gcconfig.pri
# Define GC version string, only for tagged builds
if [ -n "$TRAVIS_TAG" ]; then echo DEFINES += GC_VERSION=VERSION_STRING >> src/gcconfig.pri; fi
sed -i "" "s|#\(CONFIG += release.*\)|\1 static |" src/gcconfig.pri
sed -i "" "s|^#CloudDB|CloudDB|" src/gcconfig.pri
sed -i "" "s|^#LIBZ|LIBZ|" src/gcconfig.pri
# SRMIO
sed -i "" "s|#\(SRMIO_INSTALL =.*\)|\1 /usr/local|" src/gcconfig.pri
# D2XX
sed -i "" "s|libftd2xx.dylib|@executable_path/../Frameworks/libftd2xx.1.4.24.dylib|" src/FileIO/D2XX.cpp
sed -i "" "s|#\(D2XX_INCLUDE =.*\)|\1 ../D2XX|" src/gcconfig.pri
sed -i "" "s|#\(D2XX_LIBS =.*\)|\1 -L../D2XX -lftd2xx|" src/gcconfig.pri
# ICAL
sed -i "" "s|#\(ICAL_INSTALL =.*\)|\1 /usr/local|" src/gcconfig.pri
sed -i "" "s|#\(ICAL_LIBS =.*\)|\1 -L/usr/local/lib -lical|" src/gcconfig.pri
# LIBUSB
sed -i "" "s|#\(LIBUSB_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
sed -i "" "s|#\(LIBUSB_LIBS =.*\)|\1 -L/usr/local/lib -lusb-1.0|" src/gcconfig.pri
sed -i "" "s|#\(LIBUSB_USE_V_1 = true.*\)|\1|" src/gcconfig.pri
# SAMPLERATE
sed -i "" "s|#\(SAMPLERATE_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
sed -i "" "s|#\(SAMPLERATE_LIBS =\).*|\1 -L/usr/local/lib -lsamplerate|" src/gcconfig.pri
# LMFIT
sed -i "" "s|#\(LMFIT_INSTALL =\).*|\1 /usr/local|" src/gcconfig.pri
sed -i "" "s|#\(DEFINES += GC_HAVE_LION*\)|\1|" src/gcconfig.pri
# HTTP Server
sed -i "" "s|#\(HTPATH = ../httpserver.*\)|\1 |" src/gcconfig.pri
# Robot
sed -i "" "s|#\(DEFINES += GC_WANT_ROBOT.*\)|\1 |" src/gcconfig.pri
# VLC & VIDEO
sed -i "" "s|#\(VLC_INSTALL =.*\)|\1 ../VLC|" src/gcconfig.pri
sed -i "" "s|\(DEFINES += GC_VIDEO_NONE.*\)|#\1 |" src/gcconfig.pri
sed -i "" "s|#\(DEFINES += GC_VIDEO_VLC.*\)|\1 |" src/gcconfig.pri
# Enable R embedding
sed -i "" "s|#\(DEFINES += GC_WANT_R.*\)|\1 |" src/gcconfig.pri
# Python (avoiding collision between GC Context.h and Python context.h)
echo DEFINES += GC_WANT_PYTHON >> src/gcconfig.pri
echo PYTHONINCLUDES = -ICore `python3.7-config --includes` >> src/gcconfig.pri
echo PYTHONLIBS = `python3.7-config --ldflags` >> src/gcconfig.pri
# TrainerDay Query API
echo DEFINES += GC_WANT_TRAINERDAY_API >> src/gcconfig.pri
echo DEFINES += GC_TRAINERDAY_API_PAGESIZE=25 >> src/gcconfig.pri
# macOS version config
echo "QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -arch x86_64" >> src/gcconfig.pri
echo "QMAKE_CFLAGS_RELEASE += -mmacosx-version-min=10.7 -arch x86_64" >> src/gcconfig.pri
echo "QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15" >> src/gcconfig.pri
cat src/gcconfig.pri
# update translations
lupdate src/src.pro
exit

78
appveyor/macos/install.sh Executable file
View File

@@ -0,0 +1,78 @@
#!/bin/bash
set -ev
date
# Don't update or cleanup
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew install bison@2.7
brew install gsl
brew install libical
brew upgrade libusb
brew install libsamplerate
rm -rf '/usr/local/include/c++'
sudo chmod -R +w /usr/local
# R 4.1.1
curl -L -O https://cran.r-project.org/bin/macosx/base/R-4.1.1.pkg
sudo installer -pkg R-4.1.1.pkg -target /
R --version
# SRMIO
curl -L -O https://github.com/rclasen/srmio/archive/v0.1.1git1.tar.gz
tar xf v0.1.1git1.tar.gz
cd srmio-0.1.1git1
sh genautomake.sh
./configure --disable-shared --enable-static
make -j3 --silent
sudo make install
cd ..
# D2XX - refresh cache if folder is empty
if [ -z "$(ls -A D2XX)" ]; then
mkdir -p D2XX
curl -O https://ftdichip.com/wp-content/uploads/2021/05/D2XX1.4.24.zip
unzip D2XX1.4.24.zip
hdiutil mount D2XX1.4.24.dmg
cp /Volumes/dmg/release/build/libftd2xx.1.4.24.dylib D2XX
cp /Volumes/dmg/release/build/libftd2xx.a D2XX
cp /Volumes/dmg/release/*.h D2XX
fi
sudo cp D2XX/libftd2xx.1.4.24.dylib /usr/local/lib
# VLC
if [[ -z "$(ls -A VLC)" ]]; then
mkdir -p VLC
curl -O http://download.videolan.org/pub/videolan/vlc/3.0.8/macosx/vlc-3.0.8.dmg
hdiutil mount vlc-3.0.8.dmg
cp -R "/Volumes/VLC media player/VLC.app/Contents/MacOS/include" VLC/include
cp -R "/Volumes/VLC media player/VLC.app/Contents/MacOS/lib" VLC/lib
cp -R "/Volumes/VLC media player/VLC.app/Contents/MacOS/plugins" VLC/plugins
rm -f VLC/plugins/plugins.dat
fi
sudo cp VLC/lib/libvlc*.dylib /usr/local/lib
# Python 3.7.8
curl -O https://www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg
sudo installer -pkg python-3.7.9-macosx10.9.pkg -target /
python3.7 --version
python3.7-config --prefix
# Python mandatory packages - refresh cache if folder is empty
if [ -z "$(ls -A site-packages)" ]; then
mkdir -p site-packages
python3.7 -m pip install -q -r src/Python/requirements.txt -t site-packages
fi
# Python SIP
curl -k -L -O https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.8/sip-4.19.8.tar.gz
tar xf sip-4.19.8.tar.gz
cd sip-4.19.8
python3.7 configure.py
make -j4
sudo make install
cd ..
exit