From 06d954479b8c185a5adc33702156766be91a183a Mon Sep 17 00:00:00 2001 From: Lance Date: Mon, 3 Oct 2011 05:56:36 +0000 Subject: [PATCH] npfte target now creates npfte.crx for Google Chrome git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3906 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile | 8 +++++++- engine/npfte/chrome.pem | 16 +++++++++++++++ engine/npfte/crxmake.sh | 42 ++++++++++++++++++++++++++++++++++++++ engine/npfte/manifest.json | 8 ++++++++ 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 engine/npfte/chrome.pem create mode 100755 engine/npfte/crxmake.sh create mode 100644 engine/npfte/manifest.json diff --git a/engine/Makefile b/engine/Makefile index e23e386e9..7edb0e709 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -1027,7 +1027,13 @@ npqtvcl-profile: npfte-rel: $(MAKE) npfte-tmp TYPE=_cl-rel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)" cp $(RELEASE_DIR)/npfte.dll npfte/plugins - cd npfte && zip $(abspath $(RELEASE_DIR)/npfte.xpi) * plugins/* + cd npfte && zip $(abspath $(RELEASE_DIR)/npfte.xpi) install.rdf plugins/npfte.dll + rm -rf /tmp/npfte + mkdir /tmp/npfte + cp $(RELEASE_DIR)/npfte.dll /tmp/npfte + cp ./npfte/manifest.json /tmp/npfte + cd $(RELEASE_DIR)/ && ../npfte/crxmake.sh /tmp/npfte ../npfte/chrome.pem + rm -rf /tmp/npfte npfte-dbg: $(MAKE) npfte-tmp TYPE=_clsv-dbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)" npfte-profile: diff --git a/engine/npfte/chrome.pem b/engine/npfte/chrome.pem new file mode 100644 index 000000000..daa5a1cdf --- /dev/null +++ b/engine/npfte/chrome.pem @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBANzHsq7OxZkTaHNZ/ +/3Pf5bKt2D8K+Ahekwb/jw+BS2FtuRLV+8ffCVcgbAlWG5Bqxuk+y/xdzP5Rf2ria +sKGDkSyGiVB2JqDN4RIhsj1JfpBTKAl6/k4Wz+xzU5G4Ri/c7k9YnIvbXlad9N+YT +xjDR5pfdJMtGlnavuTVm8XGzFAgMBAAECgYEAyn6Kv1Q83ep0GaCJb3R6VIa3bMe9 +QkPSVK40H3LO8vK6TWdhTpv1FJtlA3ctRWsLkj5eeJmiuFPAQyqrCOooTbPzfu/OV +t63bcxLGJ7CThJN/cWft6ISMWRurSgo6dequmph3ssHyWPWhQpoy/7+RbgUgKrvpK +0PUEs1xal/dKECQQD5kEMCeOS21DMeNobtTThEkKO83TXMEbH78i6sWK1LmD19t1A +Ni6HEWIVLSkmyY8ygR7A0Axejuf6ycEUdpkqZAkEA4nlk4D0BnJaP7ESq6NIY5Qzb +TsSCh870EuRrSpBy00BewXEUpRfz20o0XtB5k7jU2cNuvXN/D5CYo8KJAcCbDQJBA +LCJtF1TV7dddKuyts+3CE64Ypt/gEbTXax0LUANmskW8Ki1vBNY6x4R4HjaHDftER +twmtywM1DGib2AXeQTdkECQQDHGS+szxUuo1KtxIR4H9QQ8aePbMTQPglm3nbQW4M +G4u0qpI4gwZj5bRfzTtXDH1fIhb5CQVovxc/bD7fA2aG1AkEAgjDCxZhkqSP95ZUY +Zp3YgrFjC5Sin+oYz7xkfl1IrP4GQt9EJBXzO+UMSufeZfzKxS/BXNECNnxx5wOdZ ++KsUw== +-----END PRIVATE KEY----- diff --git a/engine/npfte/crxmake.sh b/engine/npfte/crxmake.sh new file mode 100755 index 000000000..32d5778a4 --- /dev/null +++ b/engine/npfte/crxmake.sh @@ -0,0 +1,42 @@ +#!/bin/bash -e +# +# Purpose: Pack a Chromium extension directory into crx format + +if test $# -ne 2; then + echo "Usage: crxmake.sh " + exit 1 +fi + +dir=$1 +key=$2 +name=$(basename "$dir") +crx="$name.crx" +pub="$name.pub" +sig="$name.sig" +zip="$name.zip" +trap 'rm -f "$pub" "$sig" "$zip"' EXIT + +# zip up the crx dir +cwd=$(pwd -P) +(cd "$dir" && zip -qr -9 -X "$cwd/$zip" .) + +# signature +openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig" + +# public key +openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null + +byte_swap () { + # Take "abcdefgh" and return it as "ghefcdab" + echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}" +} + +crmagic_hex="4372 3234" # Cr24 +version_hex="0200 0000" # 2 +pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}'))) +sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}'))) +( + echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p + cat "$pub" "$sig" "$zip" +) > "$crx" +echo "Wrote $crx" diff --git a/engine/npfte/manifest.json b/engine/npfte/manifest.json new file mode 100644 index 000000000..11da243c2 --- /dev/null +++ b/engine/npfte/manifest.json @@ -0,0 +1,8 @@ +{ + "name": "FTE Quakeworld Embedded Browser Plugin", + "version": "1", + "description": "FTEQW by the ForeThought Entertainment team, a Windows only free open source engine that supports Quake(tm) 1 (QuakeWorld/NetQuake), Quake 2(tm), Hexen 2(tm), Quake 3(tm) etc via way of NPAPI many browsers support like Safari, Chrome & Firefox", + "plugins": [ + { "path": "npfte.dll", "public": true } + ] +} \ No newline at end of file