Skip to content

Commit

Permalink
Embed JRE in Mac TurboVNC Viewer app
Browse files Browse the repository at this point in the history
Refer to #59
  • Loading branch information
dcommander committed Oct 11, 2018
1 parent fdf3078 commit 93315d5
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 61 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ matrix:
services:
- docker
- os: osx
env: BUILD_OFFICIAL=1
env:
- BUILD_OFFICIAL=1
- JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
osx_image: xcode7.3
- os: linux
dist: trusty
Expand Down Expand Up @@ -61,7 +63,8 @@ before_install:
popd;
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew update &&
brew install md5sha1sum &&
brew bundle &&
export PATH=/Applications/CMake.app/Contents/bin:$PATH &&
ln -fs /usr/local/bin/gpg1 /usr/local/bin/gpg;
fi &&
git clone --depth=1 https://github.com/turbovnc/buildscripts.git -b $TRAVIS_BRANCH ~/src/buildscripts &&
Expand Down
12 changes: 9 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ Build Requirements

- Xcode 4.1 or later (OS X 10.7.x or later SDK required)

- JDK 8 or later
- JDK 8 or OpenJDK 1.8 or later
* Download the
[Oracle Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads)
or [OpenJDK](https://jdk.java.net)
* [OpenJDK](https://jdk.java.net) 11 or later must be used if building
a Mac package/disk image
* If using JDK 11 or later, CMake 3.10.x or later must also be used


Expand Down Expand Up @@ -294,8 +297,11 @@ Mac

Create Mac package/disk image. This requires pkgbuild and productbuild, which
are installed by default on OS X 10.7 and later. This command generates a
package containing a Java app bundle that relies on Oracle Java. The DMG built
with this command can be installed on OS X 10.7 and later.
package containing a standalone TurboVNC Viewer app bundle with a custom JRE
based on OpenJDK. The DMG built with this command can be installed on OS X
10.7 and later, but it requires OS X 10.9 or later in order to run. OpenJDK
must be used in order to avoid legal restrictions regarding the redistribution
of Oracle JDK components.


Windows
Expand Down
3 changes: 3 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
brew 'md5sha1sum'
cask 'adoptopenjdk'
cask 'cmake'
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ VNC servers, applying a different set of options for each. This is
accomplished by separating the command-line arguments for each VNC server
with `--`.

4. The standalone Mac TurboVNC Viewer app now contains a custom Java Runtime
Environment (JRE), based on OpenJDK 11, so it is no longer necessary to install
a separate JRE or JDK package in order to use the Mac TurboVNC Viewer. As a
result, `make dmg` now requires OpenJDK 11 or later. An external JRE can still
be used at run time by setting the `JAVA_HOME` environment variable.


2.2.1
=====
Expand Down
43 changes: 27 additions & 16 deletions cmakescripts/BuildPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,33 @@ endif() # WIN32

if(APPLE AND TVNC_BUILDJAVA AND TVNC_BUILDNATIVE)

string(REGEX REPLACE "/" ":" CMAKE_INSTALL_MACPREFIX ${CMAKE_INSTALL_PREFIX})
string(REGEX REPLACE "^:" "" CMAKE_INSTALL_MACPREFIX
${CMAKE_INSTALL_MACPREFIX})

configure_file(release/makemacpkg.in pkgscripts/makemacpkg @ONLY)
configure_file(release/makemacapp.in pkgscripts/makemacapp)
configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
configure_file(release/Info.plist.in pkgscripts/Info.plist)
configure_file(release/Package.plist.in pkgscripts/Package.plist)
configure_file(release/uninstall.in pkgscripts/uninstall)
configure_file(release/uninstall.applescript.in pkgscripts/uninstall.applescript)

add_custom_target(dmg sh pkgscripts/makemacpkg
SOURCES pkgscripts/makemacpkg)
add_custom_target(compatdmg sh pkgscripts/makemacpkg compat
SOURCES pkgscripts/makemacpkg)
find_package(Java)

if(Java_VERSION VERSION_LESS 11)

message(WARNING "JDK 11 or later required in order to build Mac package/disk image")

else()

string(REGEX REPLACE "/" ":" CMAKE_INSTALL_MACPREFIX ${CMAKE_INSTALL_PREFIX})
string(REGEX REPLACE "^:" "" CMAKE_INSTALL_MACPREFIX
${CMAKE_INSTALL_MACPREFIX})

configure_file(release/makemacpkg.in pkgscripts/makemacpkg @ONLY)
configure_file(release/makemacapp.in pkgscripts/makemacapp)
configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
configure_file(release/Info.plist.in pkgscripts/Info.plist)
configure_file(release/Package.plist.in pkgscripts/Package.plist)
configure_file(release/uninstall.in pkgscripts/uninstall)
configure_file(release/uninstall.applescript.in
pkgscripts/uninstall.applescript)

add_custom_target(dmg sh pkgscripts/makemacpkg
SOURCES pkgscripts/makemacpkg)
add_custom_target(compatdmg sh pkgscripts/makemacpkg compat
SOURCES pkgscripts/makemacpkg)

endif()

endif() # APPLE

Expand Down
59 changes: 26 additions & 33 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="language" content="en">
<meta name="date" content="2018-07-30T11:55:03">
<meta name="date" content="2018-10-08T20:25:49">
<meta name="generator" content="deplate.rb 0.8.5">
<title>User&rsquo;s Guide for TurboVNC 2.3</title>
<link rel="start" href="index.html" title="Frontpage">
Expand Down Expand Up @@ -467,11 +467,7 @@ <h2 id="hd004002">4.2&nbsp;Mac/x86</h2>
</tr>
<tr class="standard">
<td class="high standard">O/S</td>
<td class="standard">OS X 10.7 &ldquo;Lion&rdquo; or later</td>
</tr>
<tr class="standard">
<td class="high standard">Other Software</td>
<td class="standard"><span class="remote"><a href="http://www.java.com" class="remote">Oracle Java</a></span><a name="idx0016"></a> 8u40 or later</td>
<td class="standard">OS X 10.9 &ldquo;Mavericks&rdquo; or later</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -539,22 +535,22 @@ <h3 id="hd005001002">Installing TurboVNC</h3>
Download the appropriate TurboVNC binary package for your system from
the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files/" class="remote">Files
area</a></span><a name="idx0017"></a> of the
area</a></span><a name="idx0016"></a> of the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc" class="remote">TurboVNC
SourceForge project page</a></span><a name="idx0018"></a>. Packages are
SourceForge project page</a></span><a name="idx0017"></a>. Packages are
provided for RPM-based and Debian-based Linux distributions that contain
GLIBC 2.5 or later (including
<span class="remote"><a href="http://fedoraproject.org" class="remote">Fedora</a></span><a name="idx0019"></a>
<span class="remote"><a href="http://fedoraproject.org" class="remote">Fedora</a></span><a name="idx0018"></a>
6 or later,
<span class="remote"><a href="http://www.redhat.com/products/enterprise-linux" class="remote">Red
Hat Enterprise
Linux</a></span><a name="idx0020"></a>/<span class="remote"><a href="http://www.centos.org/" class="remote">CentOS</a></span><a name="idx0021"></a>
Linux</a></span><a name="idx0019"></a>/<span class="remote"><a href="http://www.centos.org/" class="remote">CentOS</a></span><a name="idx0020"></a>
5 or later,
<span class="remote"><a href="http://www.suse.com" class="remote">SuSE</a></span><a name="idx0022"></a>
<span class="remote"><a href="http://www.suse.com" class="remote">SuSE</a></span><a name="idx0021"></a>
Linux
Enterprise/<span class="remote"><a href="http://www.opensuse.org" class="remote">openSUSE</a></span><a name="idx0023"></a>
Enterprise/<span class="remote"><a href="http://www.opensuse.org" class="remote">openSUSE</a></span><a name="idx0022"></a>
11 or later, and
<span class="remote"><a href="http://www.ubuntu.com" class="remote">Ubuntu</a></span><a name="idx0024"></a>
<span class="remote"><a href="http://www.ubuntu.com" class="remote">Ubuntu</a></span><a name="idx0023"></a>
8.04 or later.) <br />
</li>
<li class="Ordered-1 Ordered" value="2">
Expand Down Expand Up @@ -619,12 +615,9 @@ <h2 id="hd005002">5.2&nbsp;Installing the TurboVNC Viewer on OS X</h2>
(<code>TurboVNC-</code><em><code>{version}</code></em><code>.dmg</code>)
from the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files/" class="remote">Files
area</a></span><a name="idx0025"></a> of the
area</a></span><a name="idx0024"></a> of the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc" class="remote">TurboVNC
SourceForge project page</a></span><a name="idx0026"></a>.
<div class="important"><p class="important">
This package requires <span class="remote"><a href="http://www.java.com" class="remote">Oracle Java</a></span><a name="idx0027"></a>.
</p></div>
SourceForge project page</a></span><a name="idx0025"></a>.
</li>
<li class="Ordered-1 Ordered">
Open the disk image, then open <code>TurboVNC.pkg</code> inside the disk
Expand All @@ -644,9 +637,9 @@ <h2 id="hd005003">5.3&nbsp;Installing the TurboVNC Viewer on Windows</h2>
<code>TurboVNC64-</code><em><code>{version}</code></em><code>.exe</code>
for 64-bit systems) from the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files/" class="remote">Files
area</a></span><a name="idx0028"></a> of the
area</a></span><a name="idx0026"></a> of the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc" class="remote">TurboVNC
SourceForge project page</a></span><a name="idx0029"></a>.
SourceForge project page</a></span><a name="idx0027"></a>.
</li>
<li class="Ordered-1 Ordered">
Run the TurboVNC installer. The installation of TurboVNC should be
Expand All @@ -665,9 +658,9 @@ <h2 id="hd005004">5.4&nbsp;Installing TurboVNC from Source</h2>
(<code>turbovnc-</code><em><code>{version}</code></em><code>.tar.gz</code>)
from the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files/" class="remote">Files
area</a></span><a name="idx0030"></a> of the
area</a></span><a name="idx0028"></a> of the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc" class="remote">TurboVNC
SourceForge project page</a></span><a name="idx0031"></a>, uncompress
SourceForge project page</a></span><a name="idx0029"></a>, uncompress
it, <code>cd&nbsp;turbovnc-</code><em><code>{version}</code></em>, and
read <code>BUILDING.txt</code> for further instructions on how to build
TurboVNC from source.</p>
Expand Down Expand Up @@ -876,7 +869,7 @@ <h3 id="hd006001002">6.1.2&nbsp;Window Manager Compatibility</h3>
For other systems that lack a 2D window manager, it is recommended that
you install MATE. Refer to
<span class="remote"><a href="http://www.turbovnc.org/Documentation/Compatibility" class="remote">this
report</a></span><a name="idx0032"></a> for an up-to-date list of window
report</a></span><a name="idx0030"></a> for an up-to-date list of window
managers that have been tested with this version of the TurboVNC Server,
how to configure the TurboVNC Server to use those window managers, and a
list of known compatibility issues.</p>
Expand Down Expand Up @@ -1002,7 +995,7 @@ <h2 id="hd006004">6.4&nbsp;Deploying the Java TurboVNC Viewer Using Java Web Sta
packages for Linux, or you can download
<code>libjpeg-turbo-{version}-jws.zip</code> from libjpeg-turbo 1.4.0 or
later (available at
<span class="remote"><a href="http://sourceforge.net/projects/libjpeg-turbo/files" class="remote">http://sourceforge.net/projects/libjpeg-turbo/files</a></span><a name="idx0033"></a>.)
<span class="remote"><a href="http://sourceforge.net/projects/libjpeg-turbo/files" class="remote">http://sourceforge.net/projects/libjpeg-turbo/files</a></span><a name="idx0031"></a>.)
Note that only the JARs included in the official TurboVNC packages are
signed using an official code signing certificate. <br /><br />
</li>
Expand All @@ -1011,7 +1004,7 @@ <h2 id="hd006004">6.4&nbsp;Deploying the Java TurboVNC Viewer Using Java Web Sta
directory. You can obtain these from
<code>turbovnc-{version}-jws.zip</code>, which is supplied with official
releases of TurboVNC 2.1.2 and later (available at
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files" class="remote">http://sourceforge.net/projects/turbovnc/files</a></span><a name="idx0034"></a>.)
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files" class="remote">http://sourceforge.net/projects/turbovnc/files</a></span><a name="idx0032"></a>.)
<br /><br />
</li>
<li class="Itemize-1 Itemize asterisk">
Expand Down Expand Up @@ -1090,7 +1083,7 @@ <h2 id="hd006004">6.4&nbsp;Deploying the Java TurboVNC Viewer Using Java Web Sta
</p></div>
This is just a minimal example. Refer to the
<span class="remote"><a href="http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/" class="remote">Java
Web Start documentation</a></span><a name="idx0035"></a> for additional
Web Start documentation</a></span><a name="idx0033"></a> for additional
fields that you might want to add. <br /><br />
</li>
<li class="Itemize-1 Itemize asterisk">
Expand Down Expand Up @@ -1253,7 +1246,7 @@ <h2 id="hd006006">6.6&nbsp;Running OpenGL Applications</h2>
to indirect rendering, which is limited to the OpenGL 1.4 API and which
may perform sluggishly (particularly with continuous mouse input.) In
general, if the server machine has a GPU, then you should use
<a href="#VGL">VirtualGL</a><a name="idx0036"></a> rather than relying
<a href="#VGL">VirtualGL</a><a name="idx0034"></a> rather than relying
on TurboVNC&rsquo;s software OpenGL implementation.</p>

<p>Passing <code>-extension&nbsp;GLX</code> to <code>vncserver</code>
Expand Down Expand Up @@ -1379,7 +1372,7 @@ <h1 id="hd007"><a name="file007"></a>7&nbsp;Performance and Image Quality</h1>
</li>
<li class="Ordered-0">
whether or not <a href="#InterframeComparison">interframe
comparison</a><a name="idx0037"></a> should be used
comparison</a><a name="idx0035"></a> should be used
</li></ol> See Section
<a href="#AdvancedCompression" class="ref">7.2</a> below for more
details.
Expand Down Expand Up @@ -1431,7 +1424,7 @@ <h1 id="hd007"><a name="file007"></a>7&nbsp;Performance and Image Quality</h1>
<td class="standard">30</td>
<td class="standard">4x</td>
<td class="standard">7</td>
<td class="standard">For subrectangles that have a high number of unique colors, this encoding method produces very noticeable image compression artifacts. However, it performs optimally on low-bandwidth connections. If image quality is more critical than performance, then use one of the other encoding methods or take advantage of the <a href="#LR">Lossless Refresh feature</a><a name="idx0038"></a>. In addition to reducing the JPEG quality to a &ldquo;minimum usable&rdquo; level, this encoding method also enables interframe comparison and Compression Level 2 (CL 7 = CL 2 + interframe comparison.) Compression Level 2 can reduce bandwidth for low-color application workloads that are not good candidates for JPEG compression.</td>
<td class="standard">For subrectangles that have a high number of unique colors, this encoding method produces very noticeable image compression artifacts. However, it performs optimally on low-bandwidth connections. If image quality is more critical than performance, then use one of the other encoding methods or take advantage of the <a href="#LR">Lossless Refresh feature</a><a name="idx0036"></a>. In addition to reducing the JPEG quality to a &ldquo;minimum usable&rdquo; level, this encoding method also enables interframe comparison and Compression Level 2 (CL 7 = CL 2 + interframe comparison.) Compression Level 2 can reduce bandwidth for low-color application workloads that are not good candidates for JPEG compression.</td>
</tr>
<tr class="standard">
<td class="standard">&ldquo;Lossless Tight&rdquo;</td>
Expand Down Expand Up @@ -1782,15 +1775,15 @@ <h3 id="hd007006001">Accelerated JPEG Decoding</h3>
<code>vncviewer-java.bat</code> script or the Start Menu shortcut
(Windows), or the standalone TurboVNC Viewer app (Mac). If the viewer
is launched with Java Web Start using the <a href="#JWS">recommended
procedure</a><a name="idx0039"></a> or the
procedure</a><a name="idx0037"></a> or the
<a href="#Zero_Install">TurboVNC Server&rsquo;s built-in web
server</a><a name="idx0040"></a>, then the appropriate libjpeg-turbo JNI
server</a><a name="idx0038"></a>, then the appropriate libjpeg-turbo JNI
library will be downloaded along with it, assuming that the client
machine is running Windows, OS X, or Linux. For other deployment
scenarios, the Java TurboVNC Viewer will find the libjpeg-turbo JNI
library if
<span class="remote"><a href="http://www.sourceforge.net/projects/libjpeg-turbo/files" class="remote">one
of the official libjpeg-turbo packages</a></span><a name="idx0041"></a>
of the official libjpeg-turbo packages</a></span><a name="idx0039"></a>
is installed on the client machine.</p>

<p>If you suspect for whatever reason that JPEG decoding is not being
Expand Down Expand Up @@ -2445,7 +2438,7 @@ <h1 id="hd0010"><a name="file010"></a>10&nbsp;Compatibility Guide</h1>
<p>In order to realize the full performance benefits of TurboVNC, it is
necessary to use a TurboVNC server and a TurboVNC viewer in concert.
However, TurboVNC is fully compatible with
<span class="remote"><a href="http://www.tigervnc.com" class="remote">TigerVNC</a></span><a name="idx0042"></a>,
<span class="remote"><a href="http://www.tigervnc.com" class="remote">TigerVNC</a></span><a name="idx0040"></a>,
TightVNC, RealVNC, and other VNC flavors. You can use the TurboVNC
Viewer to connect to a non-TurboVNC server (or vice versa), although
this will generally result in some decrease in performance.</p>
Expand Down
5 changes: 1 addition & 4 deletions doc/sysreq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@
| Any 64-bit Intel-based Mac \
|
| O/S \
| OS X 10.7 "Lion" or later \
|
| Other Software \
| [[http://www.java.com][Oracle Java]] 8u40 or later \
| OS X 10.9 "Mavericks" or later \
|
#OPT: hiCol=first

Expand Down
2 changes: 0 additions & 2 deletions doc/turbovncinstall.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ in this manner.
[[http://sourceforge.net/projects/turbovnc/files/][Files area]]
of the [[http://sourceforge.net/projects/turbovnc][TurboVNC SourceForge project page]].

!!! This package requires [[http://www.java.com][Oracle Java]].

#. Open the disk image, then open ''TurboVNC.pkg'' inside the
disk image. Follow the instructions to install the Mac TurboVNC Viewer.

Expand Down
2 changes: 2 additions & 0 deletions release/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<string>Viewer</string>
</dict>
</array>
<key>JVMRuntime</key>
<key>jre</key>
<key>JVMMainClassName</key>
<string>com.turbovnc.vncviewer.VncViewer</string>
<key>JVMOptions</key>
Expand Down
25 changes: 25 additions & 0 deletions release/makemacapp.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@

set -u
set -e
trap onexit INT
trap onexit TERM
trap onexit EXIT

TMPDIR=

onexit()
{
if [ ! "$TMPDIR" = "" ]; then
rm -rf $TMPDIR
fi
}

SRCDIR=@CMAKE_SOURCE_DIR@
JAR=@Java_JAR_EXECUTABLE@
JAVAC=@Java_JAVAC_EXECUTABLE@
JDEPS=`dirname "$JAR"`/jdeps
JLINK=`dirname "$JAR"`/jlink
JMODS=`dirname "$JAR"`/../jmods
JVERSION=@Java_VERSION_MAJOR@

SUFFIX=

umask 022
TMPDIR=`mktemp -d /tmp/makemacapp.XXXXXX`
APP="@CMAKE_PROJECT_NAME@ Viewer$SUFFIX.app"

if [ -d "$APP" ]; then
Expand All @@ -18,6 +37,12 @@ mkdir -p "$APP/Contents/MacOS"
mkdir -p "$APP/Contents/Resources/Java"
mkdir -p "$APP/Contents/Resources/Native"

$JDEPS --generate-module-info $TMPDIR java/VncViewer.jar
cp java/VncViewer.jar $TMPDIR
$JAVAC --patch-module VncViewer=$TMPDIR/VncViewer.jar $TMPDIR/VncViewer/module-info.java
$JAR uf $TMPDIR/VncViewer.jar -C $TMPDIR/VncViewer module-info.class
$JLINK -p $TMPDIR/VncViewer.jar:$JMODS --add-modules VncViewer --limit-modules VncViewer --output "$APP/Contents/PlugIns/jre/Contents/Home" --ignore-signing-information

cp pkgscripts/Info.plist "$APP/Contents/Info.plist"
cp bin/JavaAppLauncher "$APP/Contents/MacOS/@CMAKE_PROJECT_NAME@ Viewer"
echo "APPL????" >"$APP/Contents/PkgInfo"
Expand Down
Loading

0 comments on commit 93315d5

Please sign in to comment.