From ee229d8d94f13b4107058067952703baa33411a9 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:16:05 +0300 Subject: [PATCH] build: build vst bundle binaries on macos Closes #167 --- .github/workflows/binaries.yml | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 7fc1cec..b72d270 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -98,6 +98,20 @@ jobs: asmnasm: /Users/runner/nasm/nasm output: sointu-track-native params: -tags=native cmd/sointu-track/main.go + - os: macos-12 # this is intel still + asmnasm: /Users/runner/nasm/nasm + output: sointu-vsti.a + bundleoutput: sointu-vsti + MACOSX_DEPLOYMENT_TARGET: 11 + params: -buildmode=c-archive -tags=plugin ./cmd/sointu-vsti/ + bundle: true + - os: macos-12 # this is intel still + asmnasm: /Users/runner/nasm/nasm + output: sointu-vsti-native.a + bundleoutput: sointu-vsti-native + MACOSX_DEPLOYMENT_TARGET: 11 + params: -buildmode=c-archive -tags="plugin,native" ./cmd/sointu-vsti/ + bundle: true steps: - uses: benjlevesque/short-sha@v3.0 id: short-sha @@ -119,19 +133,77 @@ jobs: - name: Build library env: ASM_NASM: ${{ matrix.config.asmnasm }} + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.MACOSX_DEPLOYMENT_TARGET }} run: | mkdir build cd build cmake -GNinja .. ninja sointu - name: Build binary + env: + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.MACOSX_DEPLOYMENT_TARGET }} run: | go build -ldflags "-X github.com/vsariola/sointu/version.Version=$(git describe) ${{ matrix.config.ldflags}}" -o ${{ matrix.config.output }} ${{ matrix.config.params }} - name: Upload binary + if: matrix.config.bundle != true uses: actions/upload-artifact@v4 with: name: ${{ runner.os }}-${{ steps.short-sha.outputs.sha }}-${{ matrix.config.output }} path: ${{ matrix.config.output }} + - name: Bundle VST + if: matrix.config.bundle + env: + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.MACOSX_DEPLOYMENT_TARGET }} + run: | # following https://github.com/RustAudio/vst-rs/blob/master/osx_vst_bundler.sh + mkdir -p "bundle/${{ matrix.config.bundleoutput }}.vst/Contents/MacOS" + clang -L./build/ -lsointu -bundle -o bundle/${{ matrix.config.bundleoutput }} -all_load ${{ matrix.config.output }} + echo "BNDL????" > "bundle/${{ matrix.config.bundleoutput }}.vst/Contents/PkgInfo" + echo " + + + + CFBundleDevelopmentRegion + English + + CFBundleExecutable + ${{ matrix.config.bundleoutput }} + + CFBundleGetInfoString + vst + + CFBundleIconFile + + + CFBundleIdentifier + com.vsariola.${{ matrix.config.bundleoutput }} + + CFBundleInfoDictionaryVersion + 6.0 + + CFBundleName + ${{ matrix.config.bundleoutput }} + + CFBundlePackageType + BNDL + + CFBundleVersion + 1.0 + + CFBundleSignature + $((RANDOM % 9999)) + + CSResourcesFileMapped + + + + " > "bundle/${{ matrix.config.bundleoutput }}.vst/Contents/Info.plist" + mv "bundle/${{ matrix.config.bundleoutput }}" "bundle/${{ matrix.config.bundleoutput }}.vst/Contents/MacOS/${{ matrix.config.bundleoutput }}" + - name: Upload bundle + if: matrix.config.bundle + uses: actions/upload-artifact@v4 + with: + name: ${{ runner.os }}-${{ steps.short-sha.outputs.sha }}-${{ matrix.config.bundleoutput }} + path: bundle upload_release_asset: needs: [create_release, binaries] runs-on: ubuntu-latest