diff options
| -rwxr-xr-x | indra/newview/viewer_manifest.py | 90 | 
1 files changed, 52 insertions, 38 deletions
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 8f2d04e9b8..4d6df04156 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1005,34 +1005,7 @@ open "%s" --args "$@"                  # -------------------- nested viewer_app ---------------------                  with self.prefix(dst=os.path.join(viewer_app, "Contents")): -                    # Info.plist is just like top-level one... -                    Info = plistlib.readPlist(Info_plist) -                    # except for these replacements: -                    # (CFBundleExecutable may be moot: SL_Launcher directly -                    # runs the executable, instead of launching the app) -                    Info["CFBundleExecutable"] = "Second Life" -                    Info["CFBundleIconFile"] = viewer_icon -                    try: -                        # https://www.bugsplat.com/docs/platforms/os-x#configuration -                        Info["BugsplatServerURL"] = \ -                            "https://{BUGSPLAT_DB}.bugsplatsoftware.com/".format(**os.environ) -                    except KeyError: -                        # skip the assignment if there's no BUGSPLAT_DB variable -                        pass -                    self.put_in_file( -                        plistlib.writePlistToString(Info), -                        os.path.basename(Info_plist), -                        "Info.plist") - -                    with self.prefix(src="", dst="Frameworks"): -                        # CEF framework goes inside viewer_app/Contents/Frameworks. -                        CEF_framework = "Chromium Embedded Framework.framework" -                        self.path2basename(relpkgdir, CEF_framework) -                        # Remember where we parked this car. -                        CEF_framework = self.dst_path_of(CEF_framework) - -                        self.path2basename(relpkgdir, "BugsplatMac.framework") - +                    # defer Info.plist until after MacOS                      with self.prefix(dst="MacOS"):                          # CMake constructs the Second Life executable in the                          # MacOS directory belonging to the top-level Second @@ -1040,25 +1013,39 @@ open "%s" --args "$@"                          here = self.get_dst_prefix()                          relbase = os.path.realpath(os.path.dirname(Info_plist))                          self.cmakedirs(here) -                        for f in os.listdir(toplevel_MacOS): -                            if f == os.path.basename(trampoline): -                                # don't move the trampoline script we just made! -                                continue +                        # don't move the trampoline script we just made! +                        executables = [f for f in os.listdir(toplevel_MacOS) +                                       if f != os.path.basename(trampoline)] +                        if not executables: +                            raise ManifestError("Couldn't find viewer executable in {}!" +                                                .format(toplevel_MacOS)) +                        for f in executables:                              fromwhere = os.path.join(toplevel_MacOS, f) -                            towhere   = os.path.join(here, f) +                            towhere   = self.dst_path_of(f)                              print "Moving %s => %s" % \                                    (self.relpath(fromwhere, relbase),                                     self.relpath(towhere, relbase))                              # now do it, only without relativizing paths                              os.rename(fromwhere, towhere) +                        # Pick the biggest of the executables as the real viewer. +                        # Make (size, filename) pairs; sort by size; pick the +                        # last pair; take the filename entry from that. +                        SecondLife = sorted((os.path.getsize(self.dst_path_of(f)), f) +                                            for f in executables)[-1][1] +                        # now rename it to match the channel name +                        exename = self.channel() +                        exepath = self.dst_path_of(exename) +                        print "{} => {}".format(SecondLife, exename) +                        os.rename(self.dst_path_of(SecondLife), exepath) +                          if ("package" in self.args['actions'] or                               "unpacked" in self.args['actions']):                              # only if we're engaging BugSplat                              if "BUGSPLAT_DB" in os.environ:                                  # Create a symbol archive BEFORE stripping the                                  # binary. -                                self.run_command(['dsymutil', os.path.join(here, 'Second Life')]) +                                self.run_command(['dsymutil', exepath])                                  # This should produce a Second Life.dSYM bundle directory.                                  try:                                      # Now pretend we're Xcode making a .xcarchive file. @@ -1072,7 +1059,7 @@ open "%s" --args "$@"                                      # separate files at build time, and if so                                      # they're in a supported format."                                      xcarchive = os.path.join(parentdir, -                                                             'Second Life.xcarchive.zip') +                                                             exename + '.xcarchive.zip')                                      with zipfile.ZipFile(xcarchive, 'w',                                                           compression=zipfile.ZIP_DEFLATED) as zf:                                          print "Creating {}".format(xcarchive) @@ -1085,7 +1072,7 @@ open "%s" --args "$@"                                  finally:                                      # Whether or not we were able to create the                                      # .xcarchive file, clean up the .dSYM bundle -                                    shutil.rmtree(os.path.join(here, 'Second Life.dSYM')) +                                    shutil.rmtree(self.dst_path_of(exename + '.dSYM'))                              # NOTE: the -S argument to strip causes it to keep                              # enough info for annotated backtraces (i.e. function @@ -1093,8 +1080,35 @@ open "%s" --args "$@"                              # yields a slightly smaller binary but makes crash                              # logs mostly useless. This may be desirable for the                              # final release. Or not. -                            self.run_command( -                                ['strip', '-S', self.dst_path_of('Second Life')]) +                            self.run_command(['strip', '-S', exepath]) + +                    # Info.plist is just like top-level one... +                    Info = plistlib.readPlist(Info_plist) +                    # except for these replacements: +                    # (CFBundleExecutable may be moot: SL_Launcher directly +                    # runs the executable, instead of launching the app) +                    Info["CFBundleExecutable"] = exename +                    Info["CFBundleIconFile"] = viewer_icon +                    try: +                        # https://www.bugsplat.com/docs/platforms/os-x#configuration +                        Info["BugsplatServerURL"] = \ +                            "https://{BUGSPLAT_DB}.bugsplatsoftware.com/".format(**os.environ) +                    except KeyError: +                        # skip the assignment if there's no BUGSPLAT_DB variable +                        pass +                    self.put_in_file( +                        plistlib.writePlistToString(Info), +                        os.path.basename(Info_plist), +                        "Info.plist") + +                    with self.prefix(src="", dst="Frameworks"): +                        # CEF framework goes inside viewer_app/Contents/Frameworks. +                        CEF_framework = "Chromium Embedded Framework.framework" +                        self.path2basename(relpkgdir, CEF_framework) +                        # Remember where we parked this car. +                        CEF_framework = self.dst_path_of(CEF_framework) + +                        self.path2basename(relpkgdir, "BugsplatMac.framework")                      with self.prefix(dst="Resources"):                          # defer cross-platform file copies until we're in the right  | 
