User:Ssitter/UnifiedLightning
HowTo repackage Lightning for Linux and Windows
The purpose of this document is to provide a short tutorial on how to repackage Lightning so that it ships all binaries parts for Linux and Windows and can be installed in a shared profile.
Basically you'll need to:
- download lightning-0.8-tb-linux.xpi and lightning-0.8-tb-win.xpi
- rename both .xpi files to .zip and extract them to the same folder
- create new subfolder ./platform/Linux_x86-gcc3/components
- create new subfolder ./platform/WINNT_x86-msvc/components
- move all *.so files from ./components to ./platform/Linux_x86-gcc3/components
- move all *.dll files from ./components to ./platform/WINNT_x86-msvc/components
- The final folder structure should look like
lightning.xpi
+ chrome
+ components
+ defaults
+ js
+ platform
+ Linux_x86-gcc3
+ components
+ WINNT_x86-msvc
+ components
+ chrome.manifest
+ install.rdf
- open file ./install.rdf with text editor and search for em:targetPlatform
- change the line to
<em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform>
- package all files in a new zip archive and rename it from .zip to .xpi
Scripted version
Put the Windows and Linux XPIs in one directory, place this script in that same directory, and run it, to get a "lightning-0.x-tb-dual-boot.xpi" install file!
#/bin/bash
# This script performs the packaging necessary for creating a Lightning extension
# package compatible with both Windows and Linux. This is based off the
# instructions here: <https://wiki.mozilla.org/User:Ssitter/UnifiedLightning>
# - Edward Z. Yang <edwardzyang@thewritingpot.com>
VERSION="$1"
if [ "$VERSION" = "" ]
then
echo "Please pass version as first parameter"
exit 1
fi
NAME="lightning-$VERSION-tb"
LINUX="$NAME-linux"
WINDOWS="$NAME-win"
DUAL="$NAME-dual-boot"
if [ ! -f "$LINUX.xpi" ]
then
echo "Could not find Linux XPI"
exit 1
fi
if [ ! -f "$WINDOWS.xpi" ]
then
echo "Could not find Windows XPI"
exit 1
fi
if [ -f "$DUAL.xpi" ]
then
echo "Dual-boot XPI already exists"
exit 1
fi
if [ -d "$NAME" ]
then
echo "Output directory $NAME already exists"
exit 1
fi
mkdir "$NAME"
cp "$LINUX.xpi" "$NAME"
cp "$WINDOWS.xpi" "$NAME"
# extract XPIs to the same folder
cd "$NAME"
unzip "$LINUX.xpi"
unzip -o "$WINDOWS.xpi"
rm "$LINUX.xpi" "$WINDOWS.xpi"
# create new subfolders
mkdir platform
mkdir platform/Linux_x86-gcc3
mkdir platform/Linux_x86-gcc3/components
mkdir platform/WINNT_x86-msvc
mkdir platform/WINNT_x86-msvc/components
# move platform dependent files
mv -t platform/Linux_x86-gcc3/components components/*.so
mv -t platform/WINNT_x86-msvc/components components/*.dll
# replace <em:targetPlatform>
cp install.rdf old-install.rdf
sed 's#<em:targetPlatform>[^<]*</em:targetPlatform>#<em:targetPlatform>WINNT_x86-msvc</em:targetPlatform><em:targetPlatform>Linux_x86-gcc3</em:targetPlatform>#' \
< old-install.rdf > install.rdf
# zip it all up
zip -r "$DUAL.xpi" *
mv "$DUAL.xpi" ..
cd ..
rm -rf "$NAME"