homebrew-cask/Casks/l/libreoffice.rb

50 lines
2.0 KiB
Ruby

cask "libreoffice" do
arch arm: "aarch64", intel: "x86-64"
folder = on_arch_conditional arm: "aarch64", intel: "x86_64"
version "24.2.3"
sha256 arm: "339c14e0929523ec3078bbcf5ccda9f73ff3c13a16ca10f8653ccf0f95f93ad0",
intel: "1bfae39311ba55d079cc66c7fc1cc9179e21903e7db54cf751017e2c7a3d3b8b"
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/"
livecheck do
url "https://download.documentfoundation.org/libreoffice/stable/"
regex(%r{href=["']v?(\d+(?:\.\d+)+)/?["' >]}i)
end
conflicts_with cask: "libreoffice-still"
depends_on macos: ">= :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