~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to extensions/enigmail/ipc/makemake

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
# makemake: script to generate Makefile from Makefile.in
3
 
#           -r:     process recursively all subdirectories
4
 
#           -o DIR: use DIR as MOZ_OBJDIR
5
 
# Usage: makemake [-o @TOPSRCDIR@/somedir] [-r]
6
 
 
7
 
my $makelist="./Makefile.in.ipc";
8
 
my $mozObjDir=".";
9
 
my $makefile;
10
 
 
11
 
my $cwd=`pwd`;
12
 
chomp($cwd);
13
 
my $topdir=$cwd;
14
 
my $depth="";
15
 
 
16
 
open(MAKEFILE, $makelist) || die ("Could not open '$makelist'\n");
17
 
while (my $l = <MAKEFILE>) {
18
 
  chomp($l);
19
 
  if ($l =~ /^\s*DEPTH\s*=/) {
20
 
    $l =~ s/(^\s*DEPTH\s*=\s*)(.*)$/$2/;
21
 
    $depth = $l;
22
 
  }
23
 
}
24
 
close(MAKEFILE);
25
 
 
26
 
if ($depth eq "") {
27
 
  while ( (length($topdir)>0) && ( basename($topdir) ne "mozilla" )) {
28
 
    $topdir=dirname($topdir);
29
 
  }
30
 
}
31
 
else {
32
 
  chdir($depth) || die "Directory '$depth' not found\n";
33
 
  $topdir=`pwd`;
34
 
  chomp($topdir);
35
 
  chdir($cwd);
36
 
}
37
 
print "INFO: found toplevel source directory $topdir\n";
38
 
 
39
 
if (open(MOZCONFIG, "$topdir/.mozconfig")) {
40
 
  while (my $l = <MOZCONFIG>) {
41
 
    chomp($l);
42
 
    if ($l =~ /^\s*mk_add_options\s+MOZ_OBJDIR\s*=/) {
43
 
      $l =~ s/(^\s*mk_add_options\s+MOZ_OBJDIR\s*=\s*)(.*)$/$2/;
44
 
      $mozObjDir = $l;
45
 
    }
46
 
  }
47
 
  close(MOZCONFIG);
48
 
}
49
 
else {
50
 
  print "INFO: no .mozconfig file found\n";
51
 
}
52
 
 
53
 
 
54
 
while ( $#ARGV >= 0 ) {
55
 
  if ($ARGV[0] eq "-o") {
56
 
    $mozObjDir=$ARGV[1];
57
 
    shift @ARGV;
58
 
  }
59
 
  if ($ARGV[0] eq "-r") {
60
 
    $makelist=`find . -name Makefile.in.ipc -print`;
61
 
    break;
62
 
  }
63
 
  shift @ARGV;
64
 
}
65
 
 
66
 
 
67
 
$mozObjDir =~ s/\@TOPSRCDIR\@/$topdir/;
68
 
 
69
 
if ($mozObjDir eq ".") {
70
 
  print "INFO: no MOZ_OBJDIR used\n";
71
 
}
72
 
else {
73
 
  print "INFO: using MOZ_OBJDIR=$mozObjDir\n\n";
74
 
}
75
 
 
76
 
foreach $makefile (split(/[ \n\r]+/, $makelist)) {
77
 
  $makefile =~ s/^\.\///;
78
 
  my $dir=dirname("$cwd/$makefile");
79
 
 
80
 
  my $wd=$dir;
81
 
  print "Processing: $wd\n";
82
 
  my $top_srcdir="";
83
 
  my $newMakefile = $makefile;
84
 
  $newMakefile =~ s/.in.ipc$//;
85
 
 
86
 
  if ($mozObjDir eq ".") {
87
 
    # no OBJDIR specified
88
 
    if ($depth eq "") {
89
 
      while ( (length($wd)>0) && (basename($wd) ne "mozilla") ) {
90
 
        if (length($top_srcdir) == 0) {
91
 
          $top_srcdir="..";
92
 
        }
93
 
        else {
94
 
          $top_srcdir="../$top_srcdir";
95
 
        }
96
 
        $wd=dirname($wd);
97
 
      }
98
 
    }
99
 
    else {
100
 
      $top_srcdir=$topdir;
101
 
    }
102
 
    $srcdir=".";
103
 
  }
104
 
  else {
105
 
    # using OBJDIR
106
 
    if ($depth eq "") {
107
 
      while ( (length($wd)>0) && (basename($wd) ne "mozilla") ) {
108
 
        $wd=dirname($wd);
109
 
      }
110
 
      $top_srcdir=$wd;
111
 
    }
112
 
    else {
113
 
      $top_srcdir=$topdir;
114
 
    }
115
 
    $srcdir=$dir;
116
 
    my $targetDir=$srcdir;
117
 
    $targetDir =~ s/$top_srcdir/$mozObjDir/x;
118
 
    system("mkdir -p '$targetDir'");
119
 
    $newMakefile=sprintf("%s/%s", $targetDir, basename($newMakefile));
120
 
  }
121
 
 
122
 
  open(INFILE, $makefile) || die ("cannot open input file '$makefile'\n");
123
 
  open(OUTFILE, ">$newMakefile") || die ("cannot open output file '$newMakefile'\n");
124
 
 
125
 
  my $line;
126
 
  while ($line = <INFILE>) {
127
 
    $line =~ s/\@srcdir\@/$srcdir/g;
128
 
    $line =~ s/\@top_srcdir\@/$top_srcdir/g;
129
 
    print OUTFILE $line;
130
 
  }
131
 
  close(INFILE);
132
 
  close(OUTFILE);
133
 
}
134
 
 
135
 
if ($mozObjDir eq ".") {
136
 
  print "Done\n\n";
137
 
}
138
 
else {
139
 
  my $newWd=$cwd;
140
 
  $newWd =~ s/$topdir/$mozObjDir/x;
141
 
  print "Done. The code can now be compiled from $newWd\n\n";
142
 
}
143
 
 
144
 
sub basename {
145
 
  my $fn=$_[0];
146
 
  $fn =~ s/^(.*)\/(.*)$/$2/;
147
 
  return $fn;
148
 
}
149
 
 
150
 
sub dirname {
151
 
  my $dn=$_[0];
152
 
  $dn =~ s/^(.*)\/(.*)$/$1/;
153
 
  return $dn;
154
 
}