~ubuntu-branches/ubuntu/maverick/adblock-plus/maverick

« back to all changes in this revision

Viewing changes to buildtools/create_xpi.pl

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-05-04 14:45:07 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100504144507-h47ieg2r2w46nn32
Tags: 1.2-1
* New upstream release.
* Bump Standards-Version to 3.8.4 (no changes required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
use lib qw(buildtools);
11
11
use Packager;
12
12
 
13
 
my $manifest = readFile("chrome.manifest");
14
 
unless ($manifest =~ /\bjar:chrome\/(\S+?)\.jar\b/)
15
 
{
16
 
  die "Could not find JAR file name in chrome.manifest";
17
 
}
18
 
my $baseName = $1;
19
 
 
20
13
my %params = ();
21
14
 
22
 
my $xpiFile = shift @ARGV || "$baseName.xpi";
 
15
my $xpiFile = shift @ARGV;
23
16
if (@ARGV && $ARGV[0] =~ /^\+/)
24
17
{
25
18
  $params{devbuild} = $ARGV[0];
34
27
 
35
28
my $pkg = Packager->new(\%params);
36
29
$pkg->readVersion('version');
 
30
$pkg->readBasename('chrome.manifest');
37
31
$pkg->readLocales('chrome/locale') unless exists $params{locales};
38
32
$pkg->readLocaleData('chrome/locale');
39
33
 
 
34
$xpiFile = "$pkg->{baseName}.xpi" unless $xpiFile;
 
35
 
40
36
chdir('chrome');
41
 
$pkg->makeJAR("$baseName.jar", 'content', 'skin', 'locale', '-/tests', '-/mochitest', '-/.incomplete', '-/meta.properties');
 
37
$pkg->makeJAR("$pkg->{baseName}.jar", 'content', 'skin', 'locale', '-/tests', '-/mochitest', '-/.incomplete', '-/meta.properties');
42
38
chdir('..');
43
39
 
44
 
my @files = grep {-e $_} ('components', 'defaults', 'install.rdf', 'chrome.manifest', 'icon.png');
 
40
my @files = grep {-e $_} ('components', <modules/*.jsm>, 'defaults', 'install.rdf', 'chrome.manifest', 'icon.png');
 
41
@files = grep {$_ ne "modules/TimeLine.jsm"} @files unless exists($params{devbuild});
45
42
 
46
 
$pkg->makeXPI($xpiFile, "chrome/$baseName.jar", @files);
47
 
unlink("chrome/$baseName.jar");
 
43
$pkg->makeXPI($xpiFile, "chrome/$pkg->{baseName}.jar", @files);
 
44
unlink("chrome/$pkg->{baseName}.jar");
48
45
 
49
46
sub removeTimeLine
50
47
{
51
48
  my ($file, $line) = @_;
52
49
 
53
 
  return "\n" if $file =~ /\.js$/ && $line =~ /\btimeLine\.(\w+)\(/;
 
50
  return "\n" if $file =~ /\.jsm?$/ && $line =~ /\b[tT]imeLine\.(\w+)\(/;
 
51
  return "\n" if $file =~ /\.jsm?$/ && $line =~ /Cu\.import\([^()]*\bTimeLine\.jsm\"\)/;
54
52
 
55
53
  return $line;
56
54
}
57
 
 
58
 
sub readFile
59
 
{
60
 
  my $file = shift;
61
 
 
62
 
  open(local *FILE, "<", $file) || die "Could not read file '$file'";
63
 
  binmode(FILE);
64
 
  local $/;
65
 
  my $result = <FILE>;
66
 
  close(FILE);
67
 
 
68
 
  return $result;
69
 
}