Skip to content

Commit

Permalink
Support Apple silicon-based Macs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcommander committed Aug 13, 2022
1 parent b885ad7 commit 4f39259
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
make -j$NUMCPUS --load-average=$NUMCPUS
popd
macos:
runs-on: macos-latest
runs-on: macos-10.15
steps:
- name: Set global environment variables
run: |
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ to connect to a TurboVNC session using the TurboVNC Session Manager if the
check box in the TurboVNC Viewer Options dialog) and the `SessMgrAuto`
parameter was enabled.

7. The TurboVNC Viewer now builds and runs on Apple silicon-based Macs.


3.0
===
Expand Down
8 changes: 8 additions & 0 deletions cmakescripts/BuildPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,19 @@ set(EAWT_ADD_MODULES "")
if(TVNC_INCLUDEJRE)
set(EAWT_ADD_MODULES "\n\t\t<string>--add-exports</string>\n\t\t<string>java.desktop/com.apple.eawt=VncViewer</string>")
endif()
if(CPU_TYPE STREQUAL "arm64")
set(MINSYSVERSION "11")
set(FORMAL_CPU_NAME "Apple silicon")
else()
set(MINSYSVERSION "10.7.0")
set(FORMAL_CPU_NAME "Intel")
endif()
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/Welcome.txt.in pkgscripts/Welcome.txt @ONLY)
configure_file(release/uninstall.in pkgscripts/uninstall)
configure_file(release/uninstall.applescript.in
pkgscripts/uninstall.applescript)
Expand Down
16 changes: 9 additions & 7 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="2022-05-12T17:23:43">
<meta name="date" content="2022-08-13T11:13:58">
<meta name="generator" content="deplate.rb 0.8.5">
<title>User&rsquo;s Guide for TurboVNC 3.0.1</title>
<link rel="start" href="index.html" title="Frontpage">
Expand Down Expand Up @@ -50,7 +50,7 @@
Systems</a>
</li>
<li class="Itemize-3 hd">
<a href="#hd004002" class="hd">4.2 Mac/x86</a>
<a href="#hd004002" class="hd">4.2 Mac</a>
</li>
<li class="Itemize-3 hd">
<a href="#hd004003" class="hd">4.3 Windows</a>
Expand Down Expand Up @@ -498,7 +498,7 @@ <h2 id="hd004001">4.1&nbsp;Linux and Other Un*x Operating Systems</h2>



<h2 id="hd004002">4.2&nbsp;Mac/x86</h2>
<h2 id="hd004002">4.2&nbsp;Mac</h2>

<div class="table">
<table class="standard">
Expand All @@ -509,12 +509,12 @@ <h2 id="hd004002">4.2&nbsp;Mac/x86</h2>
</tr>
</thead>
<tr class="standard">
<td class="high standard">Recommended CPU</td>
<td class="standard">Any 64-bit Intel-based Mac</td>
<td class="high standard">Required CPU</td>
<td class="standard">64-bit Intel or Apple silicon</td>
</tr>
<tr class="standard">
<td class="high standard">O/S</td>
<td class="standard">OS X/macOS 10.10 &ldquo;Yosemite&rdquo; or later</td>
<td class="standard">OS X/macOS 10.10 &ldquo;Yosemite&rdquo; or later (Intel); macOS 11 &ldquo;Big Sur&rdquo; or later (Apple silicon)</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -654,7 +654,9 @@ <h2 id="hd005002">5.2&nbsp;Installing the TurboVNC Viewer on macOS</h2>
<ol class="Ordered numeric">
<li class="Ordered-1 Ordered">
Download the TurboVNC Mac disk image
(<strong class="filename">TurboVNC-3.0.1.dmg</strong>) from the
(<strong class="filename">TurboVNC-3.0.1-x86_64.dmg</strong> for Intel
CPUs or <strong class="filename">TurboVNC-3.0.1-arm64.dmg</strong> for
Apple silicon CPUs) from the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc/files/" class="remote">Files
area</a></span><a name="idx0015"></a> of the
<span class="remote"><a href="http://sourceforge.net/projects/turbovnc" class="remote">TurboVNC
Expand Down
3 changes: 2 additions & 1 deletion doc/install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ Add {file: ~/turbovnc} to any paths specified in this document.
** Installing the TurboVNC Viewer on macOS

#. Download the TurboVNC Mac disk image
({file: TurboVNC-{val: _VERSION}.dmg}) from the
({file: TurboVNC-{val: _VERSION}-x86_64.dmg} for Intel CPUs or
{file: TurboVNC-{val: _VERSION}-arm64.dmg} for Apple silicon CPUs) from the
[[http://sourceforge.net/projects/turbovnc/files/][Files area]]
of the [[http://sourceforge.net/projects/turbovnc][TurboVNC SourceForge project page]].

Expand Down
9 changes: 5 additions & 4 deletions doc/sysreq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@
|
#OPT: hiCol=first

** Mac/x86
** Mac

|| || Client ||
| Recommended CPU \
| Any 64-bit Intel-based Mac \
| Required CPU \
| 64-bit Intel or Apple silicon \
|
| O/S \
| OS X/macOS 10.10 "Yosemite" or later \
| OS X/macOS 10.10 "Yosemite" or later (Intel); macOS 11 "Big Sur" or later \
(Apple silicon) \
|
#OPT: hiCol=first

Expand Down
2 changes: 1 addition & 1 deletion release/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleIconFile</key>
<string>turbovnc.icns</string>
<key>LSMinimumSystemVersion</key>
<string>10.7.0</string>
<string>@MINSYSVERSION@</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
Expand Down
1 change: 0 additions & 1 deletion release/Welcome.txt

This file was deleted.

1 change: 1 addition & 0 deletions release/Welcome.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This package will install the TurboVNC Viewer for @FORMAL_CPU_NAME@-based Macs. To remove TurboVNC, use the "Uninstall TurboVNC" application.
7 changes: 6 additions & 1 deletion release/makemacapp.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SRCDIR=@CMAKE_SOURCE_DIR@
BINDIR=@CMAKE_BINARY_DIR@
CMAKE_COMMAND=@CMAKE_COMMAND@
INCLUDEJRE=@TVNC_INCLUDEJRE@
CPU_TYPE=@CPU_TYPE@

umask 022
APP="@CMAKE_PROJECT_NAME@ Viewer.app"
Expand All @@ -27,7 +28,11 @@ if [ "$INCLUDEJRE" = "1" ]; then
fi

install -m 644 pkgscripts/Info.plist "$APP/Contents/Info.plist"
install -m 755 $SRCDIR/unix/vncviewer/JavaAppLauncher "$APP/Contents/MacOS/@CMAKE_PROJECT_NAME@ Viewer"
if [ "$CPU_TYPE" = "x86_64" ]; then
install -m 755 $SRCDIR/unix/vncviewer/JavaAppLauncher "$APP/Contents/MacOS/@CMAKE_PROJECT_NAME@ Viewer"
else
install -m 755 bin/JavaAppLauncher "$APP/Contents/MacOS/@CMAKE_PROJECT_NAME@ Viewer"
fi
echo "APPL????" >"$APP/Contents/PkgInfo"
install -m 644 java/VncViewer.jar "$APP/Contents/Resources/Java/"
install -m 644 $SRCDIR/java/com/turbovnc/vncviewer/README.md "$APP/Contents/Resources/Java/"
Expand Down
19 changes: 10 additions & 9 deletions release/makemacpkg.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ PKGNAME=@PKGNAME@
PROJECT=@CMAKE_PROJECT_NAME@
VERSION=@VERSION@
BUILD=@BUILD@
CPU_TYPE=@CPU_TYPE@
SRCDIR=@CMAKE_SOURCE_DIR@
PREFIX=@CMAKE_INSTALL_PREFIX@
BINDIR=@CMAKE_INSTALL_FULL_BINDIR@
Expand All @@ -57,8 +58,8 @@ MANDIR=@CMAKE_INSTALL_FULL_MANDIR@
MACOS_APP_CERT_NAME="@MACOS_APP_CERT_NAME@"
MACOS_INST_CERT_NAME="@MACOS_INST_CERT_NAME@"

if [ -f $PKGNAME-$VERSION.dmg ]; then
rm -f $PKGNAME-$VERSION.dmg
if [ -f $PKGNAME-$VERSION-$CPU_TYPE.dmg ]; then
rm -f $PKGNAME-$VERSION-$CPU_TYPE.dmg
fi

umask 022
Expand All @@ -85,7 +86,7 @@ mkdir -p $PKGROOT/Library/Documentation
safedirmove $PKGROOT$DOCDIR $PKGROOT/Library/Documentation/$PKGNAME $TMPDIR/__tmpdoc

mkdir -p $TMPDIR/pkg/
install -m 644 $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.txt $SRCDIR/release/ReadMe.txt $TMPDIR/pkg/
install -m 644 $SRCDIR/release/License.rtf pkgscripts/Welcome.txt $SRCDIR/release/ReadMe.txt $TMPDIR/pkg/
install -m 644 pkgscripts/Distribution.xml $TMPDIR/pkg/Distribution.xml
mkdir -p $PKGROOT$BINDIR/
install -m 755 pkgscripts/uninstall $PKGROOT$BINDIR/
Expand All @@ -94,13 +95,13 @@ mkdir -p "$PKGROOT/Applications/$PROJECT"
pkgscripts/makemacapp
ln -fs /Library/Documentation/$PKGNAME/index.html "$PKGROOT/Applications/$PROJECT/$PROJECT User's Guide.html"
install -m 644 @CMAKE_BINARY_DIR@/pkgscripts/uninstall.applescript $TMPDIR
osacompile -t APPL -a x86_64 -o "$TMPDIR/Uninstall $PROJECT.app" $TMPDIR/uninstall.applescript
osacompile -t APPL -o "$TMPDIR/Uninstall $PROJECT.app" $TMPDIR/uninstall.applescript
if [ "$MACOS_APP_CERT_NAME" != "" ]; then
codesign -f -s "$MACOS_APP_CERT_NAME" --timestamp "$TMPDIR/Uninstall $PROJECT.app"
codesign -vv "$TMPDIR/Uninstall $PROJECT.app"
fi
echo "do shell script \"@CMAKE_INSTALL_PREFIX@/bin/vncviewer -listen >/dev/null 2>&1 &\"" >$TMPDIR/listenmode.applescript
osacompile -t APPL -a x86_64 -o "$TMPDIR/$VIEWER (Listen Mode).app" $TMPDIR/listenmode.applescript
osacompile -t APPL -o "$TMPDIR/$VIEWER (Listen Mode).app" $TMPDIR/listenmode.applescript
if [ "$MACOS_APP_CERT_NAME" != "" ]; then
codesign -f -s "$MACOS_APP_CERT_NAME" --timestamp "$TMPDIR/$VIEWER (Listen Mode).app"
codesign -vv "$TMPDIR/$VIEWER (Listen Mode).app"
Expand Down Expand Up @@ -129,11 +130,11 @@ if [ "$MACOS_INST_CERT_NAME" != "" ]; then
fi
mv "$TMPDIR/Uninstall $PROJECT.app" $TMPDIR/dmg/
hdiutil create -fs HFS+ -volname $PKGNAME-$VERSION \
-srcfolder "$TMPDIR/dmg" $TMPDIR/$PKGNAME-$VERSION.dmg
-srcfolder "$TMPDIR/dmg" $TMPDIR/$PKGNAME-$VERSION-$CPU_TYPE.dmg
if [ "$MACOS_APP_CERT_NAME" != "" ]; then
codesign -s "$MACOS_APP_CERT_NAME" --timestamp $TMPDIR/$PKGNAME-$VERSION.dmg
codesign -vv $TMPDIR/$PKGNAME-$VERSION.dmg
codesign -s "$MACOS_APP_CERT_NAME" --timestamp $TMPDIR/$PKGNAME-$VERSION-$CPU_TYPE.dmg
codesign -vv $TMPDIR/$PKGNAME-$VERSION-$CPU_TYPE.dmg
fi
cp $TMPDIR/$PKGNAME-$VERSION.dmg .
cp $TMPDIR/$PKGNAME-$VERSION-$CPU_TYPE.dmg .

exit
36 changes: 21 additions & 15 deletions unix/vncviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,27 @@ set_target_properties(turbovnchelper PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/java)
target_link_libraries(turbovnchelper "-framework Cocoa" ${TJPEG_LIBRARY})

# This is nasty, but for reasons unexplained, full-screen multi-screen spanning
# doesn't work with the Mac TurboVNC Viewer app unless JavaAppLauncher is built
# with an older OS X SDK. Thus, we include a binary of it in the source tree,
# and it can only be rebuilt by building the "JavaAppLauncher" target.
set(MACOS_PLATFORMDIR /Applications/Xcode46.app/Contents/Developer)
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher.m
COMMAND ${MACOS_PLATFORMDIR}/usr/bin/gcc
-I${JAVA_INCLUDE_PATH} -I${JAVA_INCLUDE_PATH2}
-isysroot ${MACOS_PLATFORMDIR}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-mmacosx-version-min=10.7 -framework Cocoa
${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher.m
-o ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher)
add_custom_target(JavaAppLauncher
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher)
if(CPU_TYPE STREQUAL "x86_64")
# This is nasty, but for reasons unexplained, full-screen multi-screen
# spanning doesn't work with the Mac TurboVNC Viewer app unless
# JavaAppLauncher is built with an older OS X SDK. Thus, we include a binary
# of it in the source tree, and it can only be rebuilt by building the
# "JavaAppLauncher" target.
set(MACOS_PLATFORMDIR /Applications/Xcode46.app/Contents/Developer)
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher.m
COMMAND ${MACOS_PLATFORMDIR}/usr/bin/gcc
-I${JAVA_INCLUDE_PATH} -I${JAVA_INCLUDE_PATH2}
-isysroot ${MACOS_PLATFORMDIR}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-mmacosx-version-min=10.7 -framework Cocoa
${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher.m
-o ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher)
add_custom_target(JavaAppLauncher
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/JavaAppLauncher)
else()
add_executable(JavaAppLauncher JavaAppLauncher.m)
target_link_libraries(JavaAppLauncher "-framework Cocoa")
endif()

install(TARGETS turbovnchelper DESTINATION ${CMAKE_INSTALL_JAVADIR})

Expand Down

0 comments on commit 4f39259

Please sign in to comment.