Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding C++ XPCOM component automatically when compiling firefox 12

31 views
Skip to first unread message

flex...@gmail.com

unread,
Oct 16, 2012, 12:03:48 PM10/16/12
to
Hi,

I have made a C++ XPCOM component for firefox 12 and I know how I can add it to firefox myself, but how can I make it that it is automatically compiled and registered when I compile firefox? In what folder of the mozilla source do I need to put the component source files and what files I need to change (makefiles,...)?

Neil

unread,
Oct 17, 2012, 5:35:14 AM10/17/12
to
flex...@gmail.com wrote:

>I have made a C++ XPCOM component for firefox 12 and I know how I can add it to firefox myself, but how can I make it that it is automatically compiled and registered when I compile firefox? In what folder of the mozilla source do I need to put the component source files and what files I need to change (makefiles,...)?
>
>
If your component is compatible with the mozilla build system then the
extensions folder is the easiest to use, as then to compile it you just
need a .mozconfig entry ac_add_options
--enable-extensions=default,subdir to get it included.

--
Warning: May contain traces of nuts.

flex...@gmail.com

unread,
Oct 17, 2012, 8:55:57 AM10/17/12
to
Op woensdag 17 oktober 2012 11:35:15 UTC+2 schreef Neil het volgende:
Thanks for your reaction. I have followed the tutorial on http://www.iosart.com/firefox/xpcom/. I guess this isn't compatible with the build system then? How can I make it compatible?

Neil

unread,
Oct 17, 2012, 12:07:47 PM10/17/12
to
flex...@gmail.com wrote:

>I have followed the tutorial on http://www.iosart.com/firefox/xpcom/. I guess this isn't compatible with the build system then? How can I make it compatible?
>
>
Indeed, the build system expects a Makefile.in where you provide the
names of all of your source files (idl and cpp) and it then goes away
and produces your library. You might try looking at some of the other
extension Makefile.in files to give you an idea of how it works.

jelle.vanr...@gmail.com

unread,
Oct 18, 2012, 6:53:31 AM10/18/12
to
I'm having the same problem as flex. I copy pasted the cookie folder and changed it to my situation. I changed the makefile, dropped in the right cpp, idl and header files. But then I'm stuck. How can I make it build my extension too?

Thanks in advance,
Jelle

Neil

unread,
Oct 18, 2012, 4:30:31 PM10/18/12
to
jelle.vanr...@gmail.com wrote:

>I copy pasted the cookie folder and changed it to my situation. I changed the makefile, dropped in the right cpp, idl and header files. But then I'm stuck. How can I make it build my extension too?
>
>
Oops, it turns out that many of the extensions are a bad example,
because they aren't actually extensions. You can tell this because of
the LIBXUL_LIBRARY = 1 entry in the Makefile. Perhaps the gnomevfs
extension is a better example.

jelle.vanr...@gmail.com

unread,
Oct 22, 2012, 5:23:13 PM10/22/12
to
Dear Neil,

Thanks for your help so far, but I still have problems with adding my component. I'll briefly describe my situation :

I build a component with visual studio which generated a few files, other I created myself. For now, I build my component and then copy a xpt and dll file (the latter is found in /debug of the component folder) to the \dist\bin\components folder of the compiled firefox and add these two lines to chrome.manifest :

binary-component components/MyInterceptComponent.dll
interfaces component/IMyInterceptComponent.xpt

Also added two header files too \js\xpconnect\src before compiling.

The files I have in my component are the following:

IMyInterceptComponent.h
IMyInterceptComponent.idl
IMyInterceptComponent.xpt
MyInterceptComponent.cpp
MyInterceptComponent.dll
MyInterceptComponentModule.cpp
MyPolicy\MyPolicy.h
MyPolicy\MyPolicy.cpp

In the extension folder of mozilla-release I made a folder (named kuleuven), which contains all the above mentioned files, and a makefile.in which contains following code:

DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

MODULE = kuleuven
LIBRARY_NAME = kuleuven
SHORT_LIBNAME = nkgnomevfs
IS_COMPONENT = 1

CPPSRCS = \
MyInterceptComponentModule.cpp \
MyInterceptComponent.cpp \
$(NULL)

XPIDLSRCS = \
IMyInterceptComponent.idl \
$(NULL)

include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk

When I recompile, the compiled version gets a components\kuleuven folder with some obj files and a makefile, but the component doesn't work. Can you please help me with my problem?

Thank you in advance,

Jelle
0 new messages