homebrew-core/Formula/libspectrum.rb
2020-01-06 23:46:06 +01:00

48 lines
1.5 KiB
Ruby

class Libspectrum < Formula
desc "Support library for ZX Spectrum emulator"
homepage "https://fuse-emulator.sourceforge.io/libspectrum.php"
url "https://downloads.sourceforge.net/project/fuse-emulator/libspectrum/1.4.4/libspectrum-1.4.4.tar.gz"
sha256 "fdfb2b2bad17bcfc98c098deaebf2a9811824b08d525172436d5eb134c9780b1"
revision 1
bottle do
cellar :any
rebuild 1
sha256 "25edb4f26816ec6bfb7f1437c9a17fb2621c1bb81b93a48e22960aabf89d3a1d" => :catalina
sha256 "29b40b473d7db763d376b1ac1949db8887b3d0a08016d84370add76524c0c377" => :mojave
sha256 "b4ee40ecf01a16826994e74d31ca1dbc34baeeee0287908f4e1e4a11365f6b4b" => :high_sierra
end
head do
url "https://svn.code.sf.net/p/fuse-emulator/code/trunk/libspectrum"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "audiofile"
depends_on "glib"
depends_on "libgcrypt"
def install
system "./autogen.sh" if build.head?
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include "libspectrum.h"
#include <assert.h>
int main() {
assert(libspectrum_init() == LIBSPECTRUM_ERROR_NONE);
assert(strcmp(libspectrum_version(), "#{version}") == 0);
return 0;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lspectrum", "-o", "test"
system "./test"
end
end