Building app icons

John Nash
2011-12-16
2013-04-18
  • John Nash
    John Nash
    2011-12-16

    Ok, I'm slow…

    How does one get the code in staden.trunk/src/MacOSX to make the app bundles.  All I get is a miserable failure when I run wrapper.c.  I get (for example) a gap5 executable which works and a gap5.DSYM bundle, but what next. I put them in the logical places in the Gap5.app bundle, and even cheated and looked at the bundles supplied inside the DMG, but I'm slow tonight.

    TIA
    John

     
  • James Bonfield
    James Bonfield
    2011-12-16

    Ok, so there are various .app directories already. You simply need to compile the wrapper.c and name it gap5, gap4, trev, whatever.

    Basically when you run a bundle it executes /path/to/prog.app/Contents/MacOS/<prog> where <prog> is the executable listed in the Info.plist file. For the case of gap5 this is "$STADENROOT/Gap5.app/Contents/MacOS/gap5". What the gap5 executable (aka a compiled wrapper.c) then does is split apart this executable name (in argv) to extract the start ($STADENROOT) and end (gap5). It then pastes them back together with "/bin/" slapped in the middle and rexecutes that program. Put simply it's just the same as double clicking on the $STADENROOT/bin/gap5 program instead, although in this case it also supports file associations and basic drag and drop.  I probably could simplify things by setting up all the environment performed in the gap5 bourne shell wrapper script and executing tclsh $STADTCL/gap5/gap5.tcl directly, but I took the easiest route I could given the time and the fact the mac was just a loan machine.

    To compile wrapper.c you'll need to use the command line listed at the top of it. I forget now, but it's probably somethjing like:

    cc wrapper.c -o /some/path/gap5.app/Contents/MacOS/gap5 -framework CoreFoundation -framework Carbon

     
  • John Nash
    John Nash
    2011-12-18

    Thanks James,

    I figured where I was going wrong.  For home-built versions, as opposed to downloaded DMGs, the scripts, e.g. $STADENROOT/bin/gap5, have to be edited so as not to use Apple's tclsh8.5 but the one installed by Macports.  I changed
    "exec tclsh8.5 etc" to "exec /opt/local/bin/tclsh8.5 etc" at the end of the script, and all's good.

    (For the record in case others need to know)
    John