Skip to content

Commit

Permalink
Merge pull request #170385 from Homebrew/slashem_sonoma
Browse files Browse the repository at this point in the history
slashem: add test and patch for sonoma
  • Loading branch information
p-linnane authored Apr 30, 2024
2 parents 09acb1d + 98180c4 commit 2e82720
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Formula/s/slashem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,13 +32,20 @@ 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"

# 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
Expand All @@ -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 <sys/ioctl.h>"

system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
Expand All @@ -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__
Expand Down

0 comments on commit 2e82720

Please sign in to comment.