Windows build script: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{extdev}}
{{extdev}}
{{msg:stub}}


Until somebody kind wrote anything here, take a look at [http://extensions.roachfiend.com/howto.php#build roachfiend's build script], which uses 7-zip and Windows cmd/command.com shell.
----
 
''Taken from [http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/#re-build roachfiend's build script], which uses [http://www.7-zip.org/ 7-Zip] and Windows cmd/command.com shell.''
 
----
 
Here’s what you need to do:
 
*Install [http://www.7-zip.org/ 7-Zip].
*Copy <tt>C:\Program Files\7-Zip\7z.exe</tt> to <tt>C:\WINDOWS\system32</tt> (This will put <tt>7z.exe</tt> in your system’s path, which will make it accessible from the command prompt).
 
*It’s a good practice to build your extensions somewhere far away from random scripts and clutter, so create a new folder somewhere and call it whatever your extension is named. Make sure it matches the internal <tt>.jar</tt> file that you previously referenced in your <tt>install.rdf</tt> file. You can always rename the final <tt>.xpi</tt> to something more intricate afterward, but for packaging, it’s best to keep it simple.
 
*Copy the following script and paste it in a text editor and save it as <tt>build.bat</tt> in your newly-made folder:
 
set x=%cd%
md build\chrome
cd chrome
7z a -tzip "%x%.jar" * -r -mx=0
move "%x%.jar" ..build\chrome
cd ..
copy install.* build
cd build
7z a -tzip "%x%.xpi" * -r -mx=9
move "%x%.xpi" ..
cd ..
rd build /s/q
 
*Now, you can build or modify your extensions easily. Just use the new folder as your base of creation, so that would contain the install files and chrome folder. Whenever you want to create your new file, just double-click <tt>build.bat</tt>, and your new extension will pop out in the same folder. Each time you use the <tt>build.bat</tt> script, it will delete your old file and create a new one.
 


[[Category:Development]]
[[Category:Development]]

Revision as of 00:15, 16 February 2005

This page is part of the extension development documentation project.

Ask your questions in MozillaZine Forums. Also try browsing example code.

Note: development documentation is in process of being moved to Mozilla Development Center (MDC).


Taken from roachfiend's build script, which uses 7-Zip and Windows cmd/command.com shell.


Here’s what you need to do:

  • Install 7-Zip.
  • Copy C:\Program Files\7-Zip\7z.exe to C:\WINDOWS\system32 (This will put 7z.exe in your system’s path, which will make it accessible from the command prompt).
  • It’s a good practice to build your extensions somewhere far away from random scripts and clutter, so create a new folder somewhere and call it whatever your extension is named. Make sure it matches the internal .jar file that you previously referenced in your install.rdf file. You can always rename the final .xpi to something more intricate afterward, but for packaging, it’s best to keep it simple.
  • Copy the following script and paste it in a text editor and save it as build.bat in your newly-made folder:
set x=%cd%
md build\chrome
cd chrome
7z a -tzip "%x%.jar" * -r -mx=0
move "%x%.jar" ..build\chrome
cd ..
copy install.* build
cd build
7z a -tzip "%x%.xpi" * -r -mx=9
move "%x%.xpi" ..
cd ..
rd build /s/q
  • Now, you can build or modify your extensions easily. Just use the new folder as your base of creation, so that would contain the install files and chrome folder. Whenever you want to create your new file, just double-click build.bat, and your new extension will pop out in the same folder. Each time you use the build.bat script, it will delete your old file and create a new one.