diff --git a/Formula/s/slashem.rb b/Formula/s/slashem.rb index ce7083d6174f6..7c5d3427ad17b 100644 --- a/Formula/s/slashem.rb +++ b/Formula/s/slashem.rb @@ -6,6 +6,7 @@ class Slashem < Formula url "https://downloads.sourceforge.net/project/slashem/slashem-source/0.0.8E0F1/se008e0f1.tar.gz" version "0.0.8E0F1" sha256 "e9bd3672c866acc5a0d75e245c190c689956319f192cb5d23ea924dd77e426c3" + license "NGPL" livecheck do url :stable @@ -31,6 +32,7 @@ class Slashem < Formula uses_from_macos "bison" => :build uses_from_macos "flex" => :build + uses_from_macos "expect" => :test uses_from_macos "ncurses" skip_clean "slashemdir/save" @@ -38,6 +40,12 @@ class Slashem < Formula # Fixes compilation error in OS X: https://sourceforge.net/p/slashem/bugs/896/ patch :DATA + # https://sourceforge.net/p/slashem/bugs/964/ for C99 compatibility + patch do + url "https://sourceforge.net/p/slashem/bugs/964/attachment/slashem-c99.patch" + sha256 "ef21a6e3c64a5cf5cfe83305df7611aa024384ae52ef6be4242b86d3d38da200" + end + # Fixes user check on older versions of OS X: https://sourceforge.net/p/slashem/bugs/895/ # Fixed upstream: http://slashem.cvs.sourceforge.net/viewvc/slashem/slashem/configure?r1=1.13&r2=1.14&view=patch patch :p0 do @@ -47,6 +55,9 @@ class Slashem < Formula def install ENV.deparallelize + # Fix issue where ioctl is not declared and fails on Sonoma + inreplace "sys/share/ioctl.c", "#include \"hack.h\"", "#include \"hack.h\"\n#include " + system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", @@ -58,6 +69,20 @@ def install man6.install "doc/slashem.6", "doc/recover.6" end + + test do + # Make sure that we don't modify the user's files + cp_r "#{Formula["slashem"].prefix}/slashemdir", testpath/"slashemdir" + # Write an expect script to respond to the game's prompts and quit + (testpath/"slashem.exp").write <<~EOS + spawn -pty #{Formula["slashem"].prefix}/slashemdir/slashem -d #{testpath}/slashemdir + expect "Shall" + send "q" + expect eof + EOS + + system "expect", "slashem.exp" + end end __END__