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
This commit is contained in:
Lance 2011-10-03 05:56:36 +00:00
parent f3bbed043b
commit 06d954479b
4 changed files with 73 additions and 1 deletions

View file

@ -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:

16
engine/npfte/chrome.pem Normal file
View file

@ -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-----

42
engine/npfte/crxmake.sh Executable file
View file

@ -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 <extension dir> <pem path>"
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"

View file

@ -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 }
]
}