From 598aeca5515edb74a6fe857f64aab2e277920148 Mon Sep 17 00:00:00 2001 From: jkkn Date: Wed, 17 Oct 2007 08:30:47 +0000 Subject: [PATCH 1/1] Initial revision --- build.sh | 136 ++++++++ chrome.manifest | 6 + config_build.sh | 11 + content/about.xul | 30 ++ content/browser_overlay.xul | 37 ++ content/options.xul | 22 ++ content/tv2developer.js | 501 +++++++++++++++++++++++++++ defaults/preferences/tv2developer.js | 5 + install.rdf | 28 ++ locale/en-US/tv2developer.dtd | 8 + locale/en-US/tv2developer.properties | 18 + skin/interaktiv.png | Bin 0 -> 604 bytes skin/interaktiv_large.png | Bin 0 -> 4534 bytes skin/tv2developer.css | 13 + tv2developer.xpi | Bin 0 -> 14387 bytes 15 files changed, 815 insertions(+) create mode 100755 build.sh create mode 100755 chrome.manifest create mode 100755 config_build.sh create mode 100755 content/about.xul create mode 100755 content/browser_overlay.xul create mode 100755 content/options.xul create mode 100755 content/tv2developer.js create mode 100755 defaults/preferences/tv2developer.js create mode 100755 install.rdf create mode 100755 locale/en-US/tv2developer.dtd create mode 100755 locale/en-US/tv2developer.properties create mode 100755 skin/interaktiv.png create mode 100755 skin/interaktiv_large.png create mode 100755 skin/tv2developer.css create mode 100644 tv2developer.xpi diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e8f17fc --- /dev/null +++ b/build.sh @@ -0,0 +1,136 @@ +#!/usr/local/bin/bash +# build.sh -- builds JAR and XPI files for mozilla extensions +# by Nickolay Ponomarev +# (original version based on Nathan Yergler's build script) +# Most recent version is at + +# This script assumes the following directory structure: +# ./ +# chrome.manifest (optional - for newer extensions) +# install.rdf +# (other files listed in $ROOT_FILES) +# +# content/ | +# locale/ |} these can be named arbitrary and listed in $CHROME_PROVIDERS +# skin/ | +# +# defaults/ | +# components/ |} these must be listed in $ROOT_DIRS in order to be packaged +# ... | +# +# It uses a temporary directory ./build when building; don't use that! +# Script's output is: +# ./$APP_NAME.xpi +# ./$APP_NAME.jar (only if $KEEP_JAR=1) +# ./files -- the list of packaged files +# +# Note: It modifies chrome.manifest when packaging so that it points to +# chrome/$APP_NAME.jar!/* + +# +# default configuration file is ./config_build.sh, unless another file is +# specified in command-line. Available config variables: +APP_NAME= # short-name, jar and xpi files name. Must be lowercase with no spaces +CHROME_PROVIDERS= # which chrome providers we have (space-separated list) +CLEAN_UP= # delete the jar / "files" when done? (1/0) +ROOT_FILES= # put these files in root of xpi (space separated list of leaf filenames) +ROOT_DIRS= # ...and these directories (space separated list) +BEFORE_BUILD= # run this before building (bash command) +AFTER_BUILD= # ...and this after the build (bash command) + +if [ -z $1 ]; then + . ./config_build.sh +else + . $1 +fi + +if [ -z $APP_NAME ]; then + echo "You need to create build config file first!" + echo "Read comments at the beginning of this script for more info." + exit; +fi + +ROOT_DIR=`pwd` +TMP_DIR=build + +#uncomment to debug +#set -x + +# remove any left-over files from previous build +rm $APP_NAME.jar +rm $APP_NAME.xpi +rm files +rm -rf $TMP_DIR + +vi install.rdf content/about.xul + +$BEFORE_BUILD + +mkdir -pv $TMP_DIR/chrome + +# generate the JAR file, excluding CVS and temporary files +JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar +echo "Generating $JAR_FILE..." +for CHROME_SUBDIR in $CHROME_PROVIDERS; do + find $CHROME_SUBDIR -path '*CVS*' -prune -o -type f -print | grep -v \~ >> files +done + +zip -0 -r $JAR_FILE `cat files` +# The following statement should be used instead if you don't wish to use the JAR file +#cp --verbose --parents `cat files` $TMP_DIR/chrome + +# prepare components and defaults +echo "Copying various files to $TMP_DIR folder..." +for DIR in $ROOT_DIRS; do + mkdir $TMP_DIR/$DIR + FILES="`find $DIR -path '*CVS*' -prune -o -type f -print | grep -v \~`" + echo $FILES >> files + cp -v -r $DIR $TMP_DIR +done + +# Copy other files to the root of future XPI. +for ROOT_FILE in $ROOT_FILES install.rdf chrome.manifest; do + cp -v $ROOT_FILE $TMP_DIR + if [ -f $ROOT_FILE ]; then + echo $ROOT_FILE >> files + fi +done + +cd $TMP_DIR + +if [ -f "chrome.manifest" ]; then + echo "Preprocessing chrome.manifest..." + # You think this is scary? + #s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/ + #s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/ + # + # Then try this! (Same, but with characters escaped for bash :) + #sed -i bak -E s/^\(content\\s+\\S*\\s+\)\(\\S*\\/\)$/\\1jar:chrome\\/$APP_NAME\\.jar!\\/\\2/ chrome.manifest + #sed -i bak -E s/^\(skin\|locale\)\(\\s+\\S*\\s+\\S*\\s+\)\(.*\\/\)$/\\1\\2jar:chrome\\/$APP_NAME\\.jar!\\/\\3/ chrome.manifest + + # (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest) +fi + +# generate the XPI file +echo "Generating $APP_NAME.xpi..." +zip -r ../$APP_NAME.xpi * + +cd $ROOT_DIR + +echo "Cleanup..." +if [ $CLEAN_UP = 0 ]; then + # save the jar file + mv $TMP_DIR/chrome/$APP_NAME.jar . +else + rm ./files +fi + +# remove the working files +rm -rf $TMP_DIR + +cp -v tv2developer.xpi /sites/jkkndk/www.jkkn.net/webroot/tv2developer/ +vi /sites/jkkndk/www.jkkn.net/webroot/tv2developer/update.rdf +echo "Done!" + +$AFTER_BUILD + diff --git a/chrome.manifest b/chrome.manifest new file mode 100755 index 0000000..dcd0227 --- /dev/null +++ b/chrome.manifest @@ -0,0 +1,6 @@ +content tv2developer jar:chrome/tv2developer.jar!/content/ +skin tv2developer classic/1.0 jar:chrome/tv2developer.jar!/skin/ +locale tv2developer en-US jar:chrome/tv2developer.jar!/locale/en-US/ + +overlay chrome://browser/content/browser.xul chrome://tv2developer/content/browser_overlay.xul +style chrome://global/content/customizeToolbar.xul chrome://tv2developer/skin/tv2developer.css diff --git a/config_build.sh b/config_build.sh new file mode 100755 index 0000000..4507255 --- /dev/null +++ b/config_build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Build config for the build script, build.sh. Look there for more info. + +APP_NAME=tv2developer +CHROME_PROVIDERS="content skin locale" +CLEAN_UP=1 +ROOT_FILES="" +ROOT_DIRS="defaults" +BEFORE_BUILD= +AFTER_BUILD= diff --git a/content/about.xul b/content/about.xul new file mode 100755 index 0000000..e091aa3 --- /dev/null +++ b/content/about.xul @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/content/browser_overlay.xul b/content/browser_overlay.xul new file mode 100755 index 0000000..1b5b30a --- /dev/null +++ b/content/browser_overlay.xul @@ -0,0 +1,37 @@ + + + + + + +