-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add macOS workflow #958
Add macOS workflow #958
Conversation
Thanks! I have a few questions:
|
Pretty sure I can do that, I will next
Now that I think about it more, not really ;-; A Mac user who downloads an artifact from this workflow would, on their machine, needs to make sure they have all the runtime dependencies installed, link the
If the user has the dependency installed,
I think this could be done for Mac as well, but should we if we're going to install all of the app's runtime dependencies for users? |
Okay instead of making an install script, I'm going to focus on getting the minimum working app bundle with dependencies included in the bundle, that way user installation is super easy |
There should be some application code to set the As of right now though, if you download the app bundle from the macOS workflow on a Mac and set |
Bundling the dependencies is very messy... See on windows https://github.com/GeopJr/Tuba/blob/main/Makefile#L46-L57, we go through every single linked dep and straight up copy them and their dependencies to the folder
I believe, like on windows, it will search locally first, as long as the folders are structured right (see the windows zip package!). Doesn't it do it already for Tuba's own icons since they are included in the artifact? I'll investigate
( 🤫 it keeps them if you zip it yourself) Honestly, I don't know if it's worth it to bundle everything. Actually, I don't even know if it's worth it to ship it outside of homebrew at all (except for testing) Windows is a different beast, all dependencies have to be provided from msys2 and you can't really expect users to go through all that. But I suspect that most mac users willing to download an app outside of the appstore, also have homebrew installed 🤷 I'm setting up a Mac KVM and I'll see tmrow! GNOMies seem to be using https://gitlab.gnome.org/GNOME/gtk-mac-bundler to bundle mac apps, might be worth considering. Actually, taking a look on how gimp and inkscape do it might be helpful too! |
Yeah I've realized that now lol
How exactly should they be structured then? Right now it's like:
Not in my testing. But yeah, feel free to download those artifacts and test stuff! ^^
Oh nice okay I'll have to add that then
It would be really nice, and maybe not so far off actually since I've made a ton of progress today
The thing with that, though, is that Homebrew formulas (compiles a program from source) can't really have app bundles and they're not even actually meant for GUI applications, only CLI and libraries (hence why the current Tuba formula only allows users to open Tuba through Terminal). A Homebrew cask (downloads a release artifact) is really what I'm aiming for, which is intended specifically for GUI applications.
I have looked at gtk-mac-bundler and GIMP! I learned some stuff from looking at how gtk-mac-bundler works, but I continued implementing things myself, probably mostly because I kinda hate how GIMP is on Mac- it's all kinds of janky |
My bad, I thought we were still following the original structure (/whatever meson outputted), where the dependencies sit next to the binary and the others on ../share/ ...
I see, thanks for the info! Btw, I'll start pushing to this PR if I have something to push, so don't really worry about the commit history, it will be squashed anyway! |
Okay so, I did more research and what I'd like would be to follow the windows pattern of using a Makefile (can be done after we figure out all the commands): mac: PREFIX = $(PWD)/tuba_mac/Tuba.app/Contents/Resources
mac: __mac_pre build install # ...
__mac_pre:
rm -rf $(PREFIX)
mkdir -p $(PREFIX)/lib/
mkdir -p $(PREFIX)/../MacOS/
touch $(PREFIX)/../Info.plist # cp build_aux/...
And what we should follow is Kangaroo's guide: https://www.datatable.online/en/blog/004-how-to-deploy-gtk-app-on-mac.html Kangaroo is a commercial GTK app built using (almost) the same stack as Tuba - Vala, gtk, gtksourceview... So that guide will be on point! Oh btw, could you add libspelling to the deps? (spelling library, not sure if it will work, but just add it anyway). And maybe So the plan is:
|
Broken because `distro` needs to be set to true, not worth fixing because the result of the CI should be telling enough
Not working on my machine, but I have no idea why
://///// try installing but actually, if they (svgs) work when you run it then I really don't get it |
Ah, I have |
Currently rewriting the dependency copying stuff to just copy everything in |
c17aa06
to
0f8bbfc
Compare
Update:
|
So, for some reason, it looks in subdirectories when looking in
Yeeaaaaah ;-; that's why I said "experiment" in the commit lol. Not really sure if it's viable, but I know that at least a portion of that is actually build dependencies, which don't need to be included. We could probably have two Brewfiles, one with both build and runtime dependencies and one with only runtime dependencies
Oh odd, I thought I had removed most dependencies from my machine and it works mostly fine for me (I am experiencing the icon issue now) |
Hah, so, TLS just broke for me for the first time |
The kangaroo guide is probably our best bet at a minimal and complete bundle but between us only you have a working Mac so the implementation is up to you 😅
Yep, make sure glib-networking was bundled / exists |
You know what, I hate to go back on what I said before but trying to get every little thing that the app could possibly need to run correctly bundled in with it is such a pain, takes up way too much space, and Homebrew casks do allow you to specify dependencies (which I kind of forgot about...) |
Just included the |
It's ok! Wish I could be of more help :( I'll give it a try myself too if I get some free time, but for the moment it's good enough! It's not like we can't come back to it in the future anyway Thank you for taking over this task 🙇 |
I gave it another try, this is the closest I got to replicating the windows build It copies over all needed deps, icons, loaders and then cleans up. I did encounter some issues though with the dep loops. Specifically with some icu data stuff and a libwebp dep, maybe we can make otool ignore them if they are not needed? or copy them manually instead If we can make it work in this state, then we can move on to creating Tuba.app and the installer (oh I also installed libproxy, not sure if it's needed tbh) macos: PREFIX = $(PWD)/tuba_macos
macos: MAC_APP = $(PWD)/Tuba.app
macos: __macos_pre build install __macos_copy_deps __macos_schemas __macos_copy_icons __macos_cleanup
__macos_pre:
rm -rf $(PREFIX)
mkdir -p $(PREFIX)/lib/
__macos_prepare_app:
# mkdir -p $(MAC_APP)/Contents/
# mv $(PREFIX) $(MAC_APP)/Contents/Resources/
# mkdir -p $(MAC_APP)/Contents/Resources/lib/
# mkdir -p $(MAC_APP)/Contents/Resources/bin/
# mkdir -p $(MAC_APP)/Contents/Resources/share/
# mkdir -p $(MAC_APP)/Contents/Resources/etc/
# mkdir -p $(MAC_APP)/Contents/Resources/include/
# mkdir -p $(MAC_APP)/Contents/MacOS/
__macos_copy_deps:
otool -L $(PREFIX)/bin/dev.geopjr.Tuba | grep "/*.*dylib" -o | grep -v "/usr/lib/*" -o | grep -v "/System/Library/*" -o | xargs -I{} cp -nL "{}" $(PREFIX)/bin
cp -fL $${HOMEBREW_PREFIX}/opt/webp/lib/libwebp-7.dylib $(PREFIX)/bin
cp -fL $${HOMEBREW_PREFIX}/opt/librsvg/lib/librsvg-2.2.dylib $(PREFIX)/bin
cp -fL $${HOMEBREW_PREFIX}/opt/gmp/lib/libgmp.dylib $(PREFIX)/bin
cp -fL $${HOMEBREW_PREFIX}/opt/gnutls/lib/libgnutls.dylib $(PREFIX)/bin
cp -fL $${HOMEBREW_PREFIX}/opt/glib/lib/libgthread-*.dylib $(PREFIX)/bin
cp -fL $${HOMEBREW_PREFIX}/opt/libproxy/lib/libproxy.dylib $(PREFIX)/bin
cp -frL $${HOMEBREW_PREFIX}/opt/gdk-pixbuf/lib/gdk-pixbuf-2.0 $(PREFIX)/lib/gdk-pixbuf-2.0
cp -frL $${HOMEBREW_PREFIX}/opt/webp-pixbuf-loader/lib/gdk-pixbuf-2.0 $(PREFIX)/lib/gdk-pixbuf-2.0
# Let's recursively get all deps of deps 3 levels deep
for dep in $$(find $(PREFIX)/bin -name \*.dylib -o -name \*.so -type f); do \
otool -L $$dep | grep "/*.*dylib" -o | grep -v "/usr/lib/*" -o | grep -v "/System/Library/*" -o | xargs -I{} cp -nL "{}" $(PREFIX)/bin; \
done
for dep in $$(find $(PREFIX)/bin -name \*.dylib -o -name \*.so -type f); do \
otool -L $$dep | grep "/*.*dylib" -o | grep -v "/usr/lib/*" -o | grep -v "/System/Library/*" -o | xargs -I{} cp -nL "{}" $(PREFIX)/bin; \
done
for dep in $$(find $(PREFIX)/bin -name \*.dylib -o -name \*.so -type f); do \
otool -L $$dep | grep "/*.*dylib" -o | grep -v "/usr/lib/*" -o | grep -v "/System/Library/*" -o | xargs -I{} cp -nL "{}" $(PREFIX)/bin; \
done
cp -f $${HOMEBREW_PREFIX}/opt/gtksourceview5/share/gtksourceview-5/styles/Adwaita.xml $${HOMEBREW_PREFIX}/opt/gtksourceview5/share/gtksourceview-5/styles/Adwaita-dark.xml ${PREFIX}/share/gtksourceview-5/styles/
cp -f $${HOMEBREW_PREFIX}/opt/gtksourceview5/share/gtksourceview-5/language-specs/xml.lang $${HOMEBREW_PREFIX}/opt/gtksourceview5/share/gtksourceview-5/language-specs/markdown.lang $${HOMEBREW_PREFIX}/opt/gtksourceview5/share/gtksourceview-5/language-specs/html.lang ${PREFIX}/share/gtksourceview-5/language-specs/
__macos_schemas:
cp -r $${HOMEBREW_PREFIX}/opt/gsettings-desktop-schemas/share/glib-2.0/schemas/*.xml ${PREFIX}/share/glib-2.0/schemas/
glib-compile-schemas ${PREFIX}/share/glib-2.0/schemas/
__macos_copy_icons:
cp -r $${HOMEBREW_PREFIX}/opt/adwaita-icon-theme/share/icons/ $(PREFIX)/share/icons/
cp -r $${HOMEBREW_PREFIX}/opt/hicolor-icon-theme/share/icons/ $(PREFIX)/share/icons/
__macos_cleanup:
rm -f ${PREFIX}/share/glib-2.0/schemas/*.xml
rm -rf ${PREFIX}/share/icons/hicolor/scalable/actions/
find $(PREFIX)/share/icons/ -name *.*.*.svg -not -name *geopjr* -delete
find $(PREFIX)/lib/gdk-pixbuf-2.0/2.10.0/loaders -name *.a -not -name *geopjr* -delete
find $(PREFIX)/share/icons/ -name mimetypes -type d -exec rm -r {} + -depth
find $(PREFIX)/share/icons/hicolor/ -path */apps/*.png -not -name *geopjr* -delete
find $(PREFIX) -type d -empty -delete
gtk4-update-icon-cache $(PREFIX)/share/icons/Adwaita/
gtk4-update-icon-cache $(PREFIX)/share/icons/hicolor/ |
Hey, sorry it's been a while So, I ended up getting really busy with a bunch of other stuff and unfortunately stopped working on this. Right now I'm going through each of the like 30 something different projects I have on my computer and I'm wrapping them up so I can focus on just a few projects. Just wanted to let you know that, yeah, I'm probably not gonna be working on this any more in the near future, sorry -.-' I will be archiving my fork though, so that the work I've done can be referenced in the future if this is picked up by someone else ^^ |
That's fine, thanks for moving this so far! Good luck on your other projects :) |
Adds a workflow which builds and uploads a macOS artifact of Tuba on push or pull request.