发布时间:2011-4-8 15:31
分类名称:Plugins
下面列举用来打包Xpcom或者NpAPI Plugins的使用的文件列表(未全部列举出来),详情见:
https://developer.mozilla.org/en/Bundles
包的根目录 | 描述 | 版本信息 |
/install.rdf | 其文件是一个xml文件,里面有插件的名称,作者,版本,与firefox的版本兼容等信息 | Gecko 1.9(Firefox3.6)之后都支持 |
/chrome.manifest | 用来描述各个文件的存放路径,以及程序的一些界面的描述等 | >= Gecko 1.8 |
/components/* | XPCOM components (*.js, *.dll), and interface files from *.xpt | >= Gecko 1.7 |
/plugins/* | 用来存放NPAPI插件(*.dll,*.so …)Gecko2.0(Firefox 4)和之前版本有些差别,在下面说明 | >= Gecko 1.8 |
/platform/* | 用来存放各个平台(windows,linux,mac)下的xpcom动态库,需要分目录存放,目录的名称使用平台+编译器定义,具体内容见官方文档 | >= Gecko 1.8 |
打包XPCOM
包的结构如下:
FTXpCom
│ chrome.manifest
│ install.rdf
│
├─components
│ IGetTokenInfo.xpt
│ ISlotManager.xpt
│
└─platform
├─Darwin_x86-gcc3
│ └─components
│ FtXpCom.dylib
│
├─Linux_x86-gcc3
│ └─components
│ FtXpCom.so
│
└─WINNT_x86-msvc
└─components
FtXpCom.dll
## Reference for Chrome Registration: https://developer.mozilla.org/en/Chrome_Registration
# XPT Files:
# The path of any XPT files must be listed explicitly
interfaces components/IGetTokenInfo.xpt
interfaces components/ISlotManager.xpt
# Binary Components
# Binary components must be listed explicitly in a manifest using a binary-component directive:
# Platform-Specific Directories
#
# Linux_x86-gcc3
binary-component platform/Linux_x86-gcc3/components/FtXpCom.so ABI=Linux_x86-gcc3
# WINNT_x86-msvc
binary-component platform/WINNT_x86-msvc/components/FtXpCom.dll ABI=WINNT_x86-msvc
# Darwin_x86-gcc3
binary-component platform/Darwin_x86-gcc3/components/FtXpCom.dylib ABI=Darwin_x86-gcc3
<?xml version="1.0"?>
<RDF:RDF xmlns:em="http://www.mozilla.org/2004/em-rdf#"
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="urn:mozilla:install-manifest"
>
<em:id>{DABD0797-C1B5-431b-B25E-6EB5734CE682}</em:id>
<em:name>FtXPCOM</em:name>
<em:version>1.0</em:version>
<em:creator>dsliu(hao.dsliu@gmail.com)</em:creator>
<em:contributor>None</em:contributor>
<em:description>A demo for using key to sign data</em:description>
<em:type>2</em:type>
<em:targetPlatform>WINNT_x86-msvc</em:targetPlatform>
<em:targetPlatform>Linux_x86-gcc3</em:targetPlatform>
<em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform>
<em:unpack>true</em:unpack>
<!-- Target Apps -->
<!-- Firefox -->
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>4.0.*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:RDF>
打包NPAPI
相对XPCOM而言,制作一个NPAPI插件包很简单。只需要一个配置文(install.rdf)和一个plugins目录(里面放的都是各个平台的NPAPI动态库)。不用Chrome.manifest也可以。
包结构:
Gecko 2(Firefox 4) and later:
FtNpRuntimeCom
│ install.rdf
│
└─plugins
npruntime.dll
npruntime.so
npruntime.dylib
Gecko 1.9.2 (Firefox 3.6) and earlier
FtNpRuntimeCom
│ install.rdf
│
└─platform
├─Darwin_x86-gcc3
│ └─plugins
│ npruntime.dylib
│
├─Linux_x86-gcc3
│ └─plugins
│ npruntime.so
│
└─WINNT_x86-msvc
└─plugins
npruntime.dll
<?xml version="1.0"?>
<RDF:RDF xmlns:em="http://www.mozilla.org/2004/em-rdf#"
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="urn:mozilla:install-manifest"
>
<em:id>{13D4CDB0-AE74-4aa9-8806-5D92AF092477}</em:id>
<em:name>FtNPSample</em:name>
<em:version>1.1</em:version>
<em:creator>dsliu(hao.dsliu@gmail.com)</em:creator>
<em:contributor>None</em:contributor>
<em:description>A demo for packing npapi</em:description>
<em:type>2</em:type>
<em:unpack>true</em:unpack>
<!-- Target Apps -->
<!-- Firefox -->
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>4.0.*</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:RDF>
https://developer.mozilla.org/en/Shipping_a_plugin_as_a_Toolkit_bundle
https://developer.mozilla.org/en/Bundles