[ptx] OSX Compiling

JD Smith jdsmith at as.arizona.edu
Mon Apr 17 20:03:34 BST 2006


> > Thanks for the follow-up.
> > 
> > From what I read, that's not entirely the case.  You can build full 
> > Carbon .apps using automake/autoconf/etc, entirely from the command 
> > line.  In fact, XCode is just a front end to a host of command line 
> > tools (like gcc), and you can have both build systems coexist at once 
> > (for the convenience of using XTools).  For some high-level (and not 
> > terribly useful info) on this:
> > 
> > http://developer.apple.com/unix/crossplatform.html
> 
> I'd also really like to support the classical ./configure & make
> approach under OSX, especially if building using XCode is not portable
> across different system configuration.
> 

> I think not too many things are missing from the current autoconf system. I
> believe it already can be used to build hugin using mingw under windows as well.

I don't know much, but the way Emacs does it is to maintain an
emacs/mac/Emacs.app directory in CVS (applications in OSX are actually
directories, which are opaque in the Finder), with the following
contents:

http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/mac/Emacs.app/

Then in the traditional src/ Makefile.in, there are a few pieces which
put together all the components of Emacs.app:

#ifdef HAVE_CARBON
mac = $(dot)$(dot)/mac/
MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o
emacsapp = $(PWD)/$(mac)Emacs.app/
emacsappsrc = ${srcdir}/../mac/Emacs.app/
#endif

...

#ifdef HAVE_CARBON
<snip>
macselect.o: blockinput.h macterm.h macgui.h frame.h keymap.h $(config_h)

${emacsapp}Contents/Resources/English.lproj:
        mkdir -p $@

ifneq (${emacsapp},${emacsappsrc})
${emacsapp}Contents/Info.plist: ${emacsappsrc}Contents/Info.plist
        cp $< $@
${emacsapp}Contents/PkgInfo: ${emacsappsrc}Contents/PkgInfo
        cp $< $@
${emacsapp}Contents/Resources/Emacs.icns: ${emacsappsrc}Contents/Resources/Emacs.icns
        mkdir -p ${emacsapp}Contents/Resources
        cp $< $@
${emacsapp}Contents/Resources/English.lproj/InfoPlist.strings: ${emacsappsrc}Contents/Resources/English.lproj/InfoPlist.strings
        cp $< $@
endif

macosx-bundle: ${emacsapp}Contents/Resources/English.lproj \
        ${emacsapp}Contents/Info.plist ${emacsapp}Contents/PkgInfo \
        ${emacsapp}Contents/Resources/Emacs.icns \
        ${emacsapp}Contents/Resources/English.lproj/InfoPlist.strings
macosx-app: macosx-bundle ${emacsapp}Contents/MacOS/Emacs \
  ${emacsapp}Contents/Resources/Emacs.rsrc
${emacsapp}Contents/MacOS/Emacs: emacs${EXEEXT}
        mkdir -p ${emacsapp}Contents/MacOS/;
        cd ${emacsapp}Contents/MacOS/; cp ../../../../src/emacs${EXEEXT} Emacs${EXEEXT}
${emacsapp}Contents/Resources/Emacs.rsrc: ../mac/src/Emacs.r
        /Developer/Tools/Rez -useDF \
        -o ${emacsapp}Contents/Resources/Emacs.rsrc \
        /System/Library/Frameworks/Carbon.framework/Headers/Carbon.r $<
#endif

I've left alot out, and remember that Emacs is a fairly complicated
build, so it might not all apply.

So you see it basically copies over the Emacs.app pieces, copies the
compiled executable into Emacs.app/Contents/MacOS/, and then uses the
apple tool "Rez" to build the Emacs.rsrc resource fork (which goes in
Emacs.app/Contents/Resources/).  These ".r" files from which they are
compiled contain various bits of info, like icons, creator code, etc.  I
don't know how to make these files... perhaps there is another wxWidgets
program which has a native Mac build process which we could crib from?

I suspect Ippei would know what steps are need to get to the compiled
OSX binary part, and then we could cobble together bundling the
Hugin.app double-clickable application via automake.

JD




More information about the ptx mailing list