Skip to content

Build and Package CmusicAI for macOS #59

Build and Package CmusicAI for macOS

Build and Package CmusicAI for macOS #59

name: Build and Package CmusicAI for macOS
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates curl g++ git pkg-config autoconf librsvg2-bin libtiff-tools libtool automake bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python python-dev python-setuptools fonts-tuffy \
clang qtbase5-dev qttools5-dev-tools qtdeclarative5-dev libboost-all-dev libminiupnpc-dev protobuf-compiler libprotobuf-dev inkscape
- name: Install SDKs and Toolchain
run: |
mkdir -p depends/SDKs
cd depends/SDKs
curl -O https://bitcoincore.org/depends-sources/sdks/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz
tar -zxf Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz
- name: Install Berkeley DB
run: |
chmod +x contrib/install_db4.sh
./contrib/install_db4.sh $(pwd)
- name: Generate background.tiff files
run: |
sed 's/PACKAGE_NAME/CmusicAI Core/' < "contrib/macdeploy/background.svg" > background.temp.svg
rsvg-convert -f png -d 36 -p 36 background.temp.svg -o dpi36.background.png
convert dpi36.background.png dpi36.background.tiff
rsvg-convert -f png -d 72 -p 72 background.temp.svg -o dpi72.background.png
convert dpi72.background.png dpi72.background.tiff
- name: Export Paths
run: |
export PATH=${GITHUB_WORKSPACE}/depends/x86_64-apple-darwin14/native/bin:$PATH
- name: Prepare Build Environment
run: |
cd ${GITHUB_WORKSPACE}
if [ ! -f ./configure ]; then
echo "Generating configure script"
./autogen.sh
fi
- name: Configure Build
run: |
set -x
cd ${GITHUB_WORKSPACE}
export BDB_PREFIX=${GITHUB_WORKSPACE}/db4
export BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8"
export BDB_CFLAGS="-I${BDB_PREFIX}/include"
export BOOST_ROOT=/usr/include/boost
export BOOST_LIB_PATH=/usr/lib/x86_64-linux-gnu
CONFIG_SITE=${GITHUB_WORKSPACE}/depends/x86_64-apple-darwin14/share/config.site \
./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking --enable-reduce-exports --disable-bench --with-gui=qt5 --with-boost=${BOOST_ROOT} --with-boost-libdir=${BOOST_LIB_PATH} GENISOIMAGE=${GITHUB_WORKSPACE}/depends/x86_64-apple-darwin14/native/bin/genisoimage BDB_LIBS="${BDB_LIBS}" BDB_CFLAGS="${BDB_CFLAGS}"
- name: Build CmusicAI
run: |
make -j$(nproc)
- name: Build macOS Tools
run: |
cd ${GITHUB_WORKSPACE}/depends
make HOST=x86_64-apple-darwin14 V=1
- name: Ensure Permissions
run: |
chmod -R 755 ${GITHUB_WORKSPACE}
- name: Archive build artifacts
run: |
mkdir -p build_artifacts
cp -r ${GITHUB_WORKSPACE}/src build_artifacts/
cp -r ${GITHUB_WORKSPACE}/depends build_artifacts/
cp -r ${GITHUB_WORKSPACE}/contrib build_artifacts/
cp -r ${GITHUB_WORKSPACE}/build-aux build_artifacts/
zip -r build_artifacts.zip build_artifacts/
- name: Upload Build Artifacts
uses: actions/upload-artifact@v2
with:
name: cmusicai-build
path: build_artifacts.zip
package:
needs: build
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download Build Artifacts
uses: actions/download-artifact@v2
with:
name: cmusicai-build
path: .
- name: Unzip Build Artifacts
run: |
unzip build_artifacts.zip -d ${GITHUB_WORKSPACE}
- name: Ensure Permissions
run: |
chmod -R 755 ${GITHUB_WORKSPACE}
- name: Install and Package
run: |
# Ensure required tools have the right permissions
chmod +x ${GITHUB_WORKSPACE}/build_artifacts/depends/x86_64-apple-darwin14/native/bin/dmg
chmod +x ${GITHUB_WORKSPACE}/build_artifacts/depends/x86_64-apple-darwin14/native/bin/genisoimage
chmod +x ${GITHUB_WORKSPACE}/build_artifacts/depends/x86_64-apple-darwin14/native/bin/x86_64-apple-darwin14-*
chmod +x ${GITHUB_WORKSPACE}/build_artifacts/depends/x86_64-apple-darwin14/native/bin/codesign_allocate
chmod +x /usr/bin/install_name_tool
chmod +x /usr/bin/strip
export OTOOL=/usr/bin/otool
export INSTALLNAMETOOL=/usr/bin/install_name_tool
export STRIP=/usr/bin/strip
echo "Checking if otool is accessible and executable"
ls -l /usr/bin/otool
echo "Checking if install_name_tool is accessible and executable"
ls -l /usr/bin/install_name_tool
echo "Running macdeployqtplus"
/usr/bin/python3 ./contrib/macdeploy/macdeployqtplus CmusicAI-Qt.app -translations-dir= -add-qt-tr da,de,es,hu,ru,uk,zh_CN,zh_TW -verbose 2
- name: Debugging Information
run: |
echo "Checking permissions and paths"
ls -l
ls -l CmusicAI-Qt.app/Contents/MacOS
ls -l CmusicAI-Qt.app/Contents/Resources
env
- name: Upload config.log
if: failure()
uses: actions/upload-artifact@v2
with:
name: config-log
path: /home/runner/work/Cmusic/Cmusic/depends/work/build/x86_64-apple-darwin14/native_cctools/*/cctools/config.log