FreeBSD GitHub runner with vmactions/freebsd-vm@v1 (#7474)

* Add experimental BSD job to CI

* Remove container

* cd into ` synergy/synergy/`

* Change unix to bsd

* Use only run param and not prepare

* Install python3 on FreeBSD

* Add missing command to prepare param

* Add all the Unix-like BSD-derived

* Use latest python3 for NetBSD and DragonFly BSD

* Use env for cmd and correct prepare commands

* Add deps config for unix-like

* Install Python deps on Unix-like

* Return matching entry in `get_unix_like_os`

* Add cmake dep for cmakelang py module

* Back out Unix-like support in `install_deps.py` (Python is tricky on BSD)

* Back out BSD from config

* Create install_deps.sh script for BSD-derived

* Use .sh script instead of .py for BSD-derived

* Add other case and fixed syntax

* Use /usr/bin/env

* Use more available sh

* Restore debian command

* Fixed syntax error

* Remove prepare args

* Remove space

* Use which instead of command

* Add libX11 dep

* Add other BSD-derivatives

* Set CMAKE_REQUIRED_INCLUDES

* Fixed bad separator for CMAKE_REQUIRED_INCLUDES

* Add debug lines

* Set CMAKE_REQUIRED_LIBRARIES to lib names

* use CMAKE_REQUIRED_QUIET

* Set CMAKE_REQUIRED_FLAGS for BSD

* Message for BSD packaging

* Make PKG_CONFIG_FOUND optional

* Move debug to all OS

* Remove solaris for now, too many missing packages

* Add missing  override to XWindowsScreen.h

* Add PC_GLIB_INCLUDE_DIRS

* Fixed glib include

* Make libnotify optional

* Set CMAKE_LIBRARY_PATH

* Only run tests if toml++ available

* Also run integ tests

* Remove DragonFly (C++ version too old)

* Fixed NetBSD command

* Aww sucks. Well, I tried. Patches welcome

* Update ChangeLog

* Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris

* Add missing case for SunOS

* Drop redundant virtual specifiers

* Print libs on FreeBSD

* Restore link_directories

* Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment

* Remove debug line

* Simplify debug text

* Restore ubuntu-latest

* Fixed really stupid typo

* Beef up with ubuntu-22.04-16-core-x64

* Revert "Beef up with ubuntu-22.04-16-core-x64"

This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde.

* Add missing name

* Make .sh file primary deps file

* Tweaked deps instruction label
This commit is contained in:
Nick Bolton 2024-09-06 10:03:34 +01:00 committed by GitHub
parent 38536a9726
commit ad330d7fba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 211 additions and 68 deletions

View file

@ -38,7 +38,8 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: ./.github/actions/run-tests-setup - name: Test setup
uses: ./.github/actions/run-tests-setup
windows: windows:
name: ${{ matrix.target.name }} name: ${{ matrix.target.name }}
@ -328,3 +329,38 @@ jobs:
gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }} gdrive-secret-key: ${{ secrets.GOOGLE_DRIVE_KEY }}
gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }} gdrive-parent-folder-id: ${{ secrets.GOOGLE_DRIVE_TECH_DRIVE }}
package-version: ${{ env.SYNERGY_VERSION }} package-version: ${{ env.SYNERGY_VERSION }}
# Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived".
unix:
name: unix-${{ matrix.distro.name }}
runs-on: ubuntu-latest
timeout-minutes: 20
env:
SYNERGY_BUILD_CMD: |
./scripts/install_deps.sh;
cmake -B build;
cmake --build build -j8;
export QT_QPA_PLATFORM=offscreen;
./build/bin/unittests
./build/bin/integtests
strategy:
fail-fast: false
matrix:
distro:
- name: freebsd
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Build on FreeBSD
if: ${{ matrix.distro.name == 'freebsd' }}
uses: vmactions/freebsd-vm@v1
with:
usesh: true
run: ${{ env.SYNERGY_BUILD_CMD }}

View file

@ -14,6 +14,7 @@ Enhancements:
- #7469 Option to link against local `libportal` and other subprojects - #7469 Option to link against local `libportal` and other subprojects
- #7471 Use `vcpkg` to manage `openssl` dep instead of `choco` - #7471 Use `vcpkg` to manage `openssl` dep instead of `choco`
- #7473 Simplify `vcpkg` caching and use system `vcpkg` - #7473 Simplify `vcpkg` caching and use system `vcpkg`
- #7474 FreeBSD GitHub runner with `vmactions/freebsd-vm@v1`
# 1.15.1 # 1.15.1

View file

@ -29,7 +29,7 @@ We support all major operating systems, including Windows, macOS, Linux, and Uni
All Linux distributions are supported, primarily focusing on: All Linux distributions are supported, primarily focusing on:
Debian, Ubuntu, Linux Mint, Fedora, RHEL, AlmaLinux, Rocky Linux, Arch Linux, openSUSE, Gentoo. Debian, Ubuntu, Linux Mint, Fedora, RHEL, AlmaLinux, Rocky Linux, Arch Linux, openSUSE, Gentoo.
Supported Unix-like BSD-derived operating systems: FreeBSD, OpenBSD, NetBSD, DragonFly BSD. We officially support FreeBSD, we would also like to support: OpenBSD, NetBSD, DragonFly BSD, Solaris.
## Ways to get involved ## Ways to get involved
@ -50,16 +50,16 @@ How to build Synergy 1 Community Edition. Check the [Developer Guide](https://gi
**1. Dependencies:** **1. Dependencies:**
*Linux, macOS, or BSD-derived:*
```
./scripts/install_deps.sh
```
*Windows:* *Windows:*
``` ```
python scripts/install_deps.py python scripts/install_deps.py
``` ```
*macOS/Linux:*
```
./scripts/install_deps.py
```
**2. Configure:** **2. Configure:**
*Windows:* *Windows:*

View file

@ -38,7 +38,6 @@ macro(configure_unix_libs)
include(CheckIncludeFileCXX) include(CheckIncludeFileCXX)
include(CheckSymbolExists) include(CheckSymbolExists)
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
include(FindPkgConfig)
check_include_file_cxx(istream HAVE_ISTREAM) check_include_file_cxx(istream HAVE_ISTREAM)
check_include_file_cxx(ostream HAVE_OSTREAM) check_include_file_cxx(ostream HAVE_OSTREAM)
@ -106,8 +105,26 @@ macro(configure_unix_libs)
if(APPLE) if(APPLE)
configure_mac_libs() configure_mac_libs()
else() else()
configure_xorg_libs() configure_xorg_libs()
configure_wayland_libs() configure_wayland_libs()
find_package(pugixml REQUIRED)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(lib_glib REQUIRED IMPORTED_TARGET glib-2.0)
pkg_search_module(PC_GDKPIXBUF gdk-pixbuf-2.0)
include_directories(${PC_GDKPIXBUF_INCLUDE_DIRS})
pkg_check_modules(lib_gdkpixbuf REQUIRED IMPORTED_TARGET gdk-pixbuf-2.0)
pkg_check_modules(lib_notify REQUIRED IMPORTED_TARGET libnotify)
add_definitions(-DHAVE_GDK_PIXBUF=1 -DHAVE_LIBNOTIFY=1)
else()
message(WARNING "pkg-config not found, skipping libnotify and gdk-pixbuf")
endif()
endif() endif()
# For config.h, set some static values; it may be a good idea to make these # For config.h, set some static values; it may be a good idea to make these
@ -168,14 +185,20 @@ endmacro()
macro(configure_wayland_libs) macro(configure_wayland_libs)
configure_libei() include(FindPkgConfig)
configure_libportal()
pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon) if(PKG_CONFIG_FOUND)
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0) configure_libei()
find_library(LIBM m) configure_libportal()
include_directories(${LIBXKBCOMMON_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}
${LIBM_INCLUDE_DIRS}) pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon)
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0)
find_library(LIBM m)
include_directories(${LIBXKBCOMMON_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}
${LIBM_INCLUDE_DIRS})
else()
message(WARNING "pkg-config not found, skipping wayland libraries")
endif()
endmacro() endmacro()
@ -310,10 +333,8 @@ endmacro()
# #
macro(configure_xorg_libs) macro(configure_xorg_libs)
find_package(pugixml REQUIRED) # Set include dir for BSD-derived systems
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include")
# Add include dir for BSD (posix uses /usr/include/)
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
set(XKBlib "X11/Xlib.h;X11/XKBlib.h") set(XKBlib "X11/Xlib.h;X11/XKBlib.h")
set(CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h") set(CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h")
@ -341,6 +362,12 @@ macro(configure_xorg_libs)
message(FATAL_ERROR "Missing header: " ${XKBlib}) message(FATAL_ERROR "Missing header: " ${XKBlib})
endif() endif()
# Set library path and -L flag for BSD-derived systems.
# On our FreeBSD CI, `link_directories` is also needed for some reason.
set(CMAKE_LIBRARY_PATH "/usr/local/lib")
set(CMAKE_REQUIRED_FLAGS "-L${CMAKE_LIBRARY_PATH}")
link_directories(${CMAKE_LIBRARY_PATH})
check_library_exists("SM;ICE" IceConnectionNumber "" HAVE_ICE) check_library_exists("SM;ICE" IceConnectionNumber "" HAVE_ICE)
check_library_exists("Xext;X11" DPMSQueryExtension "" HAVE_Xext) check_library_exists("Xext;X11" DPMSQueryExtension "" HAVE_Xext)
check_library_exists("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst) check_library_exists("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst)

View file

@ -30,8 +30,10 @@ macro(configure_packaging)
configure_windows_packaging() configure_windows_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
configure_macos_packaging() configure_macos_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|.*BSD|DragonFly") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
configure_linux_packaging() configure_linux_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
message(STATUS "BSD packaging not yet supported")
endif() endif()
include(CPack) include(CPack)
@ -78,7 +80,7 @@ macro(configure_macos_packaging)
endmacro() endmacro()
# #
# Linux packages (including BSD and DragonFly) # Linux packages
# #
macro(configure_linux_packaging) macro(configure_linux_packaging)

View file

@ -58,6 +58,7 @@
"synergyc", "synergyc",
"synergyd", "synergyd",
"synergys", "synergys",
"unittests",
"Valgrind", "Valgrind",
"vcpkg", "vcpkg",
"Volker", "Volker",

View file

@ -304,7 +304,6 @@ class Dependencies:
print(f"Optional package not found, stripping: {optional_package}") print(f"Optional package not found, stripping: {optional_package}")
command = command.replace(optional_package, "") command = command.replace(optional_package, "")
print("Running dependencies command")
linux.run_command(command, check=True) linux.run_command(command, check=True)
subprojects = self.config.get_os_subprojects() subprojects = self.config.get_os_subprojects()

77
scripts/install_deps.sh Executable file
View file

@ -0,0 +1,77 @@
#!/usr/bin/env sh
SUDO=$(which sudo > /dev/null 2>&1 && echo "sudo" || echo "")
install_deps() {
uname_out="$(uname -s)"
case "${uname_out}" in
FreeBSD*) install_freebsd ;;
OpenBSD*) install_openbsd ;;
NetBSD*) install_netbsd ;;
DragonFly*) install_dragonfly ;;
SunOS*) install_solaris ;;
*) install_other $uname_out ;;
esac
}
install_freebsd() {
run_cmd pkg install -y \
cmake \
ninja \
gmake \
gcc10 \
openssl \
glib \
gdk-pixbuf2 \
libX11 \
libXtst \
libnotify \
libxkbfile \
qt6-base \
qt6-tools \
gtk3 \
googletest \
pugixml
}
install_openbsd() {
# Patches welcome!
# pkg_add error:
# Can't find libX11
# Can't find libXtst
echo "Sorry, OpenBSD is not supported yet."
}
install_netbsd() {
# Patches welcome!
# pkg_add error:
# pkg_add: no pkg found for 'libX11', sorry.
# pkg_add: no pkg found for 'libXtst', sorry.
echo "Sorry, NetBSD is not supported yet."
}
install_dragonfly() {
# Patches welcome!
# The C++ version on DragonFly BSD seems to be too old.
echo "Sorry, DragonFly BSD is not supported yet."
}
install_solaris() {
# Patches welcome!
echo "Sorry, Solaris is not supported yet."
}
install_other() {
# TODO: Port the .py script to shell script to make the deps installation lighter on
# Linux and macOS. The .py script is probably only really needed to deal with Windows.
echo "Running Python script for: $1"
run_cmd ./scripts/install_deps.py
}
run_cmd() {
cmd="${SUDO:+$SUDO }$@"
echo "Running: $cmd"
$cmd
}
install_deps

View file

@ -44,7 +44,7 @@ public:
int mouseScrollDelta, IEventQueue *events, int mouseScrollDelta, IEventQueue *events,
synergy::ClientScrollDirection m_clientScrollDirection = synergy::ClientScrollDirection m_clientScrollDirection =
synergy::ClientScrollDirection::SERVER); synergy::ClientScrollDirection::SERVER);
virtual ~XWindowsScreen(); virtual ~XWindowsScreen() override;
//! @name manipulators //! @name manipulators
//@{ //@{
@ -52,50 +52,50 @@ public:
//@} //@}
// IScreen overrides // IScreen overrides
virtual void *getEventTarget() const; void *getEventTarget() const override;
virtual bool getClipboard(ClipboardID id, IClipboard *) const; bool getClipboard(ClipboardID id, IClipboard *) const override;
virtual void void
getShape(SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const; getShape(SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const override;
virtual void getCursorPos(SInt32 &x, SInt32 &y) const; void getCursorPos(SInt32 &x, SInt32 &y) const override;
// IPrimaryScreen overrides // IPrimaryScreen overrides
virtual void reconfigure(UInt32 activeSides); void reconfigure(UInt32 activeSides) override;
virtual void warpCursor(SInt32 x, SInt32 y); void warpCursor(SInt32 x, SInt32 y) override;
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask); UInt32 registerHotKey(KeyID key, KeyModifierMask mask) override;
virtual void unregisterHotKey(UInt32 id); void unregisterHotKey(UInt32 id) override;
virtual void fakeInputBegin(); void fakeInputBegin() override;
virtual void fakeInputEnd(); void fakeInputEnd() override;
virtual SInt32 getJumpZoneSize() const; SInt32 getJumpZoneSize() const override;
virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const; bool isAnyMouseButtonDown(UInt32 &buttonID) const override;
virtual void getCursorCenter(SInt32 &x, SInt32 &y) const; void getCursorCenter(SInt32 &x, SInt32 &y) const override;
// ISecondaryScreen overrides // ISecondaryScreen overrides
virtual void fakeMouseButton(ButtonID id, bool press); void fakeMouseButton(ButtonID id, bool press) override;
virtual void fakeMouseMove(SInt32 x, SInt32 y); void fakeMouseMove(SInt32 x, SInt32 y) override;
virtual void fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const; void fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const override;
virtual void fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const; void fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const override;
// IPlatformScreen overrides // IPlatformScreen overrides
virtual void enable(); void enable() override;
virtual void disable(); void disable() override;
virtual void enter(); void enter() override;
virtual bool leave(); bool leave() override;
virtual bool setClipboard(ClipboardID, const IClipboard *); bool setClipboard(ClipboardID, const IClipboard *) override;
virtual void checkClipboards(); void checkClipboards() override;
virtual void openScreensaver(bool notify); void openScreensaver(bool notify) override;
virtual void closeScreensaver(); void closeScreensaver() override;
virtual void screensaver(bool activate); void screensaver(bool activate) override;
virtual void resetOptions(); void resetOptions() override;
virtual void setOptions(const OptionsList &options); void setOptions(const OptionsList &options) override;
virtual void setSequenceNumber(UInt32); void setSequenceNumber(UInt32) override;
virtual bool isPrimary() const; bool isPrimary() const override;
String getSecureInputApp() const override; String getSecureInputApp() const override;
protected: protected:
// IPlatformScreen overrides // IPlatformScreen overrides
virtual void handleSystemEvent(const Event &, void *); void handleSystemEvent(const Event &, void *) override;
virtual void updateButtons(); void updateButtons() override;
virtual IKeyState *getKeyState() const; IKeyState *getKeyState() const override;
private: private:
// event sending // event sending

View file

@ -55,14 +55,10 @@ if(UNIX)
if(NOT APPLE) if(NOT APPLE)
target_link_libraries(synlib pugixml) target_link_libraries(synlib pugixml)
find_package(PkgConfig REQUIRED) find_package(PkgConfig)
pkg_check_modules(lib_glib REQUIRED IMPORTED_TARGET glib-2.0) if(PKG_CONFIG_FOUND)
pkg_search_module(PC_GDKPIXBUF gdk-pixbuf-2.0) target_link_libraries(synlib PkgConfig::lib_glib PkgConfig::lib_gdkpixbuf
include_directories(${PC_GDKPIXBUF_INCLUDE_DIRS}) PkgConfig::lib_notify)
endif()
pkg_check_modules(lib_gdkpixbuf REQUIRED IMPORTED_TARGET gdk-pixbuf-2.0)
pkg_check_modules(lib_notify REQUIRED IMPORTED_TARGET libnotify)
target_link_libraries(synlib PkgConfig::lib_glib PkgConfig::lib_gdkpixbuf
PkgConfig::lib_notify)
endif() endif()
endif() endif()

View file

@ -32,7 +32,7 @@
#include "base/Log.h" #include "base/Log.h"
#include "base/log_outputters.h" #include "base/log_outputters.h"
#if WINAPI_XWINDOWS #if HAVE_LIBNOTIFY
#include <libnotify/notify.h> #include <libnotify/notify.h>
#endif #endif
@ -173,7 +173,7 @@ String AppUtilUnix::getCurrentLanguageCode() {
void AppUtilUnix::showNotification( void AppUtilUnix::showNotification(
const String &title, const String &text) const { const String &title, const String &text) const {
#if WINAPI_XWINDOWS #if HAVE_LIBNOTIFY
LOG( LOG(
(CLOG_INFO "showing notification, title=\"%s\", text=\"%s\"", (CLOG_INFO "showing notification, title=\"%s\", text=\"%s\"",
title.c_str(), text.c_str())); title.c_str(), text.c_str()));

View file

@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#if HAVE_TOMLPLUSPLUS
#include "synergy/Config.h" #include "synergy/Config.h"
#include <filesystem> #include <filesystem>
@ -46,3 +48,5 @@ TEST(ConfigTests, LoadConfigFile) {
std::filesystem::remove(kTestFilename); std::filesystem::remove(kTestFilename);
} }
#endif // HAVE_TOMLPLUSPLUS