Skip to content

Instantly share code, notes, and snippets.

@robsalasco
Last active June 5, 2018 04:49
Show Gist options
  • Save robsalasco/e183641d2a1b1fcf64d7d60f06ce2b5e to your computer and use it in GitHub Desktop.
Save robsalasco/e183641d2a1b1fcf64d7d60f06ce2b5e to your computer and use it in GitHub Desktop.
class Quake2 < Formula
desc "Quake 2"
homepage "https://github.com/yquake2/yquake2"
head "https://github.com/yquake2/yquake2.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "sdl"
depends_on "libvorbis"
depends_on "openal-soft"
resource "pak0" do
url "http://www.mudder.net/jayna/Public/quake2/baseq2/pak0.pak"
end
resource "pak1" do
url "http://www.mudder.net/jayna/Public/quake2/baseq2/pak1.pak"
end
resource "pak2" do
url "http://www.mudder.net/jayna/Public/quake2/baseq2/pak2.pak"
end
resource "aq2" do
url "https://github.com/aq2-tng/aq2-tng/archive/master.zip"
end
resource "data" do
url "http://146.155.17.14:17080/~rsalas/action.zip"
end
def startup_script; <<~EOS
#!/bin/bash
#{libexec}/quake2-bin +set basedir "#{pkgshare}" "$@"
EOS
end
def dedicated_script; <<~EOS
#!/bin/bash
#{libexec}/q2ded-bin +set basedir "#{pkgshare}" "$@"
EOS
end
def aq2_script; <<~EOS
#!/bin/bash
#{libexec}/quake2-bin +set basedir "#{pkgshare}" +set game action "$@"
EOS
end
def install
system "make"
libexec.install "release/q2ded" => "q2ded-bin"
libexec.install "release/quake2" => "quake2-bin"
libexec.install "release/ref_gl1.dylib" => "ref_gl1.dylib"
libexec.install "release/ref_gl3.dylib" => "ref_gl3.dylib"
libexec.install "release/ref_soft.dylib" => "ref_soft.dylib"
pkgshare.install Dir["release/baseq2"]
(bin/"q2ded").write dedicated_script
(bin/"quake2").write startup_script
(bin/"aq2").write aq2_script
(pkgshare/"action").install resource("data")
resources[0..2].each { |r| (pkgshare/"baseq2").install r }
resource("aq2").stage do
pkgshare.install Dir["action"]
cd "source" do
system "make"
(pkgshare/"action").install "gamex86_64.so" => "game.dylib"
end
end
end
def caveats; <<~EOS
Game settings and saves will be written to the ~/.yq2 folder.
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment