~ubuntu-branches/ubuntu/oneiric/enigmail/oneiric-updates

« back to all changes in this revision

Viewing changes to extensions/enigmail/lang/make-lang.sh

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2010-04-10 01:42:24 UTC
  • Revision ID: james.westby@ubuntu.com-20100410014224-fbq9ui5x3b0h2t36
Tags: 2:1.0.1-0ubuntu1
* First releaase of enigmail 1.0.1 for tbird/icedove 3
  (LP: #527138)
* redo packaging from scratch 
  + add debian/make-orig target that uses xulrunner provided
    buildsystem + enigmail tarball to produce a proper orig.tar.gz
  + use debhelper 7 with mozilla-devscripts
  + use debian source format 3.0 (quilt)
  + patch enigmail to use frozen API only
    - add debian/patches/frozen_api.diff
  + patch build system to not link against -lxul - which isnt
    available for sdks produced by all-static apps like tbird
    - add debian/patches/build_system_dont_link_libxul.diff
  + add minimal build-depends to control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# make-lang.sh v1.0.10
 
4
# this script is used to create a language-specifi XPI for Enigmail
 
5
 
 
6
# if you want to debug this script, set DEBUG to something >0
 
7
DEBUG=0
 
8
 
 
9
if [ $# -ne 2 ]; then
 
10
  echo "Usage: $0 xx-YY version"
 
11
  echo "       where: xx-YY   is the language and country code representing the"
 
12
  echo "                      translated language"
 
13
  echo "              version is the Enigmail version, e.g. 0.84.1"
 
14
  exit 1
 
15
fi
 
16
 
 
17
ENIGLANG=$1
 
18
export ENIGLANG
 
19
 
 
20
ENIGVERSION=$2
 
21
export ENIGVERSION
 
22
 
 
23
LANGDIR=${ENIGLANG}/chrome/locale/${ENIGLANG}/enigmail
 
24
HELPDIR=${LANGDIR}/help
 
25
cwd=`pwd`
 
26
rm -rf ${LANGDIR} >/dev/null 2>&1
 
27
mkdir -p ${LANGDIR} 
 
28
mkdir -p ${HELPDIR}
 
29
 
 
30
LANGHASH=`echo "${ENIGLANG}" | md5sum | awk '{ print substr($0,1,2)}'`
 
31
export LANGHASH
 
32
 
 
33
# create install.js
 
34
cat > ${ENIGLANG}/install.js <<EOT
 
35
// Install script for Enigmail ${ENIGLANG} language pack
 
36
 
 
37
var err;
 
38
const APP_VERSION="${ENIGVERSION}";
 
39
 
 
40
err = initInstall("Enigmail ${ENIGLANG} Language pack",  // name for install UI
 
41
                  "/enigmail-${ENIGLANG}",   // registered name
 
42
                  APP_VERSION+".0");         // package version
 
43
 
 
44
logComment("initInstall: " + err);
 
45
 
 
46
var srDest = 15;       // Disk space required for installation (KB)
 
47
 
 
48
var fProgram    = getFolder("Program");
 
49
logComment("fProgram: " + fProgram);
 
50
 
 
51
if (!verifyDiskSpace(fProgram, srDest)) {
 
52
  cancelInstall(INSUFFICIENT_DISK_SPACE);
 
53
 
 
54
} else {
 
55
 
 
56
  var fChrome     = getFolder("Chrome");
 
57
 
 
58
  // addDirectory: blank, archive_dir, install_dir, install_subdir
 
59
  addDirectory("", "chrome",        fChrome,     "");
 
60
 
 
61
  err = getLastError();
 
62
  if (err == ACCESS_DENIED) {
 
63
    alert("Unable to write to components directory "+fChrome+".\n You will need to restart the browser with administrator/root privileges to install this software. After installing as root (or administrator), you will need to restart the browser one more time, as a privileged user, to register the installed software.\n After the second restart, you can go back to running the browser without privileges!");
 
64
 
 
65
    cancelInstall(ACCESS_DENIED);
 
66
 
 
67
  } else if (err != SUCCESS) {
 
68
    cancelInstall(err);
 
69
 
 
70
  } else {
 
71
    // Register chrome
 
72
 
 
73
    registerChrome( LOCALE | DELAYED_CHROME, getFolder("Chrome","enigmail-${ENIGLANG}.jar"), "locale/${ENIGLANG}/enigmail/");
 
74
 
 
75
    err = getLastError();
 
76
 
 
77
    if (err != SUCCESS) {
 
78
      cancelInstall(err);
 
79
 
 
80
    } else {
 
81
      performInstall();
 
82
    }
 
83
  }
 
84
}
 
85
 
 
86
// this function verifies disk space in kilobytes
 
87
function verifyDiskSpace(dirPath, spaceRequired) {
 
88
  var spaceAvailable;
 
89
 
 
90
  // Get the available disk space on the given path
 
91
  spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
 
92
 
 
93
  // Convert the available disk space into kilobytes
 
94
  spaceAvailable = parseInt(spaceAvailable / 1024);
 
95
 
 
96
  // do the verification
 
97
  if(spaceAvailable < spaceRequired) {
 
98
    logComment("Insufficient disk space: " + dirPath);
 
99
    logComment("  required : " + spaceRequired + " K");
 
100
    logComment("  available: " + spaceAvailable + " K");
 
101
    return false;
 
102
  }
 
103
 
 
104
  return true;
 
105
}
 
106
EOT
 
107
 
 
108
cat > ${ENIGLANG}/chrome.manifest <<EOT
 
109
locale      enigmail    ${ENIGLANG}       jar:chrome/enigmail-${ENIGLANG}.jar!/locale/${ENIGLANG}/enigmail/
 
110
EOT
 
111
 
 
112
# create install.rdf for Thunderbird 0.7 and newer
 
113
cat > ${ENIGLANG}/install.rdf <<EOT
 
114
<?xml version="1.0"?>
 
115
 
 
116
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 
117
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
118
 
 
119
  <Description about="urn:mozilla:install-manifest">
 
120
    <em:id>enigmail-${ENIGLANG}@enigmail.mozdev.org</em:id>
 
121
    <em:version>${ENIGVERSION}</em:version>
 
122
    
 
123
    <!-- Target Application (Thunderbird) this extension can install into, 
 
124
        with minimum and maximum supported versions. --> 
 
125
    <em:targetApplication>
 
126
      <Description>
 
127
        <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
 
128
        <em:minVersion>1.0</em:minVersion>
 
129
        <em:maxVersion>2.0.0.*</em:maxVersion>
 
130
      </Description>
 
131
      <Description>
 
132
        <!-- Seamonkey -->
 
133
        <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
 
134
        <em:minVersion>2.0a1</em:minVersion>
 
135
        <em:maxVersion>2.0.*</em:maxVersion>
 
136
      </Description>
 
137
    </em:targetApplication>
 
138
    
 
139
    <!-- Front End MetaData -->
 
140
    <em:name>Enigmail ${ENIGLANG}</em:name>
 
141
    <em:description>Enigmail ${ENIGLANG} language package</em:description>
 
142
    
 
143
    <!-- Author of the package, replace with your name if you like -->
 
144
    <em:creator>Enigmail Team</em:creator>
 
145
    
 
146
    <em:homepageURL>http://enigmail.mozdev.org/langpack.html</em:homepageURL>
 
147
 
 
148
    <!-- Front End Integration Hooks (used by Extension Manager)-->
 
149
    <em:optionsURL>chrome://enigmail/content/pref-enigmail.xul</em:optionsURL>
 
150
    <em:aboutURL>chrome://enigmail/content/enigmailAbout.xul</em:aboutURL>
 
151
    <em:iconURL>chrome://enigmail/skin/enigmail-about.png</em:iconURL>
 
152
    
 
153
  </Description>      
 
154
</RDF>
 
155
EOT
 
156
 
 
157
cat >${LANGDIR}/contents.rdf <<EOT
 
158
<?xml version="1.0"?>
 
159
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 
160
         xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
 
161
 
 
162
  <!-- list all the packages being supplied by this jar -->
 
163
  <RDF:Seq about="urn:mozilla:locale:root">
 
164
    <RDF:li resource="urn:mozilla:locale:${ENIGLANG}"/>
 
165
  </RDF:Seq>
 
166
 
 
167
  <!-- locale information -->
 
168
  <RDF:Description about="urn:mozilla:locale:${ENIGLANG}"  chrome:name="${ENIGLANG}">
 
169
 
 
170
    <chrome:packages>
 
171
      <RDF:Seq about="urn:mozilla:locale:${ENIGLANG}:packages">
 
172
        <RDF:li resource="urn:mozilla:locale:${ENIGLANG}:enigmail"/>
 
173
      </RDF:Seq>
 
174
    </chrome:packages>
 
175
 
 
176
  </RDF:Description>
 
177
 
 
178
</RDF:RDF>
 
179
EOT
 
180
 
 
181
for f in enigmail.dtd enigmail.properties am-enigprefs.properties upgrade_080.html ; do
 
182
  cp ${f} ${LANGDIR}
 
183
done
 
184
 
 
185
if [ -d help ]; then
 
186
  cd help
 
187
fi
 
188
pwd
 
189
 
 
190
for f in compose.html messenger.html rulesEditor.html editRcptRule.html initError.html ; do
 
191
  cp ${f} ${cwd}/${HELPDIR} 
 
192
done
 
193
 
 
194
cd ${cwd}/${ENIGLANG}/chrome
 
195
zip -r -D enigmail-${ENIGLANG}.jar locale
 
196
cd ..
 
197
zip ../enigmail-${ENIGLANG}-${ENIGVERSION}.xpi install.js install.rdf chrome.manifest chrome/enigmail-${ENIGLANG}.jar
 
198
cd ..
 
199
 
 
200
test $DEBUG -eq 0 && rm -rf ${ENIGLANG}