cask "libreoffice" do arch arm: "aarch64", intel: "x86-64" folder = on_arch_conditional arm: "aarch64", intel: "x86_64" version "25.2.4" sha256 arm: "d12176793dcb9850e37ec945fa48b92b9175b40e6b869b7b4c5a251879c9162b", intel: "c2fc854af1d4abf8d46e7716f7729fd39fc8060ebf9b2390c2699574db095d20" url "https://download.documentfoundation.org/libreoffice/stable/#{version}/mac/#{folder}/LibreOffice_#{version}_MacOS_#{arch}.dmg", verified: "download.documentfoundation.org/libreoffice/stable/" name "LibreOffice" desc "Free cross-platform office suite, fresh version" homepage "https://www.libreoffice.org/" # We check the wiki homepage for release versions because: # * Upstream may upload a new version to the stable download directory # (https://download.documentfoundation.org/libreoffice/stable/) before it's # released. # * The contents of the download page can change based on user agent(?), # sometimes in unpredictable ways that break the check, so it's not an # entirely dependable source for us to check. # * The libreoffice.org Release Notes page may not be updated in a timely # manner after new releases are announced (whereas the wiki appears to be # updated relatively soon after). # # NOTE: This needs to check a page that provides the latest versons for both # Fresh and Still, as this check is also used by the `libreoffice-still` cask. livecheck do url "https://wiki.documentfoundation.org/Main_Page" regex(/>\s*Download\s+LibreOffice\s+v?(\d+(?:\.\d+)+)\s*= :catalina" app "LibreOffice.app" binary "#{appdir}/LibreOffice.app/Contents/MacOS/gengal" binary "#{appdir}/LibreOffice.app/Contents/MacOS/regview" binary "#{appdir}/LibreOffice.app/Contents/MacOS/senddoc" binary "#{appdir}/LibreOffice.app/Contents/MacOS/uno" binary "#{appdir}/LibreOffice.app/Contents/MacOS/unoinfo" binary "#{appdir}/LibreOffice.app/Contents/MacOS/unopkg" binary "#{appdir}/LibreOffice.app/Contents/MacOS/uri-encode" binary "#{appdir}/LibreOffice.app/Contents/MacOS/xpdfimport" # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809) shimscript = "#{staged_path}/soffice.wrapper.sh" binary shimscript, target: "soffice" preflight do File.write shimscript, <<~EOS #!/bin/sh '#{appdir}/LibreOffice.app/Contents/MacOS/soffice' "$@" EOS end zap trash: [ "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.libreoffice.script.sfl*", "~/Library/Application Support/LibreOffice", "~/Library/Preferences/org.libreoffice.script.plist", "~/Library/Saved Application State/org.libreoffice.script.savedState", ] end