homebrew-core/Formula/libxmp.rb
2016-06-20 09:50:47 -07:00

61 lines
2 KiB
Ruby

class Libxmp < Formula
desc "C library for playback of module music (MOD, S3M, IT, etc)"
homepage "http://xmp.sourceforge.net"
url "https://downloads.sourceforge.net/project/xmp/libxmp/4.3.13/libxmp-4.3.13.tar.gz"
sha256 "57a31e623dac12ad168fbd46cf1e0aeda93512ed52812665018b21d0e71633b9"
bottle do
cellar :any
sha256 "114e68051104a51904503c98e13baaa5a834474299b09911dc4573841d236704" => :el_capitan
sha256 "7785480aeaae170c2f460b2da5eebf2626a1cd329c0b509f363601b9539f1886" => :yosemite
sha256 "3d806f5356a8db97ead608f5967d2a78926106036dba4f03e511521d58dbd15e" => :mavericks
end
head do
url "git://git.code.sf.net/p/xmp/libxmp"
depends_on "autoconf" => :build
end
# CC BY-NC-ND licensed set of five mods by Keith Baylis/Vim! for testing purposes
# Mods from Mod Soul Brother: https://web.archive.org/web/20120215215707/http://www.mono211.com/modsoulbrother/vim.html
resource "demo_mods" do
url "https://files.scene.org/get:us-http/mirrors/modsoulbrother/vim/vim-best-of.zip"
sha256 "df8fca29ba116b10485ad4908cea518e0f688850b2117b75355ed1f1db31f580"
end
def install
system "autoconf" if build.head?
system "./configure", "--prefix=#{prefix}"
system "make", "install"
pkgshare.install resource("demo_mods")
end
test do
test_mod = "#{pkgshare}/give-me-an-om.mod"
(testpath/"libxmp_test.c").write <<-EOS.undent
#include <stdio.h>
#include "xmp.h"
int main(int argc, char** argv)
{
char* mod = argv[1];
xmp_context context;
struct xmp_module_info mi;
context = xmp_create_context();
if (xmp_load_module(context, mod) != 0) {
puts("libxmp failed to open module!");
return 1;
}
xmp_get_module_info(context, &mi);
puts(mi.mod->name);
return 0;
}
EOS
system ENV.cc, "libxmp_test.c", "-lxmp", "-o", "libxmp_test"
assert_equal "give me an om", shell_output("\"#{testpath}/libxmp_test\" #{test_mod}").chomp
end
end