Skip to content

Instantly share code, notes, and snippets.

@jdmartin
Forked from ctdk/bsdgames-osx.rb
Last active April 30, 2023 04:12
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jdmartin/24807e561fe8f90eca256f4e3b92c7fa to your computer and use it in GitHub Desktop.
Save jdmartin/24807e561fe8f90eca256f4e3b92c7fa to your computer and use it in GitHub Desktop.
A homebrew formula for installing bsdgames-osx (updated for macOS Sierra). For now, just plunk it into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bsdgames-osx.rb (or, put it in ~/.homebrew/Library/Formula/ and specify this path when installing) and run "brew install bsdgames-osx". Tested successfully with MacOS X 10.12.3.
require 'formula'
class BsdgamesOsx < Formula
desc 'The classic bsdgames of yore for Mac OS X and macOS.'
homepage 'https://github.com/ctdk/bsdgames-osx'
url 'https://github.com/ctdk/bsdgames-osx/archive/bsdgames-osx-2.19.3.tar.gz'
sha256 '699bb294f2c431b9729320f73c7fcd9dcf4226216c15137bb81f7da157bed2a9'
head 'https://github.com/ctdk/bsdgames-osx.git'
version '2.19.3'
depends_on "bsdmake" => ':build'
def install
ENV.deparallelize
# This replicates the behavior of wargames calling games from /usr/games
inreplace 'wargames/wargames.sh' do |s|
s.gsub! /\/usr\/games/, "#{prefix}/bin"
end
system "CFLAGS=\"-std=c11\" bsdmake PREFIX=#{prefix} VARDIR=#{HOMEBREW_PREFIX}/var/games"
user = ENV['USER']
system "BINOWN=#{user} LIBOWN=#{user} MANOWN=#{user} SHAREOWN=#{user} bsdmake install PREFIX=#{prefix} VARDIR=#{HOMEBREW_PREFIX}/var/games"
end
def test
%w[ pom ].each do |game|
system game
end
end
end
@jdmartin
Copy link
Author

jdmartin commented Feb 22, 2017

I know that the path looks terrible, but I found that brew won't see the formula if I put it in the more sensible ~/.homebrew/Library/Formula (unless I use 'brew install ~/.homebrew/Library/Formula/bsdgames-osx.rb' which is suboptimal). I'm sure there's a cooler way... Advice on this point is definitely welcome!

@ryanfantus
Copy link

I had to add -Wno-nullability-completeness to CFLAGS. Additionally the bsdmake install portion wouldn't work for me unless I did it manually with sudo.

Copy link

ghost commented Jun 11, 2018

It worked perfectly on High Sierra 10.13.5. Thanks!

@manawesome326
Copy link

Worked first try on high sierra, truly incredible.

@languidyouth
Copy link

Woo-hoo! rain, worm, wump, trek...excellent! Thanks for doing this!

Installed without a hitch on macOS Mojave 10.14.2.

@mlozier
Copy link

mlozier commented May 1, 2019

Installed without issue for me on Mojave! I had issues getting other formulas to work. The worm game does seem unstable. I haven't been able to test the other games just yet. But thank you very much for providing this!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment