Last active
July 21, 2018 18:53
-
-
Save andreineculau/6629a88888aa11cf3c7a6e7b7ce9b027 to your computer and use it in GitHub Desktop.
Fix homebrew lsof.rb
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
class LsofDownloadStrategy < CurlDownloadStrategy | |
def stage | |
super | |
safe_system "/usr/bin/tar", "xf", "#{name}_#{version}_src.tar" | |
cd "#{name}_#{version}_src" | |
end | |
end | |
class Lsof < Formula | |
desc "Utility to list open files" | |
homepage "https://people.freebsd.org/~abe/" | |
url "https://mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/old/lsof_4.89.tar.gz", | |
:using => LsofDownloadStrategy | |
sha256 "5d08da7ebe049c9d9a6472d6afb81aa5af54c4733a3f8822cbc22b57867633c9" | |
bottle do | |
cellar :any_skip_relocation | |
sha256 "553ae69481b898fa1125b5d9d97c51cf49c4c31f11e1fe5d33a86c415a845e8d" => :high_sierra | |
sha256 "2312dceb501fa6d9301fa506370784456937404ac43381354457ce63d99ccd56" => :sierra | |
sha256 "fb14a3aef899327098b92d6d2c283e8978fc34d55b42019b8a54338abe8d4853" => :el_capitan | |
sha256 "8a63b65f74b992e4a70ac3e18a7e4b810a73e183b13086b40f30286256e646e0" => :yosemite | |
end | |
patch do | |
url "https://raw.githubusercontent.com/Homebrew/formula-patches/c3acbb8/lsof/lsof-489-darwin-compile-fix.patch" | |
sha256 "997d8c147070987350fc12078ce83cd6e9e159f757944879d7e4da374c030755" | |
end | |
def install | |
ENV["LSOF_INCLUDE"] = "#{MacOS.sdk_path}/usr/include" | |
# Source hardcodes full header paths at /usr/include | |
inreplace %w[ | |
dialects/darwin/kmem/dlsof.h | |
dialects/darwin/kmem/machine.h | |
dialects/darwin/libproc/machine.h | |
], "/usr/include", "#{MacOS.sdk_path}/usr/include" | |
mv "00README", "README" | |
system "./Configure", "-n", `uname -s`.chomp.downcase | |
system "make" | |
bin.install "lsof" | |
man8.install "lsof.8" | |
end | |
test do | |
(testpath/"test").open("w") do | |
system "#{bin}/lsof", testpath/"test" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment