Prerequisites
Do not place any related development tools and extensions in a directory with spaces (such as progaram files \ Python). Unexpected errors may occur and subsequent operations may fail.
To develop the add-on SDK, You need:
Python 2.5, 2.6, or 2.7. Note that python 3.x is not supported on any platform. Make sure you have installed python.
Firefoxfirefox browser (this tutorial is for the latest browsers ).
SDK itself: You can obtain the latest stable version of the SDK as a tarball compressed package or ZIP file.
In addition, you can get the latest development version from its GitHub repository library.
Develop extensions for amo
If you submit to AMO, only the latest release may be used.
Git archive needs to extend some git attribute placeholders.
git checkout 1.16git archive 1.16 python-lib/cuddlefish/_version.py | tar -xvf -
Automatically installed to Mac OS X through homebrew
Run the following command to install the SDK plug-in tool through homebrew:
brew install mozilla-addon-sdk
Install it on Mac OS X/Linux
Regardless of the method you choose, decompress the file content as the root path and switch to the SDK root directory through a shell/command prompt. For example:
tar -xf addon-sdk.tar.gzcd addon-sdk
If you are a bash user, continue running (most of them ):
source bin/activate
If you are a non-bash user, you should run:
bash bin/activate
The command prompt should now have a new prefix containing the SDK root directory name:
(addon-sdk)~/mozilla/addon-sdk >
Install on Windows
Decompress the file and run the command to enter the SDK root directory. For example:
7z.exe x addon-sdk.zipcd addon-sdk
Then run the activation command:
bin\activate
You can also see that the command prompt should now have a new prefix containing the SDK root directory name:
(C:\Users\mozilla\sdk\addon-sdk) C:\Users\Work\sdk\addon-sdk>
SDK Virtual Environment
When a new prefix appears at the command prompt, it indicates that you have set up the SDK runtime environment, you can use the add-on SDK to develop the command line tool.
You can runDeactivate command to disable Virtual Environment
.
The configured virtual environment is specific to this specific command prompt. If you close the command prompt, it will close the running environment, you needsource bin/activate
OrBin \ activate in
A new command prompt to reactivate it. If you open a new command prompt, the SDK will not be activated in the new prompt.
You can copy multiple copies of the SDK to different locations on the disk, switch between them, or even activate them at different command prompts.
Create a startup Item
Allactivate
By setting environment variables bin
Scripts in the directory are located in the current command line. the startup items created are set through these variables in the permanent environment so that they can be read at every new command prompt. You do not need to open a new command prompt every time to activate activate
.
Because the precise setting of variables may change as the new version of the SDK is released, it is best to specify the variables to be set in the activation script. Activate and use different scripts to set different variables in the bash environment (Linux and Mac OS X and Windows environments ).
Windows
On Windows, usebin\activate\
activate.bat
The batchcompute script can also be usedsetx
Tools or control panel activation for permanent use.
Linux/Mac OS X
In Linux and Mac OS Xsource bin/activate
/activate
Bash script, you can~/.bashrc
(Linux)Or ~ /. Bashprofile
(Mac OS X.
As an alternative, you can ~/bin
Directory to create a symbolic link to the CFX program:
ln -s PATH_TO_SDK/bin/cfx ~/bin/cfx
Integrity check
Run the following command at the shell prompt:
cfx
It will generate the following information. Here is the first line of content, followed by a large amount of usage information:
Usage: cfx [options] [command]
This is the CFX command line program. It is the SDK for the main interface add-on. You can use it to start Firefox and test plug-ins, package additional distribution, and view ?? Document and run unit tests.
Problems?
Try to solve the problem through the troubleshooting page.
Next step
Next, let's start with the CFX tutorial, which describes how to use the CFX tool to create additional components.