diff --git a/lib/native/mac/libAEGetURLEventHandlerAgent.jnilib b/lib/native/mac/libAEGetURLEventHandlerAgent.dylib similarity index 100% rename from lib/native/mac/libAEGetURLEventHandlerAgent.jnilib rename to lib/native/mac/libAEGetURLEventHandlerAgent.dylib diff --git a/resources/install/ant-build-config.properties b/resources/install/ant-build-config.properties index be346875d..7ffe89ec5 100644 --- a/resources/install/ant-build-config.properties +++ b/resources/install/ant-build-config.properties @@ -11,10 +11,8 @@ wix.upgrade.code=F9F09BE0-BA75-4C0D-8D64-E434D78548D4 #sign.cert.file= #sign.cert.password= application.home.dirname=.jitsi -link.download.windows=https\://download.jitsi.org/jitsi/windows/${package.name}-${sip-communicator.version}.exe link.download.windows32=https\://download.jitsi.org/jitsi/windows/${package.name}-${sip-communicator.version}-x86.exe link.download.windows64=https\://download.jitsi.org/jitsi/windows/${package.name}-${sip-communicator.version}-x64.exe -link.download.debian=https\://download.jitsi.org/jitsi/debian/${package.name}_${sip-communicator.version}_i386.deb link.download.generic=https\://download.jitsi.org/jitsi/generic/${package.name}-${sip-communicator.version}.jar link.download.linux=https\://download.jitsi.org/jitsi/linux/${package.name}-${sip-communicator.version}-linux.bin link.updates.macosx=https\://download.jitsi.org/jitsi/macosx/sparkle/updates.xml @@ -22,7 +20,7 @@ link.updates.macosx=https\://download.jitsi.org/jitsi/macosx/sparkle/updates.xml #link.sparkle.updates.index=http://download.jitsi.org/jitsi/macosx/sparkle/index.html link.update.changelog.prefix=http://bluejimp.com/jitsi/changelogs # The private_key file (sparkle_dsa_priv.pem) -#sparkle.signiture.location=/Users/damencho/dev/sparkle-files/dsa_sign/sparkle_dsa_priv.pem -#delta.history.location=/Users/damencho/dev/build-history +#sparkle.signiture.location=/path/to/key.pem +#delta.history.location=/path/to/folder #delta.history.size=10 #sparkle.delta.download.location=http\://download.jitsi.org/jitsi/macosx/ diff --git a/resources/install/build.xml b/resources/install/build.xml index 83b3c5c2c..fb37c9f5e 100644 --- a/resources/install/build.xml +++ b/resources/install/build.xml @@ -1014,7 +1014,7 @@ + link="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/libAEGetURLEventHandlerAgent.dylib"/> @@ -1064,43 +1064,6 @@ trim="true"/> - - - - - - - - - - - - - - - - - - - - @@ -1150,7 +1113,7 @@ signature="sipc" mainclass="net.java.sip.communicator.launcher.SIPCommunicator" icon="resources/images/logo/sc_logo_128x128.icns" - jvmversion="1.5+" + jvmversion="1.6+" version="${sip-communicator.version}" build="${sparkle.build}" infostring="${application.name}" @@ -1193,14 +1156,33 @@ - - - + + + + + + + + + + + CFBundleName]]> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VMOptions]]> + JVMRuntime + __jre.folder.name__ + VMOptions]]> + + + + + + diff --git a/resources/install/installers.properties b/resources/install/installers.properties index de122d67f..132c281dc 100644 --- a/resources/install/installers.properties +++ b/resources/install/installers.properties @@ -15,3 +15,5 @@ windows.jre64.file=C:\\Install\\jre-7u17-windows-x64.exe # as part of the respective setups of SIP Communicator. windows.jre.zip=C:\\Install\\jre-7u45-windows-i586.zip windows.jre64.zip=C:\\Install\\jre-7u45-windows-x64.zip + +macosx.jre=${user.home}/bin/jdk1.7.0_45.jdk diff --git a/resources/install/macosx/JavaApplicationStub b/resources/install/macosx/JavaApplicationStub index a744bf93d..c28cd5e7c 100755 Binary files a/resources/install/macosx/JavaApplicationStub and b/resources/install/macosx/JavaApplicationStub differ diff --git a/src/native/build.xml b/src/native/build.xml index 8943f7c9a..23cbfcfd5 100644 --- a/src/native/build.xml +++ b/src/native/build.xml @@ -941,4 +941,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/native/macosx/launcher/launcher.m b/src/native/macosx/launcher/launcher.m new file mode 100644 index 000000000..b0d106bef --- /dev/null +++ b/src/native/macosx/launcher/launcher.m @@ -0,0 +1,235 @@ +/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + +#include +#import +#include + +#define JVM_JAVA_KEY "Java" +#define JVM_WORKING_DIR_KEY "WorkingDirectory" +#define JVM_RUNTIME_KEY "JVMRuntime" +#define JVM_MAIN_CLASS_NAME_KEY "MainClass" +#define JVM_CLASSPATH_KEY "ClassPath" +#define JVM_OPTIONS_KEY "VMOptions" +#define JVM_PROPERTIES_KEY "Properties" + +#define LAUNCH_ERROR "LaunchError" + +#define APP_PACKAGE_PREFIX "$APP_PACKAGE" +#define JAVA_ROOT_PREFIX "$JAVAROOT" + +#define LIBJLI_DYLIB "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib" + +typedef int (JNICALL *JLI_Launch_t)(int argc, char ** argv, + int jargc, const char** jargv, + int appclassc, const char** appclassv, + const char* fullversion, + const char* dotversion, + const char* pname, + const char* lname, + jboolean javaargs, + jboolean cpwildcard, + jboolean javaw, + jint ergo); + +void launchJitsi(int, char **); + +static int argsSupplied = 0; +// saving the original count of app arguments on the first main call +static int jargc; + +int main(int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + // on the first call save the arguments count, main will be called several + // times while starting some threads and initializing jvm + if(argsSupplied == 0) + { + jargc = argc - 1; + } + + @try + { + launchJitsi(argc, argv); + return 0; + } @catch (NSException *exception) + { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setMessageText:[exception reason]]; + [alert runModal]; + + return 1; + } @finally + { + [pool drain]; + } +} + +void launchJitsi(int argMainCount, char *argMainValues[]) +{ + NSBundle *mainBundle = [NSBundle mainBundle]; + + NSDictionary *infoDictionary = [mainBundle infoDictionary]; + + // The java options + NSDictionary *javaDictionary = [infoDictionary objectForKey:@JVM_JAVA_KEY]; + + // Get the working directory options + NSString *workingDirectory = + [[javaDictionary objectForKey:@JVM_WORKING_DIR_KEY] + stringByReplacingOccurrencesOfString:@APP_PACKAGE_PREFIX + withString:[mainBundle bundlePath]]; + if (workingDirectory == nil) + { + [[NSException exceptionWithName:@LAUNCH_ERROR + reason:@"Working directory not set" + userInfo:nil] raise]; + } + else + { + chdir([workingDirectory UTF8String]); + } + + // Locate the JLI_Launch() function + NSString *runtime = [javaDictionary objectForKey:@JVM_RUNTIME_KEY]; + + const char *libjliPath = NULL; + if (runtime != nil) + { + NSString *runtimePath = + [[[NSBundle mainBundle] builtInPlugInsPath] + stringByAppendingPathComponent:runtime]; + libjliPath = + [[runtimePath stringByAppendingPathComponent:@"Contents/Home/jre/lib/jli/libjli.dylib"] + fileSystemRepresentation]; + } else { + libjliPath = LIBJLI_DYLIB; + } + + void *libJLI = dlopen(libjliPath, RTLD_LAZY); + + // if jre folder is deleted + if(libJLI == NULL) + { + libJLI = dlopen(LIBJLI_DYLIB, RTLD_LAZY); + } + + JLI_Launch_t jli_LaunchFxnPtr = NULL; + if (libJLI != NULL) + { + jli_LaunchFxnPtr = dlsym(libJLI, "JLI_Launch"); + } + + if (jli_LaunchFxnPtr == NULL) + { + [[NSException exceptionWithName:@LAUNCH_ERROR + reason:@"JRE load error" + userInfo:nil] raise]; + } + + NSString *mainClassName = + [javaDictionary objectForKey:@JVM_MAIN_CLASS_NAME_KEY]; + if (mainClassName == nil) + { + [[NSException exceptionWithName:@LAUNCH_ERROR + reason:@"Missing main class name" + userInfo:nil] raise]; + } + + NSMutableString *classPath = + [NSMutableString stringWithFormat:@"-Djava.class.path=%@", workingDirectory]; + + NSArray *jvmcp = [javaDictionary objectForKey:@JVM_CLASSPATH_KEY]; + if (jvmcp == nil) + { + [[NSException exceptionWithName:@LAUNCH_ERROR + reason:@"Missing class path entry" + userInfo:nil] raise]; + } + else + { + for (NSString *cpe in jvmcp) + { + [classPath appendFormat:@":%@", + [cpe stringByReplacingOccurrencesOfString:@JAVA_ROOT_PREFIX + withString:workingDirectory]]; + } + } + + // Get the VM options + NSString *options = [javaDictionary objectForKey:@JVM_OPTIONS_KEY]; + + // Get the system properties + NSDictionary *sprops = [javaDictionary objectForKey:@JVM_PROPERTIES_KEY]; + + // application arguments to be added, add them on first and second call + // of the main, the first one starts the second one in new thread + // no further calls + int appArgc = 0; + if(argsSupplied < 2 && jargc > 0) + appArgc = jargc; + + // Initialize the arguments to JLI_Launch() + int argc = 2 + [sprops count] + 1 + appArgc; + if(options != nil) + argc++; + + char *argv[argc + appArgc]; + + int i = 0; + argv[i++] = argMainValues[0]; + argv[i++] = strdup([classPath UTF8String]); + + if(options != nil) + { + NSString *op = + [options stringByReplacingOccurrencesOfString:@JAVA_ROOT_PREFIX + withString:workingDirectory]; + op = [op stringByTrimmingCharactersInSet: + [NSCharacterSet whitespaceAndNewlineCharacterSet]]; + argv[i++] = strdup([op UTF8String]); + } + + for( NSString *sPropKey in sprops ) + { + NSString *sPropValue = [sprops objectForKey:sPropKey]; + sPropValue = [sPropValue stringByTrimmingCharactersInSet: + [NSCharacterSet whitespaceAndNewlineCharacterSet]]; + argv[i++] = strdup( + [[NSMutableString stringWithFormat:@"-D%@=%@", sPropKey, + [sPropValue stringByReplacingOccurrencesOfString:@JAVA_ROOT_PREFIX + withString:workingDirectory]] + UTF8String]); + } + + argv[i++] = strdup([mainClassName UTF8String]); + + // copy the application parameters, the number we have saved + // the params are last in the array of arguments + for(int j = appArgc; j > 0; j--) + { + argv[i++] = strdup(argMainValues[argMainCount-j]); + } + argsSupplied++; + + NSString *pname = [infoDictionary objectForKey:@"CFBundleName"]; + + // Invoke JLI_Launch() + jli_LaunchFxnPtr(argc, argv, + 0, NULL, + 0, NULL, + "", + "", + [pname UTF8String], + [pname UTF8String], + FALSE, + FALSE, + FALSE, + 0); +}