homebrew-cask/Casks/blender.rb

41 lines
1.3 KiB
Ruby

cask "blender" do
arch arm: "arm64", intel: "x64"
version "3.4.1"
sha256 arm: "5f628965f7209b8497be9a9d1854e1c859a9d22cf7731c3538e4c46f7fed8e85",
intel: "f820d363b74694f2a7a4deca8780ae0dbdce3f312e02cc8234c199ce30bd6c9e"
url "https://download.blender.org/release/Blender#{version.major_minor}/blender-#{version}-macos-#{arch}.dmg"
name "Blender"
desc "3D creation suite"
homepage "https://www.blender.org/"
livecheck do
url "https://www.blender.org/download/"
regex(%r{href=.*?/blender[._-]v?(\d+(?:\.\d+)+)[._-]macos[._-]#{arch}\.dmg}i)
end
conflicts_with cask: "homebrew/cask-versions/blender-lts"
depends_on macos: ">= :high_sierra"
app "Blender.app"
# shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
shimscript = "#{staged_path}/blender.wrapper.sh"
binary shimscript, target: "blender"
preflight do
# make __pycache__ directories writable, otherwise uninstall fails
FileUtils.chmod "u+w", Dir.glob("#{staged_path}/*.app/**/__pycache__")
File.write shimscript, <<~EOS
#!/bin/bash
'#{appdir}/Blender.app/Contents/MacOS/Blender' "$@"
EOS
end
zap trash: [
"~/Library/Application Support/Blender",
"~/Library/Saved Application State/org.blenderfoundation.blender.savedState",
]
end