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

« back to all changes in this revision

Viewing changes to mozilla/build/win32/pgomerge.py

  • 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/python
 
2
# This Source Code Form is subject to the terms of the Mozilla Public
 
3
# License, v. 2.0. If a copy of the MPL was not distributed with this
 
4
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
5
 
 
6
# Usage: pgomerge.py <binary basename> <dist/bin>
 
7
# Gathers .pgc files from dist/bin and merges them into
 
8
# $PWD/$basename.pgd using pgomgr, then deletes them.
 
9
# No errors if any of these files don't exist.
 
10
 
 
11
import sys, os, os.path, subprocess
 
12
if not sys.platform == "win32":
 
13
    raise Exception("This script was only meant for Windows.")
 
14
 
 
15
def MergePGOFiles(basename, pgddir, pgcdir):
 
16
  """Merge pgc files produced from an instrumented binary
 
17
     into the pgd file for the second pass of profile-guided optimization
 
18
     with MSVC.  |basename| is the name of the DLL or EXE without the
 
19
     extension.  |pgddir| is the path that contains <basename>.pgd
 
20
     (should be the objdir it was built in).  |pgcdir| is the path
 
21
     containing basename!N.pgc files, which is probably dist/bin.
 
22
     Calls pgomgr to merge each pgc file into the pgd, then deletes
 
23
     the pgc files."""
 
24
  if not os.path.isdir(pgddir) or not os.path.isdir(pgcdir):
 
25
    return
 
26
  pgdfile = os.path.abspath(os.path.join(pgddir, basename + ".pgd"))
 
27
  if not os.path.isfile(pgdfile):
 
28
    return
 
29
  for file in os.listdir(pgcdir):
 
30
    if file.startswith(basename+"!") and file.endswith(".pgc"):
 
31
      try:
 
32
        pgcfile = os.path.normpath(os.path.join(pgcdir, file))
 
33
        subprocess.call(['pgomgr', '-merge',
 
34
                         pgcfile,
 
35
                         pgdfile])
 
36
        os.remove(pgcfile)
 
37
      except OSError:
 
38
        pass
 
39
 
 
40
if __name__ == '__main__':
 
41
  if len(sys.argv) != 3:
 
42
      print >>sys.stderr, "Usage: pgomerge.py <binary basename> <dist/bin>"
 
43
      sys.exit(1)
 
44
  MergePGOFiles(sys.argv[1], os.getcwd(), sys.argv[2])