зеркало из https://github.com/mozilla/pjs.git
Land prebinding hack for mac os 10.3 on the trunk (bug 246283, r=pinkerton). This is filed as Apple Radar bug 3704775.
This commit is contained in:
Родитель
18dfc2cc67
Коммит
8028ebc698
|
@ -42,6 +42,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void UpdatePrebinding();
|
||||
void LaunchChildMac(int aArgc, char** aArgv);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -39,6 +39,62 @@
|
|||
#include "MacLaunchHelper.h"
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
@interface TaskMonitor : NSObject
|
||||
-(void)prebindFinished:(NSNotification *)aNotification;
|
||||
@end
|
||||
|
||||
@implementation TaskMonitor
|
||||
-(void)prebindFinished:(NSNotification *)aNotification
|
||||
{
|
||||
/* Delete the task and the TaskMonitor */
|
||||
[[aNotification object] release];
|
||||
[self release];
|
||||
}
|
||||
@end
|
||||
|
||||
void
|
||||
UpdatePrebinding()
|
||||
{
|
||||
#ifdef _BUILD_STATIC_BIN
|
||||
struct utsname u;
|
||||
uname(&u);
|
||||
|
||||
// We run the redo-prebinding script in these cases:
|
||||
// 10.1.x (5.x): No auto-update of prebinding exists
|
||||
// 10.3.x (7.x): Auto-update of prebinding fails to complete successfully
|
||||
// (for no apparent reason)
|
||||
if (u.release[0] != '5' && u.release[0] != '7')
|
||||
return;
|
||||
|
||||
if (!_dyld_launched_prebound()) {
|
||||
NSTask *task;
|
||||
NSArray *args;
|
||||
TaskMonitor *monitor;
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSLog(@"Not prebound, launching update script");
|
||||
task = [[NSTask alloc] init];
|
||||
args = [NSArray arrayWithObject: @"redo-prebinding.sh"];
|
||||
|
||||
[task setCurrentDirectoryPath:[[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent]];
|
||||
[task setLaunchPath:@"/bin/sh"];
|
||||
[task setArguments:args];
|
||||
|
||||
monitor = [[TaskMonitor alloc] init];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:monitor
|
||||
selector:@selector(prebindFinished:)
|
||||
name:NSTaskDidTerminateNotification
|
||||
object:nil];
|
||||
|
||||
[task launch];
|
||||
[pool release];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LaunchChildMac(int aArgc, char** aArgv)
|
||||
{
|
||||
|
|
|
@ -156,3 +156,10 @@ ifeq ($(OS_ARCH),WINNT)
|
|||
else
|
||||
$(INSTALL) $^ .
|
||||
endif
|
||||
|
||||
ifdef USE_PREBINDING
|
||||
libs::
|
||||
$(INSTALL) $(srcdir)/redo-prebinding.sh $(DIST)/bin
|
||||
install::
|
||||
$(SYSINSTALL) $(IFLAGS1) $(DESTDIR)$(bindir)
|
||||
endif
|
||||
|
|
|
@ -1963,6 +1963,13 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
em->Start(componentsListChanged, &needsRestart);
|
||||
|
||||
if (noRestart || (!upgraded && !needsRestart)) {
|
||||
// Kick off the prebinding update now that we know we won't be
|
||||
// relaunching.
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
UpdatePrebinding();
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsICmdLineService> cmdLineArgs
|
||||
(do_GetService("@mozilla.org/appshell/commandLineService;1"));
|
||||
NS_ENSURE_TRUE(cmdLineArgs, 1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче