homebrew-core/Formula/synergy-core.rb

125 lines
5.3 KiB
Ruby

class SynergyCore < Formula
desc "Synergy, the keyboard and mouse sharing tool"
homepage "https://symless.com/synergy"
url "https://github.com/symless/synergy-core/archive/refs/tags/1.14.5.17.tar.gz"
sha256 "ed48717ad664773aa3492e34f085873cab43fb84e8fe3717db485588b67ae1d1"
# The synergy-core/LICENSE file contains the following preamble:
# This program is released under the GPL with the additional exemption
# that compiling, linking, and/or using OpenSSL is allowed.
# This preamble is followed by the text of the GPL-2.0.
#
# The synergy-core license is a free software license but it cannot be
# represented with the brew `license` statement.
#
# The GitHub Licenses API incorrectly says that this project is licensed
# strictly under GPLv2 (rather than GPLv2 plus a special exception).
# This requires synergy-core to appear as an exception in:
# audit_exceptions/permitted_formula_license_mismatches.json
# That exception can be removed if the nonfree GitHub Licenses API is fixed.
license :cannot_represent
head "https://github.com/symless/synergy-core.git", branch: "master"
# This repository contains old 2.0.0 tags, one of which uses a stable tag
# format (`v2.0.0-stable`), despite being marked as "pre-release" on GitHub.
# The `GithubLatest` strategy is used to avoid these old tags without having
# to worry about missing a new 2.0.0 version in the future.
livecheck do
url :stable
regex(%r{href=["']?[^"' >]*?/tag/[^"' >]*?v?(\d+(?:\.\d+)+)[^"' >]*?["' >]}i)
strategy :github_latest
end
bottle do
sha256 arm64_ventura: "1b4a2490a8037d024db0d276cae2e8bc285aee8a103db5342ccbe10771199e3c"
sha256 arm64_monterey: "725f0f1fa1dfe02c9a1c7263475e56ea7ddd1851db82f7105713e722ac8a8420"
sha256 arm64_big_sur: "4029385d37cae098379287bf401afdcfd0e7255956644ca9698066997ac8e662"
sha256 ventura: "1e8ef42fdc16ec61502ddc2e505fb3068cf3676d1f5139bf33c820cc732d6f2c"
sha256 monterey: "24f862db876c623f46ad44fcc14350586783e84c1f0dd79bd17e37b2ab861280"
sha256 big_sur: "f125834a8999cb0a9392e4a4f7085b9168b206e8b596929981426eb92a658036"
sha256 catalina: "9d82863c4c7c1bb6dcd62d9cfb5eeb4abd05d9c360bf08b0b5408b2e90dde516"
sha256 cellar: :any_skip_relocation, x86_64_linux: "cac6f9f95676a8ec29f97d17612c1e523ddb912f36c23ded04330b1c2a73a371"
end
depends_on "cmake" => :build
depends_on "openssl@3"
depends_on "pugixml"
depends_on "qt@5"
on_linux do
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
depends_on "glib"
depends_on "libnotify"
depends_on "libxkbfile"
end
fails_with gcc: "5" do
cause "synergy-core requires C++17 support"
end
def install
# Use the standard brew installation path.
inreplace "CMakeLists.txt",
"set (SYNERGY_BUNDLE_DIR ${CMAKE_BINARY_DIR}/bundle)",
"set (SYNERGY_BUNDLE_DIR ${CMAKE_INSTALL_PREFIX}/bundle)"
system "cmake", "-S", ".", "-B", "build", *std_cmake_args,
"-DBUILD_TESTS:BOOL=OFF", "-DCMAKE_INSTALL_DO_STRIP=1",
"-DSYSTEM_PUGIXML:BOOL=ON"
system "cmake", "--build", "build"
system "cmake", "--install", "build"
if OS.mac?
bin.install_symlink prefix/"bundle/Synergy.app/Contents/MacOS/synergy" # main GUI program
bin.install_symlink prefix/"bundle/Synergy.app/Contents/MacOS/synergys" # server
bin.install_symlink prefix/"bundle/Synergy.app/Contents/MacOS/synergyc" # client
end
end
service do
run [opt_bin/"synergy"]
run_type :immediate
end
def caveats
# Because we used `license :cannot_represent` above, tell the user how to
# read the license.
s = <<~EOS
Read the synergy-core license here:
#{opt_prefix}/LICENSE
EOS
# The binaries built by brew are not signed by a trusted certificate, so the
# user may need to revoke all permissions for 'Accessibility' and re-grant
# them when upgrading synergy-core.
on_macos do
s += "\n" + <<~EOS
Synergy requires the 'Accessibility' permission.
You can grant this permission by navigating to:
System Preferences -> Security & Privacy -> Privacy -> Accessibility
If Synergy still doesn't work, try clearing the 'Accessibility' list:
sudo tccutil reset Accessibility
You can then grant the 'Accessibility' permission again.
You may need to clear this list each time you upgrade synergy-core.
EOS
end
s
end
test do
assert_equal shell_output("#{opt_bin}/synergys", 4),
"synergys: no configuration available\n"
assert_equal shell_output("#{opt_bin}/synergyc", 3).split("\n")[0],
"synergyc: a server address or name is required"
return if head?
version_string = Regexp.quote(version.major_minor_patch)
assert_match(/synergys #{version_string}[-.0-9a-z]*, protocol version/,
shell_output("#{opt_bin}/synergys --version", 3).lines.first)
assert_match(/synergyc #{version_string}[-.0-9a-z]*, protocol version/,
shell_output("#{opt_bin}/synergyc --version", 3).lines.first)
end
end