-
Notifications
You must be signed in to change notification settings - Fork 29
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
macOS Support #4
Comments
Would be great if Mac users could help with setting up a CI pipeline. I don't own any Apple devices. |
@jgillich sorry didn't look at the code but is there already a macOS build target? |
There's no platform-specific code, |
I'm experimenting with the following configuration
version: 1
before:
hooks:
- go generate ./...
builds:
- flags:
-trimpath
goos:
- darwin
goarch:
- amd64
archives:
- format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
changelog:
sort: asc
filters:
include:
- "^feat:"
- "^fix:"
darwin:
# needs: goreleaser
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install brew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew --version
- name: Install dependencies
run: |
brew install gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita
- name: Build
run: |
go run github.com/goreleaser/goreleaser@latest build -f .goreleaser.darwin.yaml --single-target --snapshot
ls -la dist |
GitHub Actions build was fixed by adding a step - uses: actions/setup-go@v4
with:
go-version: '1.21' |
I've tried to copy all dependencies to be able to run app in a portable mode, but something is not working
After all that, app is running but not all assets are loaded - should we copy icon folder and if yes, where? .goreleaser.darwin.yamlversion: 1
before:
hooks:
- go generate ./...
builds:
- flags:
-trimpath
goos:
- darwin
goarch:
- amd64
archives:
- format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
changelog:
sort: asc
filters:
include:
- "^feat:"
- "^fix:" release.yaml darwin:
# needs: goreleaser
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install brew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew --version
- name: Install dependencies
run: |
brew install gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita hicolor-icon-theme adwaita-icon-theme
- name: Build
run: |
# Build
go run github.com/goreleaser/goreleaser@latest build -f .goreleaser.darwin.yaml --single-target --snapshot
# Folders
dist_folder=dist/seabird_darwin_amd64_v1
brew_prefix=$(brew --prefix)
mkdir -p $dist_folder/lib/gdk-pixbuf-2.0
mkdir -p $dist_folder/share/glib-2.0/schemas
mkdir -p $dist_folder/share/icons
# Files
cp README.md LICENSE $dist_folder
# libs
otool -L $dist_folder/seabird | awk -v pat="$brew_prefix" '$0~pat {print $1}' | xargs -I '{}' cp '{}' $dist_folder
for lib in \
libfribidi.0.dylib \
libgmodule-2.0.0.dylib \
libpangoft2-1.0.0.dylib \
libfreetype.6.dylib \
libpng16.16.dylib \
libappstream.5.dylib \
libepoxy.0.dylib \
libfontconfig.1.dylib \
libgraphite2.3.dylib \
libjpeg.8.dylib \
libtiff.6.dylib \
libharfbuzz-gobject.0.dylib \
libX11.6.dylib \
libxmlb.2.dylib \
libcairo-script-interpreter.2.dylib \
libXext.6.dylib \
libyaml-0.2.dylib \
libXrender.1.dylib \
libxcb.1.dylib \
libxcb-render.0.dylib \
libxcb-shm.0.dylib \
libpixman-1.0.dylib \
libXau.6.dylib \
liblzo2.2.dylib \
libXdmcp.6.dylib \
; do
cp -f $brew_prefix/lib/$lib $dist_folder
done
# ./lib/gdk-pixbuf-2.0
cp -r $brew_prefix/opt/gdk-pixbuf/lib/gdk-pixbuf-2.0 $dist_folder/lib
# ./share/glib-2.0/schemas
cp -r $brew_prefix/share/glib-2.0/schemas $dist_folder/share/glib-2.0
# ./share/gtksourceview-5
cp -r $brew_prefix/opt/gtksourceview5/share/gtksourceview-5 $dist_folder/share/gtksourceview-5
# ./share/gtk-4.0
cp -r $brew_prefix/opt/gtk4/share/gtk-4.0 $dist_folder/share
# ./share/icons
cp -r $brew_prefix/opt/adwaita-icon-theme/share/icons/Adwaita $dist_folder/share/icons
cp -r $brew_prefix/share/icons/hicolor $dist_folder/share/icons
# Archive
tar cvzf seabird_darwin_amd64.tar.gz -C $dist_folder .
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: seabird_darwin_amd64.tar.gz
tag: ${{ github.ref }} |
You don't need to copy the icon folder, it's embedded at build time. If the custom icons don't load, you are probably missing librsvg or gdk-pixbuf loaders (d9976f4) |
Found a new directory which contains svg loader as well
and copied
Set a variable But still same result. |
Found this article that looks helpful: https://www.datatable.online/en/blog/004-how-to-deploy-gtk-app-on-mac.html Their launcher script also sets |
These steps solved the issue with the icons
|
Copy/paste for local builds on ARM detailsNoteIt has 3 differrencese with the GitHub Actions and was tested on macOS 14.3 arm + brew install go gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita hicolor-icon-theme adwaita-icon-theme
- brew install gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita hicolor-icon-theme adwaita-icon-theme
+ dist_folder=dist/seabird_darwin_`uname -m`
- dist_folder=dist/seabird_darwin_`uname -m`_v1 Install brew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" Install dependenciesbrew install go gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita hicolor-icon-theme adwaita-icon-theme Get sourcesgit clone https://github.com/getseabird/seabird
cd seabird Buildgo run github.com/goreleaser/goreleaser@latest build -f .goreleaser.darwin.yaml --clean --single-target --snapshot Create an archive# Folders
dist_folder=dist/seabird_darwin_`uname -m`
lib_folder=$dist_folder/lib
share_folder=$dist_folder/share
brew_prefix=$(brew --prefix)
mkdir -p $lib_folder/gdk-pixbuf-2.0
mkdir -p $share_folder/glib-2.0/schemas
mkdir -p $share_folder/icons
# Files
cp README.md LICENSE $dist_folder
# libs
otool -L $dist_folder/seabird | awk -v pat="$brew_prefix" '$0~pat {print $1}' | xargs -I '{}' cp '{}' $lib_folder
for lib in \
libfribidi.0.dylib \
libgmodule-2.0.0.dylib \
libpangoft2-1.0.0.dylib \
libfreetype.6.dylib \
libpng16.16.dylib \
libappstream.5.dylib \
libepoxy.0.dylib \
libfontconfig.1.dylib \
libgraphite2.3.dylib \
libjpeg.8.dylib \
libtiff.6.dylib \
libharfbuzz-gobject.0.dylib \
libX11.6.dylib \
libxmlb.2.dylib \
libcairo-script-interpreter.2.dylib \
libXext.6.dylib \
libyaml-0.2.dylib \
libXrender.1.dylib \
libxcb.1.dylib \
libxcb-render.0.dylib \
libxcb-shm.0.dylib \
libpixman-1.0.dylib \
libXau.6.dylib \
liblzo2.2.dylib \
libXdmcp.6.dylib \
librsvg-2.2.dylib \
; do
cp -f $brew_prefix/lib/$lib $lib_folder
done
# ./lib/gdk-pixbuf-2.0
cp -r $brew_prefix/lib/gdk-pixbuf-2.0 $lib_folder
sed -i '' "s|$brew_prefix/||" $lib_folder/gdk-pixbuf-2.0/2.10.0/loaders.cache
# ./share/glib-2.0/schemas
cp -r $brew_prefix/share/glib-2.0/schemas $share_folder/glib-2.0
# ./share/gtksourceview-5
cp -r $brew_prefix/opt/gtksourceview5/share/gtksourceview-5 $share_folder/gtksourceview-5
# ./share/gtk-4.0
cp -r $brew_prefix/opt/gtk4/share/gtk-4.0 $share_folder
# ./share/icons
cp -r $brew_prefix/opt/adwaita-icon-theme/share/icons/Adwaita $share_folder/icons
cp -r $brew_prefix/share/icons/hicolor $share_folder/icons
# Runner file
launcher_file=$dist_folder/seabird_launcher.sh
echo 'cd "$(dirname "$0")"' >>$launcher_file
echo 'LAUNCH_DIR="$(pwd)"' >>$launcher_file
echo 'export DYLD_LIBRARY_PATH="$LAUNCH_DIR/lib"' >>$launcher_file
echo 'export GSETTINGS_SCHEMA_DIR="$LAUNCH_DIR/share/glib-2.0/schemas"' >>$launcher_file
echo 'export GDK_PIXBUF_MODULEDIR="$LAUNCH_DIR/lib/gdk-pixbuf-2.0"' >>$launcher_file
echo 'export GDK_PIXBUF_MODULE_FILE="$LAUNCH_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"' >>$launcher_file
echo '"$LAUNCH_DIR/seabird"'
chmod 777 $launcher_file
# Archive
tar cvzf seabird_darwin_`uname -m`.tar.gz -C $dist_folder . |
@jgillich, we miss one line from the "$LAUNCH_DIR/seabird" Should be added to the |
oops, fixed |
if i run the file from the release i get "cannot execute binary file" |
What is your macOS architecture? |
Its arm64 (i thought Rosetta could translate it?) But yeah if i compile it for arm64 it works, would be great to add arm64 support also in the CI |
Is there a way to implement that on amd64? macOS ARM runners a part of the Large runners and available for Organizations with GitHub Team plan - But looks like we have a free option - 500 min/m using non-github runners. |
Did some experiments with the FlyCI build/darwin/.goreleaser.yamlversion: 1
before:
hooks:
- go generate ./...
builds:
- flags:
-trimpath
# goos:
# - darwin
# goarch:
# - arm64
archives:
- format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
changelog:
sort: asc
filters:
include:
- "^feat:"
- "^fix:" .github/workflows/release.yamlname: release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
darwin:
runs-on: flyci-macos-large-latest-m1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install dependencies
run: |
brew install gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita hicolor-icon-theme adwaita-icon-theme
- name: Build
run: |
go run github.com/goreleaser/goreleaser@latest build -f build/darwin/.goreleaser.yaml --single-target --snapshot
dist=dist/seabird_darwin_arm64
brew_prefix=$(brew --prefix)
mkdir -p $dist/lib/gdk-pixbuf-2.0 $dist/share/glib-2.0/schemas $dist/share/icons
cp README.md LICENSE build/darwin/seabird.sh $dist
otool -L $dist/seabird | awk -v pat="$brew_prefix" '$0~pat {print $1}' | xargs -I '{}' cp '{}' $dist/lib
for lib in \
libfribidi.0.dylib \
libgmodule-2.0.0.dylib \
libpangoft2-1.0.0.dylib \
libfreetype.6.dylib \
libpng16.16.dylib \
libappstream.5.dylib \
libepoxy.0.dylib \
libfontconfig.1.dylib \
libgraphite2.3.dylib \
libjpeg.8.dylib \
libtiff.6.dylib \
libharfbuzz-gobject.0.dylib \
libX11.6.dylib \
libxmlb.2.dylib \
libcairo-script-interpreter.2.dylib \
libXext.6.dylib \
libyaml-0.2.dylib \
libXrender.1.dylib \
libxcb.1.dylib \
libxcb-render.0.dylib \
libxcb-shm.0.dylib \
libpixman-1.0.dylib \
libXau.6.dylib \
liblzo2.2.dylib \
libXdmcp.6.dylib \
librsvg-2.2.dylib \
; do
cp -f $brew_prefix/lib/$lib $dist/lib
done
cp -r $brew_prefix/lib/gdk-pixbuf-2.0 $dist/lib
sed -i '' "s|$brew_prefix/||" $dist/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
cp -r $brew_prefix/share/glib-2.0/schemas $dist/share/glib-2.0
cp -r $brew_prefix/opt/gtksourceview5/share/gtksourceview-5 $dist/share/gtksourceview-5
cp -r $brew_prefix/opt/gtk4/share/gtk-4.0 $dist/share
cp -r $brew_prefix/share/icons/hicolor $brew_prefix/opt/adwaita-icon-theme/share/icons/Adwaita $dist/share/icons
tar cvzf seabird_darwin_arm64.tar.gz -C $dist .
- uses: actions/upload-artifact@v4
with:
name: darwin
path: seabird_darwin_arm64.tar.gz
if-no-files-found: error
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: seabird_darwin_arm64.tar.gz
tag: ${{ github.ref }}
|
There is a M1 runner in beta: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories But the amd64 build should work with rosetta. Are you sure you didn't accidentally download the linux build? 😄 |
Goreleaser also supports universal binaries: https://goreleaser.com/customization/universalbinaries/ But that requires cross-compilation. Not idea how to set that up on Mac, Google didn't bring up much |
Oh, that's a good news - just did a test and it works on macOS arm, but as it was mentioned we need to disable app verification sudo spctl --master-disable
That issue was mentioned in the initial PR and I was not able to check amd64 builds on arm.
That didn't work during initial PR implementation because missed components. |
Re the crash, try setting XDG_DATA_DIRS to |
That fixed the issue, thanks! Added to the PR and checked the artifact. |
I set up OSX in a VM and the binary doesn't work for me either, getting "exec format error" on x64. Very strange 🤔 |
zip produces a valid binary whereas tar does not. bsd tar produces a corrupt archive. Amazing actions/runner-images#2619 |
Yeah, good catch :) Did a check of the one of the latest builds with gnu tar |
Oh, nice - |
Confirmed that |
The x64 build is incredibly flaky too
Apparently it's because OSX detects the dmg as a virus or something, happens to a lot of people on GH actions |
Also discussed on the create-dmg/create-dmg#143 and for M1 (arm) as well. |
Yea, killing XProtect doesn't seem to work very well. Going to have it retry until it succeeds. Total BS |
Builds with the dylibbundler return me to the p.3 # dm from mentioned commit
ls /Applications/Seabird.app/Contents/MacOS/lib | grep librsvg-2.2.dylib
# dmg from latest release
ls /Volumes/Seabird/Seabird.app/Contents/MacOS/lib | grep librsvg-2.2.dylib
librsvg-2.2.dylib ![]() |
Yea librsvg is loaded dynamically, same on windows. Just fixed that 7448059 |
Alright, I might have figured it out. Do these builds work for you? https://github.com/getseabird/seabird/actions/runs/7754598109 |
On
|
Is it possible to increase app fonts on Mac? |
No description provided.
The text was updated successfully, but these errors were encountered: