Subj : Re: Compiling and using SpiderMonkey with Mac OS X To : netscape.public.mozilla.jseng From : Heath Raftery Date : Sun Aug 03 2003 07:04 pm In article <00FC684A-C28C-11D7-B112-0030656DA53C@voyager.net>, ggadwa@voyager.net (Brian Barnes) wrote: > On Wednesday, July 30, 2003, at 12:34 AM, Brendan Eich wrote: > > > You shouldn't have to change any sources. You need to define both > > XP_MAC and XP_UNIX for OS X, I believe. Brian can speak with > > authority. > > Authority != Brian ! > > But I'll try. Here's how I do it. To compile, d/l whatever (from the > tars or cvs), and: > > cd ~/opensource/mozilla/js/src > make -f Makefile.ref BUILD_OPT=1 OPTIMIZER="-O3 -fstrict-aliasing > -ffast-math -funroll-loops -mcpu=7400 -force_cpusubtype_ALL" Excellent, appears to work well. > This, as far as I've experimented, is the best way to compile it for > speed on OS X. Watch out with the -ffast-math flag, it's a little > dangerous but I don't care that much for numerical precision. I'm not too interested in numerical precision either, so I'll stick with that. Should I be concerned about the -mcpu flag though, if my users may not be using a G4? > Now, here's the part that's tricky, and could use some documentation. > In js/src/darwin_opt.obj will be libjs.a. All the .h files you will > need are in js/src. > > Include in your project: > > libjs.a (the library) > jsapi.h > jsautocfg.h > jscompat.h > jslong.h > jsosdep.h > jsotypes.h > jspubtd.h > jstypes.h > > (That's the tricky part) Yeah that's very handy info. One little comment for someone following these instructions: jsautocfg.h will appear in the Darwin_OBJ.obj folder, the rest are in the original src folder. Also, assume root and put libjs.a in /usr/lib (or /usr/local/lib if you prefer) so gcc can find it. > And in your main header file, include: > > #define XP_UNIX > #define JSFILE > > #include "jsapi.h" Very handy! Well, up till about 5 minutes ago I was going to report failure still, until I realised the noob mistake on my behalf. To compile on the command line, you need something like: gcc mySource.c -ljs _not_ gcc -ljs mySource.c which will complain about missing symbols. Thanks for your help. -- Heath ________________________________________________________ | *Nothing is foolproof to a sufficiently talented fool* | | _\|/_ | |________________________________________m(. .)m_________| .