Skip to content

chore: use kqueue on iOS, not FSEvents like on macOS - #4

Merged
calmh merged 1 commit into
syncthing:mainfrom
pixelspark:ios
Feb 7, 2025
Merged

calmh merged 1 commit into
syncthing:mainfrom
pixelspark:ios

Conversation

@pixelspark

Copy link
Copy Markdown

On macOS, notify uses the FSEvents API. This is unfortunately not available on iOS. However before this PR, it would be used due to darwin build rule also matching iOS.

This PR ensures that the kqueue variant is built for iOS.

@pixelspark

Copy link
Copy Markdown
Author

Note that it appears go fmt added both styles of build configuration lines to the modified files - if this is unwanted just let me know. It reformatted some other bits as well but I kept that out of this PR.

@calmh calmh changed the title Use kqueue on iOS, not FSEvents like on macOS chore use kqueue on iOS, not FSEvents like on macOS Feb 7, 2025
@calmh calmh changed the title chore use kqueue on iOS, not FSEvents like on macOS chore: use kqueue on iOS, not FSEvents like on macOS Feb 7, 2025
@calmh
calmh merged commit f0fa8f9 into syncthing:main Feb 7, 2025
@pixelspark
pixelspark deleted the ios branch February 7, 2025 14:51
calmh added a commit to syncthing/syncthing that referenced this pull request Feb 7, 2025
### Purpose

On iOS, the FSEvents API for watching files (also used on macOS) is not
available, but `kqueue` is. This PR ensures `kqueue` support is built on
iOS instead of the FSEvents based watcher implementation.

Before this PR, you could already use the `kqueue` build option to force
its usage. Unfortunately `gomobile`, the tool that I use to build
Syncthing for iOS and macOS for Synctrain, does not support setting
different build flags for iOS and macOS (unless I build separately for
each, which is a bit of a hassle because XCode nonsense). I am assuming
there are good reasons to support FSEvents even though `kqueue` is also
available on macOS (but I'm not sure why?). I do know FSEvents has been
working fine for me on macOS so it seems best to use FSEvents on macOS
and kqueue on iOS.

Note that this also requires syncthing/notify#4
to be merged in `synchting/notify` (until that is done, this PR will
fail to build on iOS due to `notify` still trying to link to `fsevents`
stuff when the `kqueue` build flag is not set).

### Testing

I compiled both `syncthing/notify` and syncthing with this PR applied,
and used that to successfully build the Synctrain iOS app, which after
this PR works fine and should follow up file changes a bit quicker.

### Screenshots

n/a

### Documentation

n/a

## Authorship

Your name and email will be added automatically to the AUTHORS file
based on the commit metadata.

---------

Co-authored-by: Jakob Borg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants