capstone: fix head build (#27959)

This commit is contained in:
Stephen 2018-05-24 05:50:25 -07:00 committed by FX Coudert
parent de472c9c80
commit 63cdeed28d

View file

@ -15,20 +15,28 @@ class Capstone < Formula
sha256 "585042b1452fbeda9efd07da4b8400d56d166afd5e5f1120da20975e41001e88" => :mountain_lion
end
depends_on "pkg-config" => :build if build.head?
def install
# Capstone's Make script ignores the prefix env and was installing
# in /usr/local directly. So just inreplace the prefix for less pain.
# https://github.com/aquynh/capstone/issues/228
inreplace "make.sh", "export PREFIX=/usr/local", "export PREFIX=#{prefix}"
if build.head?
ENV["PREFIX"] = prefix
else
# Capstone's Make script ignores the prefix env and was installing
# in /usr/local directly. So just inreplace the prefix for less pain.
# https://github.com/aquynh/capstone/issues/228
inreplace "make.sh", "export PREFIX=/usr/local", "export PREFIX=#{prefix}"
end
ENV["HOMEBREW_CAPSTONE"] = "1"
system "./make.sh"
system "./make.sh", "install"
# As per the above inreplace, the pkgconfig file needs fixing as well.
inreplace lib/"pkgconfig/capstone.pc" do |s|
s.gsub! "/usr/lib", lib
s.gsub! "/usr/include/capstone", "#{include}/capstone"
unless build.head?
# As per the above inreplace, the pkgconfig file needs fixing as well.
inreplace lib/"pkgconfig/capstone.pc" do |s|
s.gsub! "/usr/lib", lib
s.gsub! "/usr/include/capstone", "#{include}/capstone"
end
end
end