-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build macOS environment on GitHub Actions, update dependencies, add ccache #94
Changes from all commits
f5511ed
7142c25
26fafc6
e451438
fe7e539
350c11d
3c72d81
2848fd7
83a27db
8262d05
f0f7b4b
73651d8
c379ab6
0acdeff
3158db7
681e49c
1f9e8b0
e1a14b6
8759f59
5a88752
3a7a22b
ef84d98
063cc2d
dd844a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Build | ||
|
||
on: [pull_request, push] | ||
|
||
jobs: | ||
build-mac: | ||
name: macOS | ||
runs-on: macos-10.15 | ||
env: | ||
DEPENDENCY_CACHE: /Users/runner/dependencies | ||
steps: | ||
- name: checkout Git repository | ||
uses: actions/checkout@v2 | ||
- name: dependency cache | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: dependencies | ||
with: | ||
path: ${{ env.DEPENDENCY_CACHE }} | ||
key: ${{ env.cache-name }}-${{ runner.os}}-${{ hashFiles('download_dependencies.sh') }} | ||
restore-keys: | | ||
${{ env.cache-name }}-${{ runner.os }} | ||
- name: ccache | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: ccache | ||
with: | ||
path: /Users/runner/Library/Caches/ccache | ||
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.head_ref }}-${{ github.run_number }} | ||
restore-keys: | | ||
${{ env.cache-name }}-${{ runner.os }}-${{ github.head_ref }} | ||
${{ env.cache-name }}-${{ runner.os }} | ||
- name: build | ||
env: | ||
# 10.12 is the minimum macOS version for Qt 5.12 | ||
MACOSX_DEPLOYMENT_TARGET: 10.12 | ||
BRANCH_NAME: 2.3 | ||
ARCHITECTURE: x86_64 | ||
run: | | ||
# Quit on errors. | ||
# See also: | ||
# - http://mywiki.wooledge.org/BashFAQ/105 | ||
# - https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ | ||
set -e -o pipefail | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm petrry sure that bash scripts are executes with pipefail anyway |
||
# Local echo. | ||
set -x | ||
|
||
# remove last number (patch number) from version number because Qt's configure script doesn't work with it | ||
if [[ $(xcrun --show-sdk-version) =~ ([0-9]*\.[0-9]*)(.[0-9]*)? ]]; then | ||
export MACOSX_SDK=${BASH_REMATCH[1]} | ||
else | ||
echo "macOS SDK version did not match expected format" | ||
exit | ||
fi | ||
SHA=`git rev-parse --short HEAD` | ||
ENVIRONMENT_NAME=${BRANCH_NAME}-${SHA}-sdk${MACOSX_SDK}-macosminimum${MACOSX_DEPLOYMENT_TARGET}-${ARCHITECTURE} | ||
|
||
mkdir -p environment/${ENVIRONMENT_NAME} | ||
|
||
scripts/macosx/download_dependencies.sh ${DEPENDENCY_CACHE} | ||
scripts/macosx/build_environment.sh --macosx-sdk ${MACOSX_SDK} --dependency-cache ${DEPENDENCY_CACHE} --name ${ENVIRONMENT_NAME} --macosx-stdlib libc++ --enable-x86-64 2>&1 | tee environment/${ENVIRONMENT_NAME}/build_environment.log | ||
tar -C environment -czf ${ENVIRONMENT_NAME}.tar.gz ${ENVIRONMENT_NAME} | ||
- name: upload macOS build environment artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: macOS-build-environment | ||
path: ./*.tar.gz |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Echo commands | ||
set -x | ||
|
||
# Quit on errors | ||
set -e | ||
|
||
# Get the path to our scripts folder. | ||
pushd `dirname $0` > /dev/null | ||
PROGDIR=`pwd -P` | ||
popd > /dev/null | ||
|
||
export VERSION_NUMBER=4.0 | ||
export VERSION=ccache-${VERSION_NUMBER} | ||
export ARCHIVE=$VERSION.tar.gz | ||
|
||
echo "Building $VERSION for $MIXXX_ENVIRONMENT_NAME for architectures: ${MIXXX_ARCHS[@]}" | ||
|
||
for ARCH in ${MIXXX_ARCHS[@]} | ||
do | ||
mkdir -p $VERSION-$ARCH | ||
tar -zxf $DEPENDENCIES/$ARCHIVE -C $VERSION-$ARCH --strip-components 1 | ||
cd $VERSION-$ARCH | ||
source $PROGDIR/environment.sh $ARCH | ||
# environment.sh sets CC/CXX to use ccache, but it hasn't been built yet at this point | ||
export XCODE_ROOT=$(xcode-select -print-path) | ||
export CC="${XCODE_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" | ||
export CXX="${XCODE_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" | ||
export CPP="$CC -E" | ||
export CXXCPP="$CXX -E" | ||
# The GitHub Action macOS VM has zstd in /usr/local/opt | ||
# Make sure ccache links to the libzstd in the build environment instead so | ||
# it can be used locally for working on Mixxx on macOS. | ||
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$MIXXX_PREFIX" -DCMAKE_INSTALL_RPATH="@loader_path/../lib" -DCMAKE_INSTALL_PREFIX="$MIXXX_PREFIX" -DCMAKE_OSX_DEPLOYMENT_TARGET="$MIXXX_MACOSX_TARGET" -DCMAKE_OSX_SYSROOT="$SDKROOT" -DCMAKE_VERBOSE_MAKEFILE=TRUE -DBUILD_SHARED_LIBS=TRUE | ||
cmake --build . --target install | ||
cd .. | ||
done | ||
|
||
ccache -M 5G |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ export QTDIR=$MIXXX_PREFIX/Qt-${VERSION_NUMBER} | |
# Disable relocatable qt due to https://bugs.launchpad.net/mixxx/+bug/1871238 | ||
# TODO(rryan): Disable framework build or use frameworks properly. Qt assumes | ||
# that if frameworks are enabled then they are used for deployment. | ||
./configure -opensource -prefix $QTDIR -sdk macosx${MIXXX_MACOSX_SDK} -system-sqlite -sql-sqlite -qt-zlib -platform macx-clang -release -confirm-license -securetransport -force-debug-info -no-feature-relocatable -nomake examples -nomake tests -skip qt3d -skip qtwebengine -I${MIXXX_PREFIX}/include -L${MIXXX_PREFIX}/lib | ||
./configure -opensource -prefix $QTDIR -sdk macosx${MIXXX_MACOSX_SDK} -ccache -system-sqlite -sql-sqlite -qt-zlib -platform macx-clang -release -confirm-license -securetransport -force-debug-info -nomake examples -nomake tests -skip qt3d -skip qtwebengine -I${MIXXX_PREFIX}/include -L${MIXXX_PREFIX}/lib | ||
Be-ing marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we put Qt in a separate subdirectory? That makes specifying the correct CMAKE_PREFIX_PATH much harder for Windows/macos devs. Can we change that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know. I asked @rryan this on Zulip and did not get a response. AFAIK we could change it. But there is no pressing need to either. |
||
|
||
make && make install | ||
cd .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done