Last active
January 11, 2019 11:54
-
-
Save AlexanderWillner/0bb32dc72e7159b399dcc8de700fb4e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Retrieved from https://raw.githubusercontent.com/Homebrew/homebrew-head-only/35a27139b0878857031693b4f8b975279872a56c/vdfuse.rb | |
# The formula used to be provided by the (now-removed) head-only Homebrew tap. | |
# It was later migrated to the (now-removed) boneyard tap. | |
# The version above is the last one before it was removed. | |
class VirtualBoxInstalled < Requirement | |
fatal true | |
def self.app_path | |
[ | |
"/Applications/VirtualBox.app", | |
"#{ENV["HOME"]}/Applications/VirtualBox.app", | |
ENV["VIRTUALBOX_APP"], | |
].find { |dir| dir && File.exist?("#{dir}/Contents/MacOS/VBoxDD.dylib") } | |
end | |
satisfy :build_env => false do | |
self.class.app_path | |
end | |
def message; <<~EOS | |
vdfuse requires VirtualBox to be installed | |
If you installed to a non-standard location, set the VIRTUALBOX_APP environment variable. | |
EOS | |
end | |
end | |
class Vdfuse < Formula | |
desc "Fuse driver to mount VirtualBox compatible disk images" | |
homepage "https://github.com/SophosLabs/vdfuse" | |
head "https://github.com/SophosLabs/vdfuse.git" | |
depends_on "autoconf" => :build | |
depends_on "automake" => :build | |
depends_on "subversion" => :build | |
# depends_on cask: 'osxfuse' # can't depend on cask | |
depends_on VirtualBoxInstalled | |
def install | |
configure_opts = [ | |
"--disable-dependency-tracking", | |
"--disable-silent-rules", | |
"--prefix=#{prefix}", | |
] | |
# fixme: pointer to cask include folder (/usr/local/include/osxfuse ?) | |
# osxfuse = Formula["osxfuse"] | |
# configure_opts << "--with-fuse-headers=#{osxfuse.include}/osxfuse" if osxfuse.installed? | |
inreplace "configure.ac", /VBOX_INSTALL_DIR=.*/, "VBOX_INSTALL_DIR=\"#{VirtualBoxInstalled.app_path}/Contents/MacOS\"" | |
system "./fetch_vbox_headers.sh" | |
system "./autogen.sh" | |
system "./configure", *configure_opts | |
system "make", "install" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment