2015-12-18 09:15:28 +08:00
|
|
|
cask 'dwarf-fortress' do
|
2016-07-08 08:18:48 +08:00
|
|
|
version '0.43.05'
|
|
|
|
sha256 'c9614c012c23dcef6197f83d02510d577e1257c5a0de948af5c8f76ae56c5fc8'
|
2014-07-08 17:03:21 +08:00
|
|
|
|
2016-05-29 03:47:12 +08:00
|
|
|
url "http://www.bay12games.com/dwarves/df_#{version.minor}_#{version.patch}_osx.tar.bz2"
|
2015-04-05 13:37:53 +08:00
|
|
|
name 'Dwarf Fortress'
|
2014-07-08 17:03:21 +08:00
|
|
|
homepage 'http://www.bay12games.com/dwarves/'
|
2015-09-10 23:45:05 +08:00
|
|
|
license :gratis
|
2014-09-16 23:25:13 +08:00
|
|
|
|
2016-05-29 03:47:12 +08:00
|
|
|
# shim script (https://github.com/caskroom/homebrew-cask/issues/18809)
|
2016-08-26 22:30:52 +08:00
|
|
|
shimscript = "#{staged_path}/df_osx/df.wrapper.sh"
|
2016-05-29 03:47:12 +08:00
|
|
|
depends_on cask: 'sdl-framework'
|
|
|
|
depends_on cask: 'sdl-ttf-framework'
|
|
|
|
|
|
|
|
binary shimscript, target: 'dwarf-fortress'
|
|
|
|
|
|
|
|
preflight do
|
2016-08-26 22:30:52 +08:00
|
|
|
IO.write shimscript, <<-EOS.undent
|
|
|
|
#!/bin/sh
|
|
|
|
exec '#{staged_path}/df_osx/df' "$@"
|
|
|
|
EOS
|
|
|
|
FileUtils.chmod '+x', shimscript
|
2016-05-29 03:47:12 +08:00
|
|
|
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
|
2016-08-26 22:30:52 +08:00
|
|
|
system 'cp', '-rf', "#{staged_path}/df_osx/data/save", '/tmp/dwarf-fortress-save/'
|
2016-05-29 03:47:12 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
caveats 'During uninstall, your save data will be copied to /tmp/dwarf-fortress-save'
|
2014-07-08 17:03:21 +08:00
|
|
|
end
|