Adds option to embed jre into dmg and enables it.

cusax-fix
Damian Minkov 13 years ago
parent 73e0e41cc5
commit bbb3a36624

@ -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/

@ -1014,7 +1014,7 @@
<delete failonerror="false" file="${macosx.resrc.dir}/logging.properties"/>
<delete failonerror="false" file="${macosx.resrc.dir}/felix.client.run.properties"/>
<symlink action="delete" failonerror="false"
link="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/libAEGetURLEventHandlerAgent.jnilib"/>
link="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/libAEGetURLEventHandlerAgent.dylib"/>
<symlink action="delete" failonerror="false"
link="${macosx.app.dir}/${application.name}.app/Contents/Frameworks/GrowlFramework/Growl.framework/Headers"/>
@ -1064,43 +1064,6 @@
trim="true"/>
</condition>
<!-- Prepare the logging.properties file for macosx -->
<copy file="${inst.resrc}/logging.properties"
tofile="${macosx.resrc.dir}/logging.properties"
overwrite="true"/>
<replace file="${macosx.resrc.dir}/logging.properties"
token="java.util.logging.FileHandler.pattern = %h/.sip-communicator/log"
value="java.util.logging.FileHandler.pattern = log"/>
<!-- Prepare the felix.client.run.properties file for macosx -->
<copy file="${lib}/felix.client.run.properties"
tofile="${macosx.resrc.dir}/felix.client.run.properties"
overwrite="true"/>
<!-- Prepare the jitsi-defaults.properties file for macosx -->
<copy file="${lib}/jitsi-defaults.properties"
tofile="${macosx.resrc.dir}/jitsi-defaults.properties"
overwrite="true"
failonerror="false"/>
<replace file="${macosx.resrc.dir}/felix.client.run.properties"
token="swingnotification.jar">
<replacevalue><![CDATA[swingnotification.jar reference\:file\:sc-bundles/growlnotification.jar]]></replacevalue>
</replace>
<!-- Remove the reference to the update bundle -->
<replace file="${macosx.resrc.dir}/felix.client.run.properties"
token="reference:file:sc-bundles/update.jar"
value=""/>
<!-- colons can be escaped after some modifications -->
<replace file="${macosx.resrc.dir}/felix.client.run.properties"
token="reference\:file\:sc-bundles/update.jar"
value=""/>
<replaceregexp file="${macosx.resrc.dir}/felix.client.run.properties"
match="^org.osgi.framework.storage=\$\{user.home\}/.sip-communicator/sip-communicator.bin"
replace="org.osgi.framework.storage=$\{user.home\}/Library/Application Support/${application.name}/sip-communicator.bin"
flags="m"/>
<!-- We copy macosx-specific bundles from
sc-bundles/os-specific/macosx to sc-bundles -->
<copy todir="${bundles.dest}">
@ -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 @@
<exclude name="${bundles.dest}/update.jar" />
<include name="resources/images/logo/sc_logo_128x128.icns" />
</jarfileset>
<javafilelist dir="${macosx.resrc.dir}"
<javafilelist dir="${inst.resrc}"
files="logging.properties"/>
<javafilelist dir="${macosx.resrc.dir}"
<javafilelist dir="${lib}"
files="felix.client.run.properties"/>
<javafilelist dir="${macosx.resrc.dir}"
<javafilelist dir="${lib}"
files="jitsi-defaults.properties"/>
</jarbundler>
<!-- -->
<replace file="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/felix.client.run.properties"
token="swingnotification.jar">
<replacevalue><![CDATA[swingnotification.jar reference\:file\:sc-bundles/growlnotification.jar]]></replacevalue>
</replace>
<!-- Remove the reference to the update bundle -->
<replace file="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/felix.client.run.properties"
token="reference:file:sc-bundles/update.jar"
value=""/>
<!-- colons can be escaped after some modifications -->
<replace file="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/felix.client.run.properties"
token="reference\:file\:sc-bundles/update.jar"
value=""/>
<replaceregexp file="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/felix.client.run.properties"
match="^org.osgi.framework.storage=\$\{user.home\}/.sip-communicator/sip-communicator.bin"
replace="org.osgi.framework.storage=$\{user.home\}/Library/Application Support/${application.name}/sip-communicator.bin"
flags="m"/>
<!-- Install the Growl Framework in the application package -->
<mkdir dir="${macosx.app.dir}/${application.name}.app/Contents/Frameworks"/>
<unzip src="${macosx.resrc.dir}/GrowlFramework.zip"
@ -1255,17 +1237,57 @@
<true/>
<key>CFBundleName</key>]]></replacevalue>
</replace>
<symlink resource="lib/native/mac/libAEGetURLEventHandlerAgent.jnilib"
link="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/libAEGetURLEventHandlerAgent.jnilib"/>
<symlink resource="lib/native/mac/libAEGetURLEventHandlerAgent.dylib"
link="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/libAEGetURLEventHandlerAgent.dylib"/>
<copy file="${macosx.resrc.dir}/libgrowl4j.dylib"
todir="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java/lib/native/mac/"/>
<antcall target="-macosx-include-jre"/>
<!-- Delete the tmp if it exists -->
<delete dir="${macosx.app.dir}/tmp"
quiet="yes" failonerror="false"/>
</target>
<!-- if folder for a macosx jdk is supplied we embed it in the distributed
dmg and provide info for it in Info.plist -->
<target name="-macosx-include-jre"
if="macosx.jre"
unless="macosx.embed.jre.disabled">
<basename property="jre.folder.name" file="${macosx.jre}"/>
<dirname property="jre.parent.folder" file="${macosx.jre}"/>
<mkdir dir="${macosx.app.dir}/${application.name}.app/Contents/PlugIns"/>
<copy todir="${macosx.app.dir}/${application.name}.app/Contents/PlugIns">
<fileset dir="${jre.parent.folder}">
<include name="${jre.folder.name}/Contents/Info.plist"/>
<include name="${jre.folder.name}/Contents/Home/jre/"/>
<exclude name="${jre.folder.name}/Contents/Home/bin/"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/bin/"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/deploy/"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/deploy.jar"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/javaws.jar"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/libdeploy.dylib"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/libnpjp2.dylib"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/plugin.jar"/>
<exclude name="${jre.folder.name}/Contents/Home/jre/lib/security/javaws.policy"/>
</fileset>
</copy>
<!-- and now the entry in Info.plist-->
<replace file="${macosx.app.dir}/${application.name}.app/Contents/Info.plist">
<replacetoken><![CDATA[<key>VMOptions</key>]]></replacetoken>
<replacevalue><![CDATA[<key>JVMRuntime</key>
<string>__jre.folder.name__</string>
<key>VMOptions</key>]]></replacevalue>
</replace>
<replace file="${macosx.app.dir}/${application.name}.app/Contents/Info.plist">
<replacefilter token="__jre.folder.name__" value="${jre.folder.name}"/>
</replace>
</target>
<!-- Create a MacOSX application package with Sparkle support.
Executed only if the sparkle label property is set, i.e. if the
package is built from CruiseControl -->

@ -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

@ -941,4 +941,37 @@
<arg value="${native_install_dir}/jmsoutlookaddrbookcomserver64.exe"/>
</exec>
</target>
<!-- compile launcher for Mac OS X (32-bit/64-bit) -->
<target name="macosx-launcher"
description="Build macosx launcher shared library for Mac OS X"
if="is.running.macos"
depends="init-native">
<cc name="gcc"
outfile="${src}/native/macosx/launcher/JavaApplicationStub"
objdir="${obj}">
<compilerarg value="-Wall" />
<compilerarg value="-O2" />
<compilerarg value="-arch" />
<compilerarg value="x86_64" />
<compilerarg value="-arch" />
<compilerarg value="i386" />
<compilerarg value="-I${system.JAVA_HOME}/include" />
<compilerarg value="-I${system.JAVA_HOME}/include/darwin" />
<compilerarg value="-mmacosx-version-min=10.6"/>
<linkerarg value="-arch" />
<linkerarg value="x86_64" />
<linkerarg value="-arch" />
<linkerarg value="i386" />
<linkerarg value="-framework" />
<linkerarg value="Cocoa" />
<fileset dir="${src}/native/macosx/launcher" includes="*.m"/>
</cc>
<delete dir="${obj}" failonerror="false" />
<delete file="${src}/native/macosx/launcher/history.xml" failonerror="false" />
</target>
</project>

@ -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 <jni.h>
#import <Cocoa/Cocoa.h>
#include <dlfcn.h>
#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);
}
Loading…
Cancel
Save