Skip to content

Instantly share code, notes, and snippets.

@ymmtmdk
Created June 13, 2015 10:55
Show Gist options
  • Save ymmtmdk/5b15f2b06aef5549eb5a to your computer and use it in GitHub Desktop.
Save ymmtmdk/5b15f2b06aef5549eb5a to your computer and use it in GitHub Desktop.
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# /usr/local/Library/Contributions/example-formula.rb
class Libsge < Formula
desc 'An add-on graphics library for the Simple Direct Media Layer'
homepage 'https://github.com/flibitijibibo/libSGE/'
url 'git://github.com/flibitijibibo/libSGE.git', revision: '1085c4958397b91a42c399bc389e8fddde8f207b'
version '1085c49'
depends_on 'sdl'
def install
args = %W(
PREFIX=#{prefix}
PREFIX_H=#{prefix}/include/SDL
)
system 'make', 'install', *args
end
test do
(testpath / 'test.c').write <<-EOS.undent
#include "sge.h"
int main() {
sge_Random(1,10);
return 0;
}
EOS
system "#{ENV.cc} test.c `sdl-config --cflags --libs` -lsge -otest"
system './test'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment