Sunday, March 16, 2008

XPCOM and OS X

What I had to do to get an XPCOM component written in C++ compiled and linked on OS X
1. Install Xcode
2. Install Fink
3. At command prompt
cd /sw/bin;
sudo ./apt-get install glib
sudo ./apt-get install libIDL2
sudo cp libIDL-config-2 libIDL-config

4. Download the source of the Firefox version you'll be developing for. The only steps I had to perform that weren't mentioned on
http://developer.mozilla.org/en/docs/Mac_OS_X_Build_Prerequisites
was to add the following directory to my path
/sw/bin

5. change to directory to which Firefox source was downloaded and run the following commands
cp ./obj-ff/dist/bin/libxpcom_core.dylib ./obj-ff/dist/sdk/bin
cp ./obj-ff/dist/bin/libplds4.dylib ./obj-ff/dist/sdk/bin
cp ./obj-ff/dist/bin/libplc4.dylib ./obj-ff/dist/sdk/bin

6. Follow the steps give in
http://rcrowley.org/2007/07/17/cross-platform-xpcom-a-howto/
with Makefile looking like this:

GECKO_SDK := /obj-ff/dist/sdk

DEFINE := -DXP_UNIX -DXP_MACOSX
all: xpt dylib
xpt:
$(GECKO_SDK)/bin/xpidl -m header -I$(GECKO_SDK)/idl foo.idl
$(GECKO_SDK)/bin/xpidl -m typelib -I$(GECKO_SDK)/idl foo.idl
impl:
g++ -w -c -o foo_impl.o -I $(GECKO_SDK)/include $(DEFINE) foo_impl.cpp
module:
g++ -w -c -o foo_module.o -I $(GECKO_SDK)/include $(DEFINE) foo_module.cpp
dylib: impl module
g++ -dynamiclib -o foo.dylib foo_impl.o foo_module.o -L$(GECKO_SDK)/lib \
-L$(GECKO_SDK)/bin -Wl,-executable_path,$(GECKO_SDK)/bin \
-lxpcomglue_s -lxpcom -lnspr4
clean:
rm *.o
rm foo.h
rm foo.xpt
rm foo.dylib

7. Run make. Hopefully, it should work.

2 comments:

Unknown said...

michael kors, nike roshe, true religion outlet, timberland, nike blazer, north face, ugg boots, ugg boots, michael kors, mulberry, michael kors outlet, oakley pas cher, michael kors, burberry outlet online, hollister pas cher, nike free run uk, hermes, hogan, lululemon, hollister, coach outlet, sac guess, michael kors outlet, lacoste pas cher, tn pas cher, converse pas cher, michael kors outlet, michael kors outlet, true religion jeans, nike air max, vans pas cher, abercrombie and fitch, coach outlet, burberry, replica handbags, michael kors outlet, coach purses, nike air max, new balance pas cher, ralph lauren uk, vanessa bruno, true religion jeans, ray ban uk, north face, ray ban pas cher, true religion jeans, air force, nike air max, kate spade handbags, michael kors

Unknown said...

wedding dresses, juicy couture outlet, swarovski, doudoune canada goose, moncler, canada goose uk, swarovski crystal, pandora jewelry, ugg,ugg australia,ugg italia, coach outlet, moncler, canada goose, canada goose outlet, supra shoes, karen millen, pandora charms, replica watches, louis vuitton, pandora jewelry, montre pas cher, canada goose outlet, bottes ugg, barbour, thomas sabo, juicy couture outlet, moncler, lancel, louis vuitton, canada goose, louis vuitton, moncler, moncler outlet, hollister, canada goose, ugg boots uk, toms shoes, barbour jackets, sac louis vuitton pas cher, canada goose, louis vuitton, pandora charms, links of london, moncler, ugg,uggs,uggs canada, moncler, marc jacobs, ugg pas cher, moncler

  • Book reviews