Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
require 'formula'
class BsdgamesOsx < Formula
homepage 'https://github.com/ctdk/bsdgames-osx'
url 'https://github.com/ctdk/bsdgames-osx/archive/bsdgames-osx-2.19.3.tar.gz'
sha1 '31013cbc8fbad71f1e3e0b9b85fd7c943219a99b'
head 'https://github.com/ctdk/bsdgames-osx.git'
version '2.19.3'
depends_on :bsdmake => :build
def install
ENV.j1
# 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

Thank you! A note: if you have the fish shell installed, you'll be unable to link bsdgames. Run brew unlink fish, then brew link bsdgames-osx to link the games. brew link --overwrite fish will get you the shell back, then you can go ahead and link /usr/local/Cellar/bsdgames-osx/2.19.3/bin/fish to somewhere under your path, calling it something that won't conflict.

ctdk commented May 10, 2015

Thanks for updating this formula.

sukima commented May 13, 2015

Any chance we could add this to https://github.com/Homebrew/homebrew-games ?

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