jimeh / emacs-builds

Self-contained Emacs.app builds for macOS, with native-compilation support.
https://github.com/jimeh/emacs-builds/releases
344 stars 7 forks source link

DBus support #17

Closed isamert closed 2 years ago

isamert commented 2 years ago

Is there any reason for not adding DBus support (--with-dbus flag)? It could be a useful addition with no real downsides. I don't know if there are any other feature flags that are left out but I think it would be wise to include them all (unless they have some really apparent downsides) in a pre-built version so that everyone can enjoy.

Also thanks a lot, this project saved me quite a lot of time! DBus support would be a cherry on top.

jimeh commented 2 years ago

The only reason it's not enabled already is cause I honestly didn't think it was of any use at all on macOS. But I'm more than happy to enable it if it does no harm :)

I'll try and get a test build together tonight, and if no issues arise, I'll enable it for nightly builds in the next few days.

jimeh commented 2 years ago

I've fired off a test build, the signed app is in the dmg artifact on the build here: https://github.com/jimeh/emacs-builds/actions/runs/1561236930

I haven't had a chance to test it myself yet, but the build completed without issue, so that's definitely a good sign :)

isamert commented 2 years ago

I will try it out as soon as possible and report you back, thanks!

isamert commented 2 years ago

I tried it, everything else works quite fine but the dbus support. It might be a problem with my system, I'm not quite sure if my dbus setup is fine in every aspect. I also found this: https://github.com/d12frosted/homebrew-emacs-plus/issues/411 Seems like other people are hitting into the same issue I'm having. It might be related to Emacs on Mac itself. I'll try to dig deeper when I have more time. Just wanted to give an update.

jimeh commented 2 years ago

Thanks for testing it, I haven't had a chance yet myself. It's interesting that dbus doesn't seem to work on Emacs Plus either. Maybe it's something that needs to be reported on the emacs-bugs mailing list.

isamert commented 2 years ago

I tried a few things and found out that Emacs requires dbus-launch --sh-syntax style environment variables to be available in the environment, which is something like this:

# Mind the `unix:path=` part
export DBUS_SESSION_BUS_ADDRESS=unix:path=/path/to/session.usock,guid=some-guid

But starting dbus with homebrew (or launchd) only sets DBUS_LAUNCHD_SESSION_BUS_SOCKET and it uses the following format (without the unix:path= part):

export DBUS_LAUNCHD_SESSION_BUS_SOCKET=/path/to/session.usock

As far as I understand, some apps (like signal-cli, see here) requires DBUS_LAUNCHD_SESSION_BUS_SOCKET to be present in the environment and some requires (like Emacs, see here) requires DBUS_SESSION_BUS_ADDRESS to be present in the path with the unix:path= part, or any other socket identifier if you are using something different).

So, you need to set DBUS_LAUNCHD_SESSION_BUS_SOCKET and DBUS_SESSION_BUS_ADDRESS in their respective formats to get everything working properly.

I can say that your build works fine, it's just Dbus that needs a bit configuration to get it working properly on Mac. Also this page was kinda useful while debugging the issue, so I just wanted to drop a link to there.

From my perspective, your change regarding to enabling DBus can be merged. It does not create any problems on systems that do not have DBus installed or systems with broken DBus configuration. If anyone wants to use DBus functionality, they can simply install and properly configure their DBus installation.

jimeh commented 2 years ago

Thanks for all that digging, and apologies for not getting back to you sooner.

I've just updated the nightly builds to use v0.6.28 of my build script in 0af73aaee1482e965e405e7c90cdedc4d8c23a87, which includes dbus as a build dependency.

So nightly builds should have dbus support going forward, starting with the 2022-01-15 builds which are scheduled for tonight.

isamert commented 2 years ago

That's great, thanks for all your work!