Skip to content

Commit 994d854

Browse files
committed
Merge branch 'master' into multicastvnc
2 parents e9f9fc5 + 0c9e68a commit 994d854

50 files changed

Lines changed: 2012 additions & 569 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
name: "CodeQL"
7+
8+
on:
9+
push:
10+
branches: [master]
11+
pull_request:
12+
# The branches below must be a subset of the branches above
13+
branches: [master]
14+
schedule:
15+
- cron: '0 16 * * 3'
16+
17+
jobs:
18+
analyze:
19+
name: Analyze
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
# Override automatic language detection by changing the below list
26+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27+
language: ['cpp', 'python']
28+
# Learn more...
29+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
with:
35+
# We must fetch at least the immediate parents so that if this is
36+
# a pull request then we can checkout the head.
37+
fetch-depth: 2
38+
39+
# If this run was triggered by a pull request event, then checkout
40+
# the head of the pull request instead of the merge commit.
41+
- run: git checkout HEAD^2
42+
if: ${{ github.event_name == 'pull_request' }}
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
language: c
22
dist: xenial
33
sudo: required
4+
osx_image: xcode11
45

56
os:
67
- linux
78
- osx
89

10+
arch:
11+
- amd64
12+
- ppc64le
13+
914
env:
1015
- CMAKE_OPTIONS="-DWITH_OPENSSL=ON -DWITH_GNUTLS=OFF -DWITH_GCRYPT=OFF" # build with OpenSSL
1116
- CMAKE_OPTIONS="-DWITH_OPENSSL=OFF -DWITH_GNUTLS=ON -DWITH_GCRYPT=ON" # build with GnuTLS and Libgrypt
@@ -16,9 +21,12 @@ jobs:
1621
exclude:
1722
- os: osx
1823
env: CMAKE_OPTIONS="-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-mingw32-linux.cmake" # don't test MinGW from OSX
24+
- os: linux
25+
env: CMAKE_OPTIONS="-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-mingw32-linux.cmake" # don't test MinGW from ppc64le
26+
arch: ppc64le
1927

2028
before_install:
21-
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update; sudo apt-get --no-install-suggests --no-install-recommends install libsdl2-dev liblzo2-dev gnutls-dev libgcrypt-dev wine; fi
29+
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update; sudo apt-get --no-install-suggests --no-install-recommends install libsdl2-dev liblzo2-dev gnutls-dev libgcrypt-dev ; if [ "$TRAVIS_ARCH" = "amd64" ]; then sudo apt-get --no-install-suggests --no-install-recommends install wine; fi ; fi
2230
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install sdl2 lzo; fi
2331

2432
script:

CMakeLists.txt

Lines changed: 101 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ option(WITH_JPEG "Search for the libjpeg compression library to support addition
4646
option(WITH_PNG "Search for the PNG compression library to support additional encodings" ON)
4747
option(WITH_SDL "Search for the Simple Direct Media Layer library to build an example SDL vnc client" ON)
4848
option(WITH_GTK "Search for the GTK library to build an example GTK vnc client" ON)
49+
option(WITH_LIBSSH2 "Search for libssh2 to build an example ssh-tunneled client" ON)
4950
option(WITH_THREADS "Search for a threading library to build with multithreading support" ON)
5051
option(PREFER_WIN32THREADS "When searching for a threading library, prefer win32 threads if they are found" OFF)
5152
option(WITH_GNUTLS "Search for the GnuTLS secure communications library to support TLS" ON)
@@ -58,6 +59,8 @@ option(WITH_24BPP "Allow 24 bpp" ON)
5859
option(WITH_IPv6 "Enable IPv6 Support" ON)
5960
option(WITH_WEBSOCKETS "Build with websockets support" ON)
6061
option(WITH_SASL "Build with SASL support" ON)
62+
option(WITH_EXAMPLES "Build examples" ON)
63+
option(WITH_TESTS "Build tests" ON)
6164

6265

6366
if(WITH_ZLIB)
@@ -131,6 +134,10 @@ if(WITH_GTK)
131134
find_package(GTK2)
132135
endif(WITH_GTK)
133136

137+
if(WITH_LIBSSH2)
138+
find_package(LibSSH2)
139+
endif(WITH_LIBSSH2)
140+
134141
if(WITH_THREADS)
135142
find_package(Threads)
136143
endif(WITH_THREADS)
@@ -209,6 +216,7 @@ check_function_exists(strerror LIBVNCSERVER_HAVE_STRERROR)
209216
check_function_exists(strstr LIBVNCSERVER_HAVE_STRSTR)
210217

211218
check_symbol_exists(htobe64 "endian.h" LIBVNCSERVER_HAVE_HTOBE64)
219+
check_symbol_exists(htobe64 "sys/endian.h" LIBVNCSERVER_HAVE_HTOBE64)
212220
check_symbol_exists(OSSwapHostToBigInt64 "libkern/OSByteOrder.h" LIBVNCSERVER_HAVE_OSSWAPHOSTTOBIGINT64)
213221

214222
if(WITH_THREADS AND Threads_FOUND)
@@ -247,11 +255,11 @@ endif(SYSTEMD_FOUND)
247255
if(WITH_GCRYPT AND LIBGCRYPT_LIBRARIES)
248256
message(STATUS "Building crypto with Libgcrypt")
249257
set(CRYPTO_LIBRARIES ${LIBGCRYPT_LIBRARIES})
250-
set(CRYPTO_SOURCES ${COMMON_DIR}/crypto_libgcrypt)
258+
set(CRYPTO_SOURCES ${COMMON_DIR}/crypto_libgcrypt.c)
251259
elseif(OPENSSL_FOUND)
252260
message(STATUS "Building crypto with OpenSSL")
253261
set(CRYPTO_LIBRARIES ${OPENSSL_LIBRARIES})
254-
set(CRYPTO_SOURCES ${COMMON_DIR}/crypto_openssl)
262+
set(CRYPTO_SOURCES ${COMMON_DIR}/crypto_openssl.c)
255263
else()
256264
message(STATUS "Building crypto with builtin functions, only including SHA1 and D3DES")
257265
set(CRYPTO_SOURCES ${COMMON_DIR}/crypto_included.c ${COMMON_DIR}/sha1.c ${COMMON_DIR}/d3des.c)
@@ -598,6 +606,17 @@ if(GTK2_FOUND)
598606
)
599607
endif(GTK2_FOUND)
600608

609+
if(LIBSSH2_FOUND AND (CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT))
610+
include_directories(${LIBSSH2_INCLUDE_DIR})
611+
set(LIBVNCCLIENT_EXAMPLES
612+
${LIBVNCCLIENT_EXAMPLES}
613+
sshtunnel
614+
)
615+
endif()
616+
# if not found, set lib var to empty, otherwise CMake complains
617+
if(NOT LIBSSH2_FOUND)
618+
set(LIBSSH2_LIBRARY "")
619+
endif()
601620

602621
if(FFMPEG_FOUND)
603622
set(LIBVNCCLIENT_EXAMPLES
@@ -606,26 +625,28 @@ if(FFMPEG_FOUND)
606625
)
607626
endif(FFMPEG_FOUND)
608627

609-
610-
foreach(e ${LIBVNCSERVER_EXAMPLES})
611-
add_executable(examples_${e} ${LIBVNCSRVEXAMPLE_DIR}/${e}.c)
612-
set_target_properties(examples_${e} PROPERTIES OUTPUT_NAME ${e})
613-
set_target_properties(examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples)
614-
target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT} ${CARBON_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY})
615-
endforeach(e ${LIBVNCSERVER_EXAMPLES})
616-
617-
foreach(e ${LIBVNCCLIENT_EXAMPLES})
618-
add_executable(client_examples_${e} ${LIBVNCCLIEXAMPLE_DIR}/${e}.c ${LIBVNCCLIEXAMPLE_DIR}/${${e}_EXTRA_SOURCES} )
619-
set_target_properties(client_examples_${e} PROPERTIES OUTPUT_NAME ${e})
620-
set_target_properties(client_examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/client_examples)
621-
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES})
622-
endforeach(e ${LIBVNCCLIENT_EXAMPLES})
623-
628+
if(WITH_EXAMPLES)
629+
foreach(e ${LIBVNCSERVER_EXAMPLES})
630+
add_executable(examples_${e} ${LIBVNCSRVEXAMPLE_DIR}/${e}.c)
631+
set_target_properties(examples_${e} PROPERTIES OUTPUT_NAME ${e})
632+
set_target_properties(examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples)
633+
target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT} ${CARBON_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY})
634+
endforeach(e ${LIBVNCSERVER_EXAMPLES})
635+
636+
foreach(e ${LIBVNCCLIENT_EXAMPLES})
637+
add_executable(client_examples_${e} ${LIBVNCCLIEXAMPLE_DIR}/${e}.c ${LIBVNCCLIEXAMPLE_DIR}/${${e}_EXTRA_SOURCES} )
638+
set_target_properties(client_examples_${e} PROPERTIES OUTPUT_NAME ${e})
639+
set_target_properties(client_examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/client_examples)
640+
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSH2_LIBRARY})
641+
endforeach(e ${LIBVNCCLIENT_EXAMPLES})
642+
endif(WITH_EXAMPLES)
624643

625644
#
626645
# them tests
627646
#
628647

648+
if(WITH_TESTS)
649+
629650
if(UNIX)
630651
set(ADDITIONAL_TEST_LIBS m)
631652
endif(UNIX)
@@ -697,6 +718,8 @@ if(LIBVNCSERVER_WITH_WEBSOCKETS)
697718
add_test(NAME wstest COMMAND test_wstest)
698719
endif(LIBVNCSERVER_WITH_WEBSOCKETS)
699720

721+
endif(WITH_TESTS)
722+
700723
#
701724
# this gets the libraries needed by TARGET in "-libx -liby ..." form
702725
#
@@ -726,22 +749,65 @@ get_link_libraries(PRIVATE_LIBS vncclient)
726749
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libvncclient.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libvncclient.pc @ONLY)
727750

728751
if(LIBVNCSERVER_INSTALL)
729-
install(TARGETS vncserver DESTINATION ${CMAKE_INSTALL_LIBDIR})
730-
install(TARGETS vncclient DESTINATION ${CMAKE_INSTALL_LIBDIR})
731-
install(FILES
732-
rfb/keysym.h
733-
rfb/threading.h
734-
rfb/rfb.h
735-
rfb/rfbclient.h
736-
${CMAKE_CURRENT_BINARY_DIR}/rfb/rfbconfig.h
737-
rfb/rfbproto.h
738-
rfb/rfbregion.h
739-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rfb
740-
)
741-
742-
install(FILES
743-
${CMAKE_CURRENT_BINARY_DIR}/libvncserver.pc
744-
${CMAKE_CURRENT_BINARY_DIR}/libvncclient.pc
745-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
746-
)
752+
set(INSTALL_HEADER_FILES
753+
rfb/keysym.h
754+
rfb/threading.h
755+
rfb/rfb.h
756+
rfb/rfbclient.h
757+
${CMAKE_CURRENT_BINARY_DIR}/rfb/rfbconfig.h
758+
rfb/rfbproto.h
759+
rfb/rfbregion.h
760+
)
761+
762+
set_property(TARGET vncclient PROPERTY PUBLIC_HEADER ${INSTALL_HEADER_FILES})
763+
set_property(TARGET vncserver PROPERTY PUBLIC_HEADER ${INSTALL_HEADER_FILES})
764+
if(WIN32)
765+
INSTALL(TARGETS vncclient vncserver
766+
EXPORT LibVNCServerTargets
767+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
768+
LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}"
769+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
770+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rfb
771+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
772+
)
773+
else()
774+
INSTALL(TARGETS vncclient vncserver
775+
EXPORT LibVNCServerTargets
776+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
777+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
778+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
779+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rfb
780+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
781+
)
782+
endif()
783+
784+
# Install cmake configure files
785+
install(EXPORT LibVNCServerTargets
786+
NAMESPACE
787+
"LibVNCServer::"
788+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/LibVNCServer"
789+
)
790+
791+
include(CMakePackageConfigHelpers)
792+
configure_package_config_file(
793+
${PROJECT_SOURCE_DIR}/cmake/Modules/LibVNCServerConfig.cmake.in
794+
${CMAKE_BINARY_DIR}/LibVNCServerConfig.cmake
795+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/LibVNCServer"
796+
)
797+
# Install cmake version configure file
798+
write_basic_package_version_file(
799+
"${CMAKE_BINARY_DIR}/LibVNCServerConfigVersion.cmake"
800+
VERSION ${PARA_VERSION}
801+
COMPATIBILITY AnyNewerVersion)
802+
install(FILES
803+
"${CMAKE_BINARY_DIR}/LibVNCServerConfigVersion.cmake"
804+
"${CMAKE_BINARY_DIR}/LibVNCServerConfig.cmake"
805+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/LibVNCServer")
806+
807+
808+
install(FILES
809+
${CMAKE_CURRENT_BINARY_DIR}/libvncserver.pc
810+
${CMAKE_CURRENT_BINARY_DIR}/libvncclient.pc
811+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
812+
)
747813
endif()

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Pull Requests
2+
3+
* Make sure you only include relevant changes in your commit(s). In particular, don't re-format
4+
whole source files as those indentation changes add a lot of unrelated changes to your commit.
5+
6+
* Make your commits as [atomic as possible](https://www.freshconsulting.com/atomic-commits/).
7+
* Fundamental question 1: what could we need to revert later?
8+
* Fundamental question 2: what could we need to cherry-pick?
9+
* Fundamental question 3: is there an _and_ in the commit message? -> split it!
10+
11+
* Adhere to the commit message [guidelines](https://chris.beams.io/posts/git-commit/):
12+
* Start with the module you are changing, ended with a ':'. Common ones used here are "CMake:"
13+
or "examples:" or "libvncclient:", but there are more! A good way to find common module
14+
descriptions is to look into the git history of the project.
15+
* Keep the commit message short and in the form of "When applied, this commit will ' `<your commit message>`
16+
* Do _not_ end the subject line with a '.'.
17+
* Example: `warpdrive: increase fuel capacity to 100k`

0 commit comments

Comments
 (0)