class Freerdp < Formula desc "X11 implementation of the Remote Desktop Protocol (RDP)" homepage "https://www.freerdp.com/" url "https://github.com/FreeRDP/FreeRDP/archive/refs/tags/3.26.0.tar.gz" sha256 "ae3b1c0b8e334ecbc2c784bce266249309fad32a0ef41947ce5c059eb18e2059" license "Apache-2.0" bottle do sha256 arm64_tahoe: "fbea718f7ab8ff079bec6454352eac06ef63dd4435ed16c9dc4c33ca85882fc6" sha256 arm64_sequoia: "a386d5e58d51589baad7a06c5ff25a378a861a8565781c4916bb11d5d8c451a4" sha256 arm64_sonoma: "50059b194cb6a583a670ee7c26bfd9613d326c2277130fdf9fce4e02eb1ca367" sha256 sonoma: "91ab2326a3b6aec3ff5f9ac1ec56abc4f67857f16909ea7071fd70934ff81754" sha256 arm64_linux: "ee91dc6adaaa0139a3cab3703e4d39c3d5a8eb25fd4170a9b9dc75783a12cb51" sha256 x86_64_linux: "94f05d652572ad07f5e61c21fe21aad1659a32e28a62611ab0c85fa7f9a06069" end head do url "https://github.com/FreeRDP/FreeRDP.git", branch: "master" depends_on xcode: :build end depends_on "cmake" => :build depends_on "pkgconf" => :build depends_on "cjson" depends_on "ffmpeg" depends_on "jansson" depends_on "jpeg-turbo" depends_on "libusb" depends_on "libx11" depends_on "libxcursor" depends_on "libxext" depends_on "libxfixes" depends_on "libxi" depends_on "libxinerama" depends_on "libxrandr" depends_on "libxrender" depends_on "libxv" depends_on "openssl@3" depends_on "pkcs11-helper" depends_on "sdl3" depends_on "sdl3_ttf" depends_on "uriparser" uses_from_macos "cups" on_linux do depends_on "alsa-lib" depends_on "glib" depends_on "icu4c@78" depends_on "krb5" depends_on "libfuse" depends_on "systemd" depends_on "wayland" depends_on "zlib-ng-compat" end def install args = %W[ -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_NAME_DIR=#{lib} -DWITH_X11=ON -DWITH_JPEG=ON -DWITH_MANPAGES=OFF -DWITH_WEBVIEW=OFF -DWITH_CLIENT_SDL=ON -DWITH_CLIENT_SDL2=OFF -DWITH_CLIENT_SDL3=ON ] # Native macOS client and server implementations are unmaintained and use APIs that are obsolete on Sequoia. # Ref: https://github.com/FreeRDP/FreeRDP/issues/10558 if OS.mac? && MacOS.version >= :sequoia # As a workaround, force X11 shadow server implementation. Can use -DWITH_SHADOW=OFF if it doesn't work inreplace "server/shadow/CMakeLists.txt", "add_subdirectory(Mac)", "add_subdirectory(X11)" args += ["-DWITH_CLIENT_MAC=OFF", "-DWITH_PLATFORM_SERVER=OFF"] end system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args system "cmake", "--build", "build" system "cmake", "--install", "build" end def caveats extra = "" on_macos do extra = <<~EOS XQuartz provides an XServer for macOS. The XQuartz can be installed as a package from www.xquartz.org or as a Homebrew cask: brew install --cask xquartz EOS end <<~EOS xfreerdp is an X11 application that requires an XServer be installed and running. Lack of a running XServer will cause a "$DISPLAY" error. #{extra} EOS end test do success = `#{bin}/xfreerdp --version` # not using system as expected non-zero exit code details = $CHILD_STATUS raise "Unexpected exit code #{$CHILD_STATUS} while running xfreerdp" if !success && details.exitstatus != 128 end end