aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libmodplug.rb
diff options
context:
space:
mode:
authorMike Purvis2014-09-25 11:05:44 -0400
committerTim D. Smith2014-09-29 14:59:18 -0700
commitbc027d5c940372f6f35f8edbad7c95b621639da1 (patch)
treefbe4eb37adecc841ab5c07121a40f2ae7eaf0839 /Library/Formula/libmodplug.rb
parent7399c71d68eda950c88598ede4e1ed4536fb4a54 (diff)
downloadhomebrew-bc027d5c940372f6f35f8edbad7c95b621639da1.tar.bz2
libmodplug 0.8.8.5 (new formula)
Diffstat (limited to 'Library/Formula/libmodplug.rb')
-rw-r--r--Library/Formula/libmodplug.rb67
1 files changed, 67 insertions, 0 deletions
diff --git a/Library/Formula/libmodplug.rb b/Library/Formula/libmodplug.rb
new file mode 100644
index 000000000..276eb31de
--- /dev/null
+++ b/Library/Formula/libmodplug.rb
@@ -0,0 +1,67 @@
+require "formula"
+
+class Libmodplug < Formula
+ homepage "http://modplug-xmms.sourceforge.net/"
+ url "https://downloads.sourceforge.net/modplug-xmms/libmodplug/0.8.8.5/libmodplug-0.8.8.5.tar.gz"
+ sha1 "771ee75bb8bfcfe95eae434ed1f3b2c5b63b2cb3"
+
+ def install
+ system "./configure", "--disable-debug",
+ "--disable-dependency-tracking",
+ "--disable-silent-rules",
+ "--prefix=#{prefix}"
+
+ system "make", "install"
+ end
+
+ resource "testmod" do
+ # Most favourited song on modarchive:
+ # http://modarchive.org/index.php?request=view_by_moduleid&query=60395
+ url "http://api.modarchive.org/downloads.php?moduleid=60395#2ND_PM.S3M"
+ sha1 "db0d80984abca47d5442bc4de467f9ccd300f186"
+ end
+
+ test do
+ # First a basic test just that we can link on the library
+ # and call an initialization method.
+ (testpath/'test_null.cpp').write <<-EOS.undent
+ #include "libmodplug/modplug.h"
+ int main() {
+ ModPlugFile* f = ModPlug_Load((void*)0, 0);
+ if (!f) {
+ // Expecting a null pointer, as no data supplied.
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ EOS
+ system ENV.cc, "test_null.cpp", "-lmodplug", "-o", "test_null"
+ system "./test_null"
+
+ # Second, acquire an actual music file from a popular internet
+ # source and attempt to parse it.
+ resource("testmod").stage testpath
+ (testpath/'test_mod.cpp').write <<-EOS.undent
+ #include "libmodplug/modplug.h"
+ #include <fstream>
+ #include <sstream>
+
+ int main() {
+ std::ifstream in("downloads.php");
+ std::stringstream buffer;
+ buffer << in.rdbuf();
+ int length = buffer.tellp();
+ ModPlugFile* f = ModPlug_Load(buffer.str().c_str(), length);
+ if (f) {
+ // Expecting success
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+ EOS
+ system ENV.cc, "test_mod.cpp", "-lmodplug", "-lstdc++", "-o", "test_mod"
+ system "./test_mod"
+ end
+end