iOS Build Environment Help Center

Using the iOS toolchain to build Mac applications

append delete Mathias

Hi there! Happy user of the iOS toolchain here :)

Out of curiosity, have you considered adding support for compiling/linking Mac apps with the toolchain?

Since it seems like the iOS toolchain linker already has support for .tbd files and other interesting Apple "stuff", maybe this wouldn't be too difficult?

Currently, I'm using osxcross through Docker for this purpose, but would be really happy if I could get rid of the VM.

Reply RSS

Replies

append delete #1. Pierre-Marie Baty

Hello,

It's already possible, provided you have the right SDK and call the compiler and linker "by hand" using the right flags. Not very user-friendly I admit.

The build script at the moment is too focused on iOS apps, even if I'm trying to change that there's still some way to go.

There's one thing the builder won't do at the moment: it's the compilation of .xib/.storyboard (Interface Builder) files. If your app uses none, it certainly can be built.

Do you have a templated example of such an app to share with me, so I can see what's needed to improve macOS support ?

append delete #2. Mathias

I think I tried this about a year ago (i.e. calling `clang` manually to compile and link), but I remember having some issues back then.
I don't remember 100% what those were unfortunately :(

If this is already a supported usecase, I will definitely try again and report back very soon!

append delete #3. Pierre-Marie Baty

All I can say is that a game company - a big one - already uses it internally to produce their macOS builds on Windows (it reminds me that they talked to me about something some time ago regarding all this, I should contact them to know what the idea became...)

FYI this year the toolchain's code signer gained the ability to code sign *and* timestamp macOS apps. Because of that new feature, notarization is also doable from Windows now.

append delete #4. Mathias

Looks like things are indeed working as intended, managed to compile our game on Windows and run it on Mac. Excellent!

Now to figure out how to get DMG packaging working on Windows, but that's an entirely separate issue of course :)

append delete #5. Pierre-Marie Baty

I sorta know how to do that, but it requires a tool that I haven’t written yet (userland HFS driver…) There might be some implementations in the open source world.

append delete #6. Mathias

Looks like this can be done with `genisoimage` which has a Cygwin version:
http://cygwin.osuosl.org/x86/release/cdrkit/genisoimage

Doing a "nice" DMG with background images and so on will probably be a bit more extra effort since you will need to find a way to create the .DS_Store file and /Applications symlink.

append delete #7. Pierre-Marie Baty

Good find, and it does already support HFS resource forks and symlinks. See the man page of the tool, section "HFS options".

:: @Pierre-Marie Baty added on 21 Nov ’21 · 16:29

Also, FYI: https://blog.barthe.ph/2011/04/05/dmg_history/

append delete #8. Pierre-Marie Baty

For those interested, I took up the challenge and here is what I could come up with:

% makedmg.exe command-line help
makedmg - iOS Build Environment's .dmg file creator by Pierre-Marie Baty
Usage: makedmg <outfile.dmg> <pathname to app dir> [-v]
Example: makedmg myMacApp.dmg C:\Path\To\MyMacApp\BuildOutput
To create symlinks, put one-liner files containing just the symlink target.
To set a custom DMG icon, put a .VolumeIcon.icns file in the root directory.
To set a custom background, icons placement and sizes, place a .DS_Store
file in the root directory (you can generate one with macOS and reuse it).
Binary Mach-O files and files with a shebang (#!) get execution flags (0755).
%

Get it here: https://www.pmbaty.com/iosbuildenv/makedmg.zip

And let me know if you find any issues. Merry Christmas :)

append delete #9. Mathias

Oh wow, thanks for this! Will try to use it and report back :)

append delete #10. Pierre-Marie Baty

So, did you have a chance to test it ? Does it suit your needs ?

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Moderators: Pierre-Marie Baty