2017-06-28 15:00:44 +00:00
|
|
|
class Dwarf < Formula
|
|
|
|
desc "Object file manipulation tool"
|
|
|
|
homepage "https://github.com/elboza/dwarf-ng/"
|
2017-09-28 04:18:03 +00:00
|
|
|
url "https://github.com/elboza/dwarf-ng/archive/dwarf-0.4.0.tar.gz"
|
|
|
|
sha256 "a64656f53ded5166041ae25cc4b1ad9ab5046a5c4d4c05b727447e73c0d83da0"
|
2017-06-28 15:00:44 +00:00
|
|
|
|
2017-06-28 15:13:52 +00:00
|
|
|
bottle do
|
2017-09-28 08:27:25 +00:00
|
|
|
sha256 "47af5ca1f6349c0d8c49f1ef72cbed7fbaa6e91c263c8a284afd841e8ced56f9" => :high_sierra
|
|
|
|
sha256 "69a1b11620f73e519cf6abade5a23e478a4c7c44cd4fbc9996b05c464c53e8d7" => :sierra
|
|
|
|
sha256 "042c140300ff583047ec5f51e3877b4ecf22a3c25a6108c11ae067b9e525d05b" => :el_capitan
|
2017-06-28 15:13:52 +00:00
|
|
|
end
|
|
|
|
|
2017-06-28 15:00:44 +00:00
|
|
|
depends_on "flex"
|
|
|
|
depends_on "readline"
|
|
|
|
|
|
|
|
def install
|
|
|
|
%w[src/libdwarf.c doc/dwarf.man doc/xdwarf.man.html].each do |f|
|
|
|
|
inreplace f, "/etc/dwarfrc", etc/"dwarfrc"
|
|
|
|
end
|
|
|
|
|
|
|
|
system "make"
|
|
|
|
system "make", "install", "BINDIR=#{bin}", "MANDIR=#{man1}"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2017-10-18 10:10:48 +00:00
|
|
|
(testpath/"test.c").write <<~EOS
|
2017-06-28 15:00:44 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
printf("hello world\\n");
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "test.c", "-o", "test"
|
2017-09-28 04:18:03 +00:00
|
|
|
output = shell_output("#{bin}/dwarf -c 'pp $mac' test")
|
|
|
|
assert_equal "magic: 0xfeedfacf (-17958193)", output.lines[0].chomp
|
2017-06-28 15:00:44 +00:00
|
|
|
end
|
|
|
|
end
|