forked from ziz/homebrew-games
-
Notifications
You must be signed in to change notification settings - Fork 0
/
abuse.rb
81 lines (66 loc) · 2.47 KB
/
abuse.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
require 'formula'
class Abuse < Formula
homepage 'http://abuse.zoy.org/'
url 'http://abuse.zoy.org/raw-attachment/wiki/download/abuse-0.8.tar.gz'
head 'svn://svn.zoy.org/abuse/abuse/trunk'
sha1 '12fea968a1494338ad71c6ec24954f3eef56826a'
bottle do
cellar :any
sha1 "4b1251c34a1be43af54c818f5a256ae71447fb88" => :yosemite
sha1 "240f522bbebf0d60612f0244a5808c821b6e28d0" => :mavericks
sha1 "d35d4a43e373ca8af58dfb361637498e179188ca" => :mountain_lion
end
depends_on 'autoconf' => :build
depends_on 'automake' => :build
depends_on 'libtool' => :build
depends_on 'pkg-config' => :build
depends_on 'sdl'
depends_on 'sdl_mixer'
depends_on 'libvorbis'
def startup_script; <<-EOS.undent
#!/bin/bash
#{libexec}/abuse-bin -datadir "#{share}/abuse" "$@"
EOS
end
def install
# Hack to work with newer versions of automake
inreplace "bootstrap", '11 10 9 8 7 6 5', '$(seq -s " " 5 99)'
# Add SDL.m4 to aclocal includes
inreplace "bootstrap",
"aclocal${amvers} ${aclocalflags}",
"aclocal${amvers} ${aclocalflags} -I#{HOMEBREW_PREFIX}/share/aclocal"
# undefined
inreplace 'src/net/fileman.cpp', 'ushort', 'unsigned short'
inreplace 'src/sdlport/setup.cpp', 'UInt8', 'uint8_t'
# Fix autotools obsoletion notice
inreplace 'configure.ac', 'AM_CONFIG_HEADER', 'AC_CONFIG_HEADERS'
# Re-enable OpenGL detection
inreplace 'configure.ac',
"#error\t/* Error so the compile fails on OSX */",
'#include <OpenGL/gl.h>'
system "./bootstrap"
system "./configure", "--disable-dependency-tracking",
"--disable-debug",
"--prefix=#{prefix}",
"--disable-sdltest",
"--with-assetdir=#{share}/abuse",
"--with-sdl-prefix=#{Formula['sdl'].opt_prefix}"
# Use Framework OpenGL, not libGl
%w[ . src src/imlib src/lisp src/net src/sdlport ].each do |p|
inreplace "#{p}/Makefile", '-lGL', '-framework OpenGL'
end
system "make"
bin.install 'src/abuse-tool'
libexec.install 'src/abuse' => 'abuse-bin'
(share+'abuse').install Dir["data/*"] - %w(data/Makefile data/Makefile.am data/Makefile.in)
# Use a startup script to find the game data
(bin+'abuse').write startup_script
end
def caveats; <<-EOS.undent
Game settings and saves will be written to the ~/.abuse folder.
EOS
end
test do
system("#{libexec}/abuse-bin", '--help')
end
end