Skip to content

Instantly share code, notes, and snippets.

@ryjen
Forked from juniorz/sfml.rb
Last active December 30, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryjen/7829485 to your computer and use it in GitHub Desktop.
Save ryjen/7829485 to your computer and use it in GitHub Desktop.
require 'formula'
class Sfml < Formula
homepage 'http://www.sfml-dev.org'
version '2.1'
url 'https://github.com/LaurentGomila/SFML/archive/2.1.zip'
sha1 'ff345985a301bbee350b1193f48f712acc656fc6'
head 'https://github.com/LaurentGomila/SFML/archive/master.zip'
depends_on 'cmake' => :build
depends_on 'freetype' => :build
depends_on 'jpeg' => :build
depends_on 'glew' => :build
depends_on 'libsndfile' => :build
# libsndfile depends on them (it is all or none)
# flac, libogg, libvorbis
option :universal
option :static, 'Build Static Libraries'
option :framework, 'Build Framework'
option :xcode, 'Install XCode 4 Templates (requires sudo to install)'
option 'build-examples', 'Build Examples'
def install
ENV.universal_binary if build.include? 'universal'
args = std_cmake_args
args.delete '-DCMAKE_BUILD_TYPE=None'
args.push '-DCMAKE_BUILD_TYPE=Release', '-DINSTALL_EXTERNAL_LIBS=FALSE'
args << '-DBUILD_SHARED_LIBS=FALSE' if build.include? 'static'
args << '-DSFML_INSTALL_XCODE4_TEMPLATES=FALSE' if build.include? 'xcode'
args << '-DSFML_BUILD_EXAMPLES=TRUE' if build.include? 'build-examples'
if build.include? 'framework'
args.push '-DSFML_BUILD_FRAMEWORKS=TRUE', "-DCMAKE_INSTALL_FRAMEWORK_PREFIX=#{prefix}/Frameworks"
end
system 'cmake', '.', *args
system 'make install'
end
def caveats
msg = ""
msg = <<-EOS.undent
The CMake find-module is available at #{opt_prefix}/share/sfml/cmake/Modules/FindSFML.cmake
You may need to copy it to #{HOMEBREW_PREFIX}/share/cmake/Modules
EOS
msg.concat framework_caveats if build.include? 'framework'
msg.concat examples_caveats if build.include? 'build-examples'
msg
end
private
def framework_caveats; <<-EOS.undent
SFML.framework was installed to:
#{opt_prefix}/Frameworks/SFML.framework
To use this Framework with IDEs it must be linked
to the standard OS X location:
sudo ln -s #{opt_prefix}/Frameworks/SFML.framework /Library/Frameworks
EOS
end
def examples_caveats; <<-EOS.undent
The examples were installed to:
#{opt_prefix}/share/sfml/examples
EOS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment