summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh53
-rw-r--r--manifest.json2
2 files changed, 36 insertions, 19 deletions
diff --git a/build.sh b/build.sh
index 478ca04..98f6440 100755
--- a/build.sh
+++ b/build.sh
@@ -154,18 +154,7 @@ as_html_list() {
done
}
-set_browser() {
- if [ "x$1" = "xmozilla" -o "x$1" = "xchromium" ]; then
- BROWSER="$1"
- else
- errcho "usage: $0 mozilla|chromium"
- exit 1
- fi
-}
-
-main() {
- set_browser "$1"
-
+build_main() {
# placate importers of these, as they are exported by the yet-to-be-created exports_init.js
EXPORTS__browser=exports_init.js
EXPORTS__is_chrome=exports_init.js
@@ -188,21 +177,25 @@ main() {
POPUPSCRIPTS="$(as_html_list $COMPUTED_SCRIPTS)"
eval "$(compute_scripts_list html/options_main.js || exit 1)"
OPTIONSSCRIPTS="$(as_html_list $COMPUTED_SCRIPTS)"
-
- BUILDDIR=build_$BROWSER
- rm -rf $BUILDDIR
- mkdir $BUILDDIR
+
for DIR in $(find $SCRIPTDIRS -type d); do
mkdir -p $BUILDDIR/$DIR
done
CHROMIUM_KEY=''
+ CHROMIUM_UPDATE_URL=''
GECKO_APPLICATIONS=''
+
+ if [ "x$UPDATE_URL" != x ]; then
+ UPDATE_URL=",\n \"update_url\": \"$UPDATE_URL\""
+ fi
if [ "$BROWSER" = "chromium" ]; then
CHROMIUM_KEY="$(dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64)"
CHROMIUM_KEY=$(echo chromium-key-dummy-file-$CHROMIUM_KEY | tr / -)
- touch $BUILDDIR/$CHROMIUM_KEY
+ touch "$BUILDDIR"/$CHROMIUM_KEY
+
+ CHROMIUM_UPDATE_URL="$UPDATE_URL"
CHROMIUM_KEY="\n\
// WARNING!!!\n\
@@ -217,7 +210,7 @@ main() {
\"applications\": {\n\
\"gecko\": {\n\
\"id\": \"{6fe13369-88e9-440f-b837-5012fb3bedec}\",\n\
- \"strict_min_version\": \"60.0\"\n\
+ \"strict_min_version\": \"60.0\"$UPDATE_URL\n\
}\n\
},"
fi
@@ -225,6 +218,7 @@ main() {
sed "\
s^_GECKO_APPLICATIONS_^$GECKO_APPLICATIONS^
s^_CHROMIUM_KEY_^$CHROMIUM_KEY^
+s^_CHROMIUM_UPDATE_URL_^$CHROMIUM_UPDATE_URL^
s^_BGSCRIPTS_^$BGSCRIPTS^
s^_CONTENTSCRIPTS_^$CONTENTSCRIPTS^" \
< manifest.json > $BUILDDIR/manifest.json
@@ -303,4 +297,27 @@ EOF
fi
}
+main() {
+ if [ "x$1" = "xmozilla" -o "x$1" = "xchromium" ]; then
+ BROWSER=$1
+ else
+ errcho "usage: $0 mozilla|chromium [build directory] [update url]"
+ exit 1
+ fi
+
+ SRCDIR="${2:-.}"
+ if [ -d "$SRCDIR" ]; then
+ BUILDDIR="$(realpath build_$BROWSER)"
+ rm -rf "$BUILDDIR"
+ mkdir "$BUILDDIR"
+ cd "$SRCDIR"
+ else
+ errcho "usage: $0 mozilla|chromium [source directory] [update url]"
+ exit 2
+ fi
+
+ UPDATE_URL="$3"
+ build_main
+}
+
main "$@"
diff --git a/manifest.json b/manifest.json
index 3caa6af..b18ea3e 100644
--- a/manifest.json
+++ b/manifest.json
@@ -43,7 +43,7 @@
"options_ui": {
"page": "html/options.html",
"open_in_tab": true
- },
+ }_CHROMIUM_UPDATE_URL_,
"web_accessible_resources": [_CHROMIUM_KEY_
],
"background": {