~ubuntu-branches/ubuntu/precise/enigmail/precise-updates

« back to all changes in this revision

Viewing changes to mailnews/extensions/enigmail/makemake

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2014-01-30 11:42:56 UTC
  • mfrom: (0.12.17)
  • Revision ID: package-import@ubuntu.com-20140130114256-6yvx7ylu1cwrhwp2
Tags: 2:1.7-0ubuntu0.12.04.1
* New upstream release v1.7 to support Thunderbird 31

* No longer requires a Mozilla build system, so we use the upstream
  tarball directly now
  - update debian/rules
  - drop libgtk2.0-dev, libidl-dev, libdbus-glib-1-dev, libnotify-dev,
    libasound2-dev, libxt-dev, autoconf2.13 and mesa-common-dev
    build-depends, as these were only there because we were using a hacked
    Mozilla build system
* Update to source format 3.0
* Drop thunderbird-dev build-depend - the only binary code in enigmail now
  uses ctypes, so we don't need the SDK
* Drop debian/patches/no_libxpcom.patch - it doesn't build a binary component
  now
* Drop debian/patches/use_sdk.patch - there's no dependency on the
  Thunderbird SDK now

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
# **** BEGIN LICENSE BLOCK *****
4
 
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
 
#
6
 
# The contents of this file are subject to the Mozilla Public
7
 
# License Version 1.1 (the "MPL"); you may not use this file
8
 
# except in compliance with the MPL. You may obtain a copy of
9
 
# the MPL at http://www.mozilla.org/MPL/
10
 
#
11
 
# Software distributed under the MPL is distributed on an "AS
12
 
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13
 
# implied. See the MPL for the specific language governing
14
 
# rights and limitations under the MPL.
15
 
#
16
 
# The Original Code is Enigmail.
17
 
#
18
 
# The Initial Developer of the Original Code is Patrick Brunschwig.
19
 
# Portions created by Patrick Brunschwig <patrick@mozilla-enigmail.org> are
20
 
# Copyright (C) 2005 Patrick Brunschwig. All Rights Reserved.
21
 
#
22
 
# Contributor(s):
23
 
#
24
 
# Alternatively, the contents of this file may be used under the terms of
25
 
# either the GNU General Public License Version 2 or later (the "GPL"), or
26
 
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
 
# in which case the provisions of the GPL or the LGPL are applicable instead
28
 
# of those above. If you wish to allow use of your version of this file only
29
 
# under the terms of either the GPL or the LGPL, and not to allow others to
30
 
# use your version of this file under the terms of the MPL, indicate your
31
 
# decision by deleting the provisions above and replace them with the notice
32
 
# and other provisions required by the GPL or the LGPL. If you do not delete
33
 
# the provisions above, a recipient may use your version of this file under
34
 
# the terms of any one of the MPL, the GPL or the LGPL.
35
 
# ***** END LICENSE BLOCK *****
36
 
 
37
 
# makemake: script to generate Makefile from Makefile.in
38
 
#           -r:     process recursively all subdirectories
39
 
#           -o DIR: use DIR as MOZ_OBJDIR
40
 
# Usage: makemake [-o @TOPSRCDIR@/somedir] [-r]
41
 
 
42
 
my $makelist="./Makefile.in";
43
 
my $mozObjDir=".";
44
 
my $makefile;
45
 
 
46
 
my $cwd=`pwd`;
47
 
chomp($cwd);
48
 
my $topdir=$cwd;
49
 
my $depth="";
50
 
 
51
 
open(MAKEFILE, $makelist) || die ("Could not open '$makelist'\n");
52
 
while (my $l = <MAKEFILE>) {
53
 
  chomp($l);
54
 
  if ($l =~ /^\s*DEPTH\s*=/) {
55
 
    $l =~ s/(^\s*DEPTH\s*=\s*)(.*)$/$2/;
56
 
    $depth = $l;
57
 
  }
58
 
}
59
 
close(MAKEFILE);
60
 
 
61
 
if ($depth eq "") {
62
 
  while ( (length($topdir)>0) && ( basename($topdir) ne "mozilla" )) {
63
 
    $topdir=dirname($topdir);
64
 
  }
65
 
}
66
 
else {
67
 
  chdir($depth) || die "Directory '$depth' not found\n";
68
 
  $topdir=`pwd`;
69
 
  chomp($topdir);
70
 
  chdir($cwd);
71
 
}
72
 
print "INFO: found toplevel source directory $topdir\n";
73
 
 
74
 
if (open(MOZCONFIG, "$topdir/.mozconfig")) {
75
 
  while (my $l = <MOZCONFIG>) {
76
 
    chomp($l);
77
 
    if ($l =~ /^\s*mk_add_options\s+MOZ_OBJDIR\s*=/) {
78
 
      $l =~ s/(^\s*mk_add_options\s+MOZ_OBJDIR\s*=\s*)(.*)$/$2/;
79
 
      $mozObjDir = $l;
80
 
    }
81
 
  }
82
 
  close(MOZCONFIG);
83
 
}
84
 
else {
85
 
  print "INFO: no .mozconfig file found\n";
86
 
}
87
 
 
88
 
 
89
 
while ( $#ARGV >= 0 ) {
90
 
  if ($ARGV[0] eq "-o") {
91
 
    $mozObjDir=$ARGV[1];
92
 
    shift @ARGV;
93
 
  }
94
 
  if ($ARGV[0] eq "-r") {
95
 
    $makelist=`find . -name Makefile.in -print`;
96
 
    break;
97
 
  }
98
 
  shift @ARGV;
99
 
}
100
 
 
101
 
 
102
 
$mozObjDir =~ s/\@TOPSRCDIR\@/$topdir/;
103
 
 
104
 
if ($mozObjDir eq ".") {
105
 
  print "INFO: no MOZ_OBJDIR used\n";
106
 
}
107
 
else {
108
 
  print "INFO: using MOZ_OBJDIR=$mozObjDir\n\n";
109
 
}
110
 
 
111
 
foreach $makefile (split(/[ \n\r]+/, $makelist)) {
112
 
  $makefile =~ s/^\.\///;
113
 
  my $dir=dirname("$cwd/$makefile");
114
 
 
115
 
  my $wd=$dir;
116
 
  print "Processing: $wd\n";
117
 
  my $top_srcdir="";
118
 
  my $newMakefile = $makefile;
119
 
  $newMakefile =~ s/.in$//;
120
 
 
121
 
  if ($mozObjDir eq ".") {
122
 
    # no OBJDIR specified
123
 
    if ($depth eq "") {
124
 
      while ( (length($wd)>0) && (basename($wd) ne "mozilla") ) {
125
 
        if (length($top_srcdir) == 0) {
126
 
          $top_srcdir="..";
127
 
        }
128
 
        else {
129
 
          $top_srcdir="../$top_srcdir";
130
 
        }
131
 
        $wd=dirname($wd);
132
 
      }
133
 
    }
134
 
    else {
135
 
      $top_srcdir=$topdir;
136
 
    }
137
 
    $srcdir=".";
138
 
  }
139
 
  else {
140
 
    # using OBJDIR
141
 
    if ($depth eq "") {
142
 
      while ( (length($wd)>0) && (basename($wd) ne "mozilla") ) {
143
 
        $wd=dirname($wd);
144
 
      }
145
 
      $top_srcdir=$wd;
146
 
    }
147
 
    else {
148
 
      $top_srcdir=$topdir;
149
 
    }
150
 
    $srcdir=$dir;
151
 
    my $targetDir=$srcdir;
152
 
    $targetDir =~ s/$top_srcdir/$mozObjDir/x;
153
 
    system("mkdir -p '$targetDir'");
154
 
    $newMakefile=sprintf("%s/%s", $targetDir, basename($newMakefile));
155
 
  }
156
 
 
157
 
  my $enigMakefile = $makefile;
158
 
  $enigMakefile =~ s/\.in$/.enig/;
159
 
  if (-e $enigMakefile) {
160
 
    $makefile = $enigMakefile;
161
 
  }
162
 
  open(INFILE, $makefile) || die ("cannot open input file '$makefile'\n");
163
 
  open(OUTFILE, ">$newMakefile") || die ("cannot open output file '$newMakefile'\n");
164
 
 
165
 
  my $line;
166
 
  while ($line = <INFILE>) {
167
 
    $line =~ s/\@srcdir\@/$srcdir/g;
168
 
    $line =~ s/\@top_srcdir\@/$top_srcdir/g;
169
 
    print OUTFILE $line;
170
 
  }
171
 
  close(INFILE);
172
 
  close(OUTFILE);
173
 
}
174
 
 
175
 
if ($mozObjDir eq ".") {
176
 
  print "Done\n\n";
177
 
}
178
 
else {
179
 
  my $newWd=$cwd;
180
 
  $newWd =~ s/$topdir/$mozObjDir/x;
181
 
  print "Done. The code can now be compiled from $newWd\n\n";
182
 
}
183
 
 
184
 
sub basename {
185
 
  my $fn=$_[0];
186
 
  $fn =~ s/^(.*)\/(.*)$/$2/;
187
 
  return $fn;
188
 
}
189
 
 
190
 
sub dirname {
191
 
  my $dn=$_[0];
192
 
  $dn =~ s/^(.*)\/(.*)$/$1/;
193
 
  return $dn;
194
 
}