mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-21 15:08:52 -05:00
OSX: refactor OSX package based on universalJavaApplicationStub
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2329 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
22732ab3e3
commit
fda6e03d9e
72
build.xml
72
build.xml
@ -93,75 +93,33 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="dist-osx">
|
<target name="dist-osx">
|
||||||
<taskdef name="jarbundler"
|
<!-- move jar files to new location -->
|
||||||
classname="net.sourceforge.jarbundler.JarBundler">
|
<copy todir="dist/DavMail.app/Contents/Java">
|
||||||
<classpath location="lib/jarbundler-2.1.0.jar"/>
|
<fileset dir="dist">
|
||||||
</taskdef>
|
|
||||||
<jarbundler dir="dist"
|
|
||||||
shortname="DavMail"
|
|
||||||
name="DavMail"
|
|
||||||
mainclass="davmail.DavGateway"
|
|
||||||
build="${release}"
|
|
||||||
icon="src/osx/tray.icns"
|
|
||||||
infostring="DavMail Gateway ${release}"
|
|
||||||
jvmversion="1.5+"
|
|
||||||
version="${release}"
|
|
||||||
vmoptions="-Dsun.net.inetaddr.ttl=60 -Xmx512m"
|
|
||||||
workingdirectory="$APP_PACKAGE"
|
|
||||||
stubfile="src/osx/davmail">
|
|
||||||
<jarfileset dir="dist">
|
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</jarfileset>
|
</fileset>
|
||||||
<jarfileset dir="dist/lib">
|
<fileset dir="dist/lib">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
<include name="*.jnilib"/>
|
<include name="*.jnilib"/>
|
||||||
<exclude name="swt*.jar"/>
|
<exclude name="swt*.jar"/>
|
||||||
<exclude name="junit-*.jar"/>
|
<exclude name="junit-*.jar"/>
|
||||||
<exclude name="winrun4j-*.jar"/>
|
<exclude name="winrun4j-*.jar"/>
|
||||||
</jarfileset>
|
|
||||||
</jarbundler>
|
|
||||||
<!-- prepare hide from dock option -->
|
|
||||||
<replaceregexp file="dist/DavMail.app/Contents/Info.plist" match="<key>CFBundleName</key>"
|
|
||||||
replace="<key>LSUIElement</key><string>0</string><key>CFBundleName</key>"/>
|
|
||||||
<!-- Retina display support -->
|
|
||||||
<replaceregexp file="dist/DavMail.app/Contents/Info.plist" match="<key>CFBundleName</key>"
|
|
||||||
replace="<key>NSHighResolutionCapable</key><true/><key>CFBundleName</key>"/>
|
|
||||||
<zip file="dist/DavMail-MacOSX-${release-name}.app.zip" comment="In order to run DavMail on OSX Mountain Lion, you will need to disable Gatekeeper temporarily, see http://davmail.sourceforge.net/macosxsetup.html">
|
|
||||||
<zipfileset dir="dist">
|
|
||||||
<include name="DavMail.app/**/*"/>
|
|
||||||
<exclude name="DavMail.app/Contents/MacOS/davmail"/>
|
|
||||||
</zipfileset>
|
|
||||||
<zipfileset dir="dist" filemode="755">
|
|
||||||
<include name="DavMail.app/Contents/MacOS/davmail"/>
|
|
||||||
</zipfileset>
|
|
||||||
</zip>
|
|
||||||
<!--delete dir="dist/DavMail.app"/-->
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="dist-osx-java7" depends="dist-osx">
|
|
||||||
<!-- move jar files to new location -->
|
|
||||||
<move todir="dist/DavMail.app/Contents/Java">
|
|
||||||
<fileset dir="dist/DavMail.app/Contents/Resources/Java"/>
|
|
||||||
</move>
|
|
||||||
<!-- move libgrowl to library path -->
|
|
||||||
<move todir="dist/DavMail.app/Contents/MacOS">
|
|
||||||
<fileset file="dist/DavMail.app/Contents/Java/libgrowl.jnilib"/>
|
|
||||||
</move>
|
|
||||||
<!-- use Java7 app launcher -->
|
|
||||||
<copy file="src/osx-java7/JavaAppLauncher" tofile="dist/DavMail.app/Contents/MacOS/davmail" overwrite="true"/>
|
|
||||||
<!-- include Java7 labels -->
|
|
||||||
<copy todir="dist/DavMail.app/Contents/Resources">
|
|
||||||
<fileset dir="src/osx-java7">
|
|
||||||
<include name="en.lproj/**"/>
|
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
<!-- move libgrowl to library path -->
|
||||||
|
<copy todir="dist/DavMail.app/Contents/MacOS">
|
||||||
|
<fileset file="lib/libgrowl.jnilib"/>
|
||||||
|
</copy>
|
||||||
|
<copy file="src/osx/tray.icns" todir="dist/DavMail.app/Contents/Resources" overwrite="true"/>
|
||||||
|
<!-- use generic app launcher -->
|
||||||
|
<copy file="src/osx/davmail" todir="dist/DavMail.app/Contents/MacOS" overwrite="true"/>
|
||||||
<!-- template plist -->
|
<!-- template plist -->
|
||||||
<copy file="src/osx-java7/Info.plist" todir="dist/DavMail.app/Contents" overwrite="true">
|
<copy file="src/osx/Info.plist" todir="dist/DavMail.app/Contents" overwrite="true">
|
||||||
<filterchain>
|
<filterchain>
|
||||||
<expandproperties/>
|
<expandproperties/>
|
||||||
</filterchain>
|
</filterchain>
|
||||||
</copy>
|
</copy>
|
||||||
<zip file="dist/DavMail-MacOSX-Java7-${release-name}.app.zip" comment="In order to run DavMail on OSX Mountain Lion, you will need to disable Gatekeeper temporarily, see http://davmail.sourceforge.net/macosxsetup.html">
|
<zip file="dist/DavMail-MacOSX-${release-name}.app.zip" comment="In order to run DavMail on OSX Mountain Lion or later, you will need to disable Gatekeeper temporarily, see http://davmail.sourceforge.net/macosxsetup.html">
|
||||||
<zipfileset dir="dist">
|
<zipfileset dir="dist">
|
||||||
<include name="DavMail.app/**/*"/>
|
<include name="DavMail.app/**/*"/>
|
||||||
<exclude name="DavMail.app/Contents/MacOS/davmail"/>
|
<exclude name="DavMail.app/Contents/MacOS/davmail"/>
|
||||||
@ -424,7 +382,7 @@
|
|||||||
<antcall target="dist-nsis"/>
|
<antcall target="dist-nsis"/>
|
||||||
<antcall target="dist-deb"/>
|
<antcall target="dist-deb"/>
|
||||||
<!--antcall target="dist-rpm"/-->
|
<!--antcall target="dist-rpm"/-->
|
||||||
<antcall target="dist-osx-java7"/>
|
<antcall target="dist-osx"/>
|
||||||
<!-- source with binary deps package -->
|
<!-- source with binary deps package -->
|
||||||
<tar tarfile="dist/davmail-src-${release-name}.tgz" compression="gzip" longfile="gnu">
|
<tar tarfile="dist/davmail-src-${release-name}.tgz" compression="gzip" longfile="gnu">
|
||||||
<tarfileset prefix="davmail-src-${release-name}" dir=".">
|
<tarfileset prefix="davmail-src-${release-name}" dir=".">
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>LSUIElement</key><string>0</string>
|
|
||||||
<key>NSHighResolutionCapable</key>
|
|
||||||
<true/>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>DavMail</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${release}</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>DavMail Gateway ${release-name}</string>
|
|
||||||
<key>CFBundleAllowMixedLocalizations</key>
|
|
||||||
<string>false</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>davmail</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${release}</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>tray.icns</string>
|
|
||||||
<key>Java</key>
|
|
||||||
<dict>
|
|
||||||
<key>MainClass</key>
|
|
||||||
<string>davmail.DavGateway</string>
|
|
||||||
<key>JVMVersion</key>
|
|
||||||
<string>1.5+</string>
|
|
||||||
<key>ClassPath</key>
|
|
||||||
<array>
|
|
||||||
<string>$JAVAROOT/davmail.jar</string>
|
|
||||||
<string>$JAVAROOT/activation-1.1.1.jar</string>
|
|
||||||
<string>$JAVAROOT/appbundler-1.0.jar</string>
|
|
||||||
<string>$JAVAROOT/checkstyle-all-5.0.jar</string>
|
|
||||||
<string>$JAVAROOT/commons-codec-1.3.jar</string>
|
|
||||||
<string>$JAVAROOT/commons-collections-3.1.jar</string>
|
|
||||||
<string>$JAVAROOT/commons-httpclient-3.1.jar</string>
|
|
||||||
<string>$JAVAROOT/commons-logging-1.0.4.jar</string>
|
|
||||||
<string>$JAVAROOT/htmlcleaner-2.2.jar</string>
|
|
||||||
<string>$JAVAROOT/jackrabbit-webdav-2.4.3.jar</string>
|
|
||||||
<string>$JAVAROOT/jcharset-1.3.jar</string>
|
|
||||||
<string>$JAVAROOT/jcifs-1.3.14.jar</string>
|
|
||||||
<string>$JAVAROOT/jdom-1.0.jar</string>
|
|
||||||
<string>$JAVAROOT/libgrowl-0.2.jar</string>
|
|
||||||
<string>$JAVAROOT/libgrowl.jnilib</string>
|
|
||||||
<string>$JAVAROOT/log4j-1.2.16.jar</string>
|
|
||||||
<string>$JAVAROOT/mail-1.4.3.jar</string>
|
|
||||||
<string>$JAVAROOT/slf4j-api-1.3.1.jar</string>
|
|
||||||
<string>$JAVAROOT/slf4j-log4j12-1.3.1.jar</string>
|
|
||||||
<string>$JAVAROOT/stax-api-1.0.1.jar</string>
|
|
||||||
<string>$JAVAROOT/stax2-api-3.1.1.jar</string>
|
|
||||||
<string>$JAVAROOT/woodstox-core-asl-4.1.2.jar</string>
|
|
||||||
<string>$JAVAROOT/xercesImpl-2.8.1.jar</string>
|
|
||||||
</array>
|
|
||||||
<key>VMOptions</key>
|
|
||||||
<string>-Dsun.net.inetaddr.ttl=60 -Xmx512m</string>
|
|
||||||
<key>WorkingDirectory</key>
|
|
||||||
<string>$APP_PACKAGE</string>
|
|
||||||
</dict>
|
|
||||||
<key>JVMMainClassName</key>
|
|
||||||
<string>davmail.DavGateway</string>
|
|
||||||
<key>JVMOptions</key>
|
|
||||||
<array>
|
|
||||||
<string>-Dsun.net.inetaddr.ttl=60 -Xmx512m -Duser.dir=$APP_ROOT</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
"JRELoadError" = "Java 7 not available, please download and install from http://www.java.com";
|
|
||||||
"MainClassNameRequired" = "Main class name is required.";
|
|
||||||
"JavaDirectoryNotFound" = "Unable to enumerate Java directory contents.";
|
|
36
src/osx/Info.plist
Normal file
36
src/osx/Info.plist
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>LSUIElement</key><string>0</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>DavMail</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${release}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>DavMail Gateway ${release-name}</string>
|
||||||
|
<key>CFBundleAllowMixedLocalizations</key>
|
||||||
|
<string>false</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>davmail</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${release}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>tray.icns</string>
|
||||||
|
<key>JVMMainClassName</key>
|
||||||
|
<string>davmail.DavGateway</string>
|
||||||
|
<key>JVMOptions</key>
|
||||||
|
<array>
|
||||||
|
<string>-Dsun.net.inetaddr.ttl=60 -Xmx512m</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -183,7 +183,7 @@ else
|
|||||||
# set Working Directory and Java and Resources folder
|
# set Working Directory and Java and Resources folder
|
||||||
JavaFolder="${OracleJavaFolder}"
|
JavaFolder="${OracleJavaFolder}"
|
||||||
ResourcesFolder="${OracleResourcesFolder}"
|
ResourcesFolder="${OracleResourcesFolder}"
|
||||||
WorkingDirectory="${OracleJavaFolder}"
|
WorkingDirectory="${AppPackageFolder}"
|
||||||
|
|
||||||
APP_ROOT="${AppPackageFolder}"
|
APP_ROOT="${AppPackageFolder}"
|
||||||
|
|
||||||
@ -222,67 +222,41 @@ elif [ -x /usr/libexec/java_home ] && [ -d "`/usr/libexec/java_home 2> /dev/null
|
|||||||
JAVACMD="`/usr/libexec/java_home 2> /dev/null`/bin/java"
|
JAVACMD="`/usr/libexec/java_home 2> /dev/null`/bin/java"
|
||||||
|
|
||||||
# otherwise check Java standard symlink (old Apple Java)
|
# otherwise check Java standard symlink (old Apple Java)
|
||||||
elif [ -h /Library/Java/Home ]; then
|
elif [ -x /Library/Java/Home/bin/java ]; then
|
||||||
JAVACMD="/Library/Java/Home/bin/java"
|
JAVACMD="/Library/Java/Home/bin/java"
|
||||||
|
|
||||||
# fallback: public JRE plugin (Oracle Java)
|
# fallback: public JRE plugin (Oracle Java)
|
||||||
else
|
elif [ -x "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" ]; then
|
||||||
JAVACMD="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
|
JAVACMD="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
|
||||||
fi
|
else
|
||||||
|
|
||||||
# fallback fallback: /usr/bin/java
|
# fallback fallback: /usr/bin/java
|
||||||
# but this would prompt to install deprecated Apple Java 6
|
JAVACMD="/usr/bin/java"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# execute JAVA commandline and do some pre-checks
|
# execute JAVA commandline
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
# display error message if MainClassName is empty
|
|
||||||
if [ -z ${JVMMainClass} ]; then
|
|
||||||
# display error message with applescript
|
|
||||||
osascript -e "tell application \"System Events\" to display dialog \"ERROR launching '${CFBundleName}'!\n\n'MainClass' isn't specified!\nJava application cannot be started!\" with title \"${CFBundleName}\" buttons {\" OK \"} default button 1 with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)"
|
|
||||||
# exit with error
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
|
# enable drag&drop to the dock icon
|
||||||
|
export CFProcessPath="$0"
|
||||||
|
|
||||||
# check whether $JAVACMD is a file and executable
|
# change to Working Directory based upon Apple/Oracle Plist info
|
||||||
elif [ -f "$JAVACMD" ] && [ -x "$JAVACMD" ] ; then
|
cd "${WorkingDirectory}"
|
||||||
|
|
||||||
# enable drag&drop to the dock icon
|
# execute Java and set
|
||||||
export CFProcessPath="$0"
|
# - classpath
|
||||||
|
# - dock icon
|
||||||
# change to Working Directory based upon Apple/Oracle Plist info
|
# - application name
|
||||||
cd "${WorkingDirectory}"
|
# - JVM options
|
||||||
|
# - JVM default options
|
||||||
# execute Java and set
|
# - main class
|
||||||
# - classpath
|
# - JVM arguments
|
||||||
# - dock icon
|
exec "$JAVACMD" \
|
||||||
# - application name
|
-cp "${JVMClassPath}" \
|
||||||
# - JVM options
|
-Xdock:icon="${ResourcesFolder}/${CFBundleIconFile}" \
|
||||||
# - JVM default options
|
-Xdock:name="${CFBundleName}" \
|
||||||
# - main class
|
${JVMOptions:+$JVMOptions }\
|
||||||
# - JVM arguments
|
${JVMDefaultOptions:+$JVMDefaultOptions }\
|
||||||
exec "$JAVACMD" \
|
${JVMMainClass}\
|
||||||
-cp "${JVMClassPath}" \
|
${JVMArguments:+ $JVMArguments}
|
||||||
-Xdock:icon="${ResourcesFolder}/${CFBundleIconFile}" \
|
|
||||||
-Xdock:name="${CFBundleName}" \
|
|
||||||
${JVMOptions:+$JVMOptions }\
|
|
||||||
${JVMDefaultOptions:+$JVMDefaultOptions }\
|
|
||||||
${JVMMainClass}\
|
|
||||||
${JVMArguments:+ $JVMArguments}
|
|
||||||
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# display error message with applescript
|
|
||||||
osascript -e "tell application \"System Events\" to display dialog \"ERROR launching '${CFBundleName}'!\n\nYou need to have JAVA installed on your Mac!\nVisit http://java.com for more information...\" with title \"${CFBundleName}\" buttons {\" OK \"} default button 1 with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)"
|
|
||||||
|
|
||||||
# and open java.com
|
|
||||||
open http://java.com
|
|
||||||
|
|
||||||
# exit with error
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user