hacky way to make .apps (OS/X)

category: general [glöplog]
Right now the Mac version of my game is a single, self-contained Unix-type executable (just like the Linux ver.) When you run it from Finder a terminal window will pop up; I've been distributing it with a shell script that launches it and then closes the terminal. This works but looks ugly. And there's no icon.

How do I make it into a .app? I can copy the executable into the right spot and edit Info.plist, which works on my machine - is there any downside or hidden gotcha to distributing it this way? What other files will need to be in there?

Obviously the "proper" way would be to write it in Objective C and compile it with Xcode but I didn't do any of that. :P Just looking for a better bodge.
added on the 2018-01-02 21:16:44 by jmph jmph
Maybe some Google results? ;)

I have zero OS/X experience, but that looks plausible, so I hope it helps!
added on the 2018-01-02 21:34:38 by cxw cxw
Basically you can do what you said.

The "gotcha" is that if you linked your game with non-system libraries or frameworks. They should be distributed within the same .app-folder structure, which means you have to tell the OS where these libs should be loaded from.

Try googling for install_name_tool, which is the tool you need to change the paths to the libraries.
added on the 2018-01-03 16:27:21 by blind io blind io
Nowadays I use CMake's own functionality to build .app packages.

When using custom Makefile, I used to manually build .app structure and after building executable, use install_name_tool to link the libraries correctly.
example (changing executable's SDL linking to be more suitable with .app): install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executabl
e_path/../Frameworks/SDL.framework/Versions/A/SDL $(TARGET)
added on the 2018-01-03 19:57:45 by waffle waffle