2008年12月19日 星期五

How to compile Firefox scriptable plugin NPRuntime in Ubuntu

How to compile Firefox scriptable plugin "npruntime" in Ubuntu

You will need the Firefox source codes. The source files require more than 200M space. You can download from Mercurial for the latest version or mozilla.org for old versions.

1. Install the Linux Build Prerequisites

Install the Linux Build Prerequisites. The following commands are used for Ubuntu.

  $ sudo apt-get build-dep firefox
  $ sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev

  (The following commands may be optional to your environment)
  $ sudo apt-get install autoconf2.13
  $ sudo apt-get install libdbus-glib-1-dev

For more information, please reference the Linux Build Prerequisites

2. Download the mozilla source code

Download the mozilla source code from Mozilla Source Code (Mercurial) (The latest version)

  $ hg clone http://hg.mozilla.org/mozilla-central/ mozilla
  $ cd mozilla

If you do not want to download the latest version, you can get old versions from mozilla.org(HTTP)

Note: Now the mozilla-central repository in Mercurial is the Firefox 3.1 source code. See Firefox 3.1 for developers for more information.

3. Add path to modules/plugin/sdk/samples/npruntime

Modified the toolkit/toolkit-makefiles.sh, attach the folder path to the npruntime folder in the array MAKEFILES_plugin

  $ vi toolkit/toolkit-makefiles.sh
MAKEFILES_plugin="
  modules/plugin/sdk/samples/npruntime/Makefile
"
  (The path may be different. Please check your source files.)

This will make the ./configure to build the Makefile based on the Makefile.in

4. Using a .mozconfig configuration file.

This configuration file will help us to setup the build options.

Example .mozconfig file to build Firefox, Default Release Configuration
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt
ac_add_options --disable-tests


Note: If you use the upper example .mozconfig file, please make a new folder name "ff-opt" for MOZ_OBJDIR.

  $ mkdir ff-opt

Please read Configuring Build Options for further instructions.

5. Generate the Makefile

You need autoconf to generate ./configure file if not exists. You may need to export AUTOCONF=autoconf2.13 in your environment
  $ autoconf (optional)
  $ ./configure

The Makefile will be generated in the MOZ_OBJDIR folder. If you followed the instructions above, that will be "ff-opt".

Note: Mozilla suggests you should re-configure in the MOZ_OBJDIR folder. See Building with an Objdir for more information.

6. Build the firefox

You can build the plugin before you make the Firefox build. But the Makefile will try to install the built plugin(.so) to MOZ_OBJDIR if you followed the procedure. If you just need the plugin, you can ignore the error and bypass this step.

  $ cd (your source root folder)
  $ make -f client.mk build

That may cost more than 40 minutes, depending on your machine ability.

The executable Firefox can be found in MOZ_OBJDIR/dist/bin

Please read Build and Install for more information.

7. Build npruntime

  $ cd modules/plugin/sdk/samples/npruntime
  (The path may be different. Please check your source files.)
  $ make

The plugin(.so) will be installed automatically. You can now run the Firefox and type "about:plugins" in the Location bar. The available plugins will be listed.


Reference:
mozilla - developer center

2 則留言:

Unknown 提到...

Installing Firefox from Mozilla on Ubuntu

Unknown 提到...

井民全觀點 (Jing's Perspective)
[Plugin] 撰寫 firefox plugin 最簡單方法
http://mqjing.blogspot.com/2008/09/plugin-firefox-plugin.html

Powered By Blogger