2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-19 17:54:01 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Nasm < Formula
|
2010-04-07 05:58:35 +00:00
|
|
|
homepage 'http://www.nasm.us/'
|
2014-05-12 11:37:22 +00:00
|
|
|
url 'http://www.nasm.us/pub/nasm/releasebuilds/2.11.04/nasm-2.11.04.tar.xz'
|
|
|
|
sha256 '4f07059a080883cd99f58da837a6504f1e0aa2757cbb0bb3064aca24a58da0f7'
|
2011-09-23 20:58:40 +00:00
|
|
|
|
2012-08-12 17:57:47 +00:00
|
|
|
option :universal
|
2009-09-19 17:54:01 +00:00
|
|
|
|
|
|
|
def install
|
2012-08-12 17:57:47 +00:00
|
|
|
ENV.universal_binary if build.universal?
|
2011-09-23 20:58:40 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}"
|
2013-01-05 04:45:18 +00:00
|
|
|
system "make install install_rdf"
|
2009-09-19 17:54:01 +00:00
|
|
|
end
|
2014-02-09 18:41:25 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"foo.s").write <<-EOS
|
|
|
|
mov eax, 0
|
|
|
|
mov ebx, 0
|
|
|
|
int 0x80
|
|
|
|
EOS
|
|
|
|
|
|
|
|
system "#{bin}/nasm", "foo.s"
|
|
|
|
code = File.open("foo", "rb") { |f| f.read.unpack("C*") }
|
|
|
|
expected = [0x66, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x66, 0xbb,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0xcd, 0x80]
|
|
|
|
assert_equal expected, code
|
|
|
|
end
|
2009-09-19 17:54:01 +00:00
|
|
|
end
|