User:Ssitter/UnifiedLightning: Difference between revisions

add script
m (Lightning 0.7 -> 0.8)
(add script)
Line 29: Line 29:
     <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform>
     <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform>
* package all files in a new zip archive and rename it from .zip to .xpi
* 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!
<pre><nowiki>#/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"
</nowiki></pre>