Skip to content

Commit

Permalink
get dwarf-fortress runnable: just install and type dwarf-fortress (H…
Browse files Browse the repository at this point in the history
…omebrew#21288)

Also add casks: sdl-framework 1.2.15, sdl-ttf-framework 2.0.11, to support the main cask
  • Loading branch information
brewingcode authored and chizmw committed Jun 15, 2016
1 parent 8e808c4 commit 10dc2be
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
36 changes: 34 additions & 2 deletions Casks/dwarf-fortress.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,42 @@
version '0.43.01'
sha256 '7fe378b7aeee67f10a1f88a2341b8724edbf91795fd928506f01dfb403304d43'

url "http://www.bay12games.com/dwarves/df_#{version.sub(%r{^0+\.}, '').gsub('.', '_')}_osx.tar.bz2"
url "http://www.bay12games.com/dwarves/df_#{version.minor}_#{version.patch}_osx.tar.bz2"
name 'Dwarf Fortress'
homepage 'http://www.bay12games.com/dwarves/'
license :gratis

suite 'df_osx', target: 'Dwarf Fortress'
# shim script (https://github.com/caskroom/homebrew-cask/issues/18809)
shimscript = "#{staged_path}/df_wrapper"
depends_on cask: 'sdl-framework'
depends_on cask: 'sdl-ttf-framework'

binary shimscript, target: 'dwarf-fortress'

preflight do
File.open(shimscript, 'w') do |f|
f.puts '#!/bin/sh'
f.puts "cd '#{staged_path}/df_osx' && ./df \"$@\""
FileUtils.chmod '+x', f
end
end

postflight do
Dir.chdir("#{staged_path}/df_osx/libs") do
{
'SDL' => 'sdl-framework',
'SDL_ttf' => 'sdl-ttf-framework',
}.each do |key, value|
name = "#{key}.framework"
File.rename(name, "#{name}.orig")
File.symlink(Hbc.load(value).staged_path.join(name), name)
end
end
end

uninstall_preflight do
system 'cp', '-r', "#{staged_path}/df_osx/data/save", '/tmp/dwarf-fortress-save/'
end

caveats 'During uninstall, your save data will be copied to /tmp/dwarf-fortress-save'
end
11 changes: 11 additions & 0 deletions Casks/sdl-framework.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cask 'sdl-framework' do
version '1.2.15'
sha256 '49e228446599b1f77af812a6276dd7a3f230f8d7a02d1b7b62bb99a874262834'

url "https://www.libsdl.org/release/SDL-#{version}.dmg"
name 'SDL.framework'
homepage 'https://www.libsdl.org'
license :gpl

stage_only true
end
11 changes: 11 additions & 0 deletions Casks/sdl-ttf-framework.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cask 'sdl-ttf-framework' do
version '2.0.11'
sha256 '8c0c8eab34002dfff6695cec7066bd5e4aa56250b82dd9f5cd272f7e6f530dd4'

url "https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-#{version}.dmg"
name 'SDL_ttf.framework'
homepage 'https://www.libsdl.org'
license :gpl

stage_only true
end

0 comments on commit 10dc2be

Please sign in to comment.