diff --git a/.azure/azure-pipelines-mac.yml b/.azure/azure-pipelines-mac.yml index 5665acef..70b53c10 100644 --- a/.azure/azure-pipelines-mac.yml +++ b/.azure/azure-pipelines-mac.yml @@ -13,8 +13,14 @@ trigger: - '.cirrus.yml' - 'README.md' +parameters: +- name: UseCache + displayName: Use Dependency Cache + type: boolean + default: true + jobs: -- job: macOS +- job: macOS_brew strategy: matrix: UnixLibs: @@ -26,6 +32,9 @@ jobs: 11_0: imageName: 'macos-11' CMakeFlags: '' + 12_0: + imageName: 'macos-12' + CMakeFlags: '' pool: vmImage: $(imageName) @@ -67,3 +76,123 @@ jobs: cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) .. make install displayName: 'Install fluidsynth to artifact dir' + + +- job: macOS_ports + timeoutInMinutes: 300 + strategy: + matrix: + # SDL2/SDL_cpuinfo.h includes some x86 specific headers, which ofc doesn't work when cross compiling for arm64 + # And this universal build thingy doesn't work on Mac10.15 for some reason... + # Furthermore, there is a problem when restoring the cache on Mac11, so disable this job as well + #11_0_universal_unixlibs: + # macPortsUrl: 'https://github.com/macports/macports-base/releases/download/v2.7.2/MacPorts-2.7.2-11-BigSur.pkg' + # imageName: 'macos-11' + # CMakeFlags: '-Denable-sdl2=0 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -Denable-framework=0 -DLIB_SUFFIX=""' + 12_0_universal_unixlibs: + macPortsUrl: 'https://github.com/macports/macports-base/releases/download/v2.7.2/MacPorts-2.7.2-12-Monterey.pkg' + imageName: 'macos-12' + CMakeFlags: '-Denable-sdl2=0 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -Denable-framework=0 -DLIB_SUFFIX=""' + pool: + vmImage: $(imageName) + steps: + - script: | + set -ex + brew install wget pkg-config + wget $(macPortsUrl) + sudo installer -pkg *.pkg -target / + rm -f *.pkg + sudo chown -R $(id -u):$(id -g) /opt/local + sudo chflags nouchg /opt/local + displayName: 'Prerequisites' + workingDirectory: $(Agent.TempDirectory) + - task: Cache@2 + continueOnError: true + displayName: "Cache macPort packages" + condition: and(not(in(variables['Build.Reason'], 'Schedule')), ${{ parameters.useCache }}) + inputs: + key: '"$(Agent.OS)" | "$(imageName)" | "$(macPortsUrl)" | "versionalways"' + path: '/opt/local' + cacheHitVar: CACHE_RESTORED + - script: | + set -x + export PATH=$PATH:/opt/local/bin + echo $PATH + which codesign + codesign --help + which port + echo "+universal" | sudo tee -a /opt/local/etc/macports/variants.conf + + sudo sh -c 'cat << EOF >> /opt/local/etc/macports/macports.conf + buildfromsource always + universal_archs arm64 x86_64 + ui_interactive no + EOF' + + sudo port deps glib2-devel + sudo port deps libsndfile + sudo port deps dbus-glib + sudo port deps libomp-devel + sudo port install glib2-devel libsndfile dbus-glib libomp-devel + # remove all extended attributes, as they cannot be restored when restoring the pipeline cache + sudo xattr -rcv /opt/local + # fixup permissions to allow non-priv pipeline user access every directory, to make the caching step succeed at the end + sudo chown -R $(id -u):$(id -g) /opt/local + displayName: 'Port install universal' + condition: and(succeeded(), ne(variables.CACHE_RESTORED, 'true')) + - script: | + set -ex + export PATH=$PATH:/opt/local/bin + export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig" + mkdir build && cd build + cmake -Werror=dev $(CMakeFlags) -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. + make -j3 + displayName: 'Compile fluidsynth' + - script: | + export PATH=$PATH:/opt/local/bin + sudo port -v install fluidsynth +universal + displayName: 'port install fluidsynth +universal' + condition: failed() + - script: | + cat /opt/local/var/macports/logs/*_fluidsynth/fluidsynth/main.log + condition: failed() + displayName: 'Print fluidsynth error log' + - script: | + set -ex + cd build + make -j3 check + displayName: 'Execute Unittests' + - script: | + set -ex + cd build + make -j3 demo + displayName: 'Compile demos' + - script: | + set -ex + cd build + sudo make install + rm -f install_manifest.txt + displayName: 'Install fluidsynth to default location' + - script: | + set -ex + cd build + cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) .. + make install + cd /opt/local/lib/ + cp -a libgthread*.dylib libglib*.dylib libintl*.dylib libsndfile*.dylib libdbus-*.dylib libreadline*.dylib $(Build.ArtifactStagingDirectory)/lib + file /opt/local/lib/libglib-2.0.dylib $(Build.ArtifactStagingDirectory)/bin/fluidsynth $(Build.ArtifactStagingDirectory)/lib/libfluidsynth*.dylib + displayName: 'Install fluidsynth to artifact dir' + - task: PublishBuildArtifacts@1 + displayName: 'Publish fluidsynth artifacts' + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'fluidsynth-$(imageName)' + publishLocation: 'Container' + - task: PublishBuildArtifacts@1 + displayName: 'Publish macPorts deps' + enabled: false + condition: and(succeeded(), ne(variables.CACHE_RESTORED, 'true')) + inputs: + PathtoPublish: '/opt/local/lib' + ArtifactName: 'macports-$(imageName)' + publishLocation: 'Container'