homebrew-core/Formula/lwtools.rb

35 lines
983 B
Ruby
Raw Normal View History

require "formula"
class Lwtools < Formula
homepage "http://lwtools.projects.l-w.ca/"
url "http://lwtools.projects.l-w.ca/releases/lwtools/lwtools-4.9.tar.gz"
sha1 "a9191d9f7a2148757526f8f14166f483feb3e560"
def install
system "make"
system "make", "install", "INSTALLDIR=#{bin}"
end
test do
# lwasm
(testpath/"foo.asm").write " SECTION foo\n stb $1234,x\n"
system "#{bin}/lwasm", "--obj", "--output=foo.obj", "foo.asm"
# lwlink
system "#{bin}/lwlink", "--format=raw", "--output=foo.bin", "foo.obj"
code = File.open("foo.bin", "rb") { |f| f.read.unpack("C*") }
assert_equal [0xe7, 0x89, 0x12, 0x34], code
# lwobjdump
dump = `#{bin}/lwobjdump foo.obj`
assert_equal 0, $?.exitstatus
assert dump.start_with?("SECTION foo")
# lwar
system "#{bin}/lwar", "--create", "foo.lwa", "foo.obj"
list = `#{bin}/lwar --list foo.lwa`
assert_equal 0, $?.exitstatus
assert list.start_with?("foo.obj")
end
end