Last active
August 29, 2015 14:08
-
-
Save cbeck88/f5898a5cbdfe99a8d427 to your computer and use it in GitHub Desktop.
new homebrew script for wesnoth, should work for os x and linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class WesnothNew < Formula | |
homepage 'http://www.wesnoth.org/' | |
url 'https://downloads.sourceforge.net/project/wesnoth/wesnoth-1.10/wesnoth-1.10.7/wesnoth-1.10.7.tar.bz2' | |
sha1 '86e329585244c377a1863f64dd534bc7bbcc7acf' | |
head 'https://github.com/wesnoth/wesnoth.git' | |
devel do | |
url 'https://downloads.sourceforge.net/project/wesnoth/wesnoth/wesnoth-1.11.19/wesnoth-1.11.19.tar.bz2' | |
sha1 '1f98b1043525d4721e39f51add9af0abf08d2904' | |
end | |
option "with-debug", "build with debugging symbols" | |
option "build-os-x-bundle", "build an OS X bundle and place it in home directory" | |
depends_on 'scons' => :build | |
depends_on 'gettext' #This is only needed to generate translation catalogues at compile time (MSGFMT), and for wesnoth 1.10. In 1.12+ we use boost locale for actual runtime translations, as libintl does not support unicode in filepaths when used with mingw32 compiler | |
depends_on 'fribidi' | |
depends_on 'boost' | |
depends_on 'libpng' #This gets linked to wesnoth binary, when saving screenshots as png | |
depends_on 'fontconfig' | |
depends_on 'cairo' | |
depends_on 'pango' | |
if OS.linux? | |
# On linux, x11 driver is needed or the clipboard code doesn't work, images don't load | |
depends_on 'sdl' => 'with-x11-driver' | |
else | |
depends_on 'sdl' | |
end | |
# The images are pngs. Must depend on libpng before this line, because sdl_image must have support for png. On linux, it must link with brew libpng and not system libpng | |
depends_on 'sdl_image' | |
# The music is in .ogg format | |
# We must link libvorbis and sdl_mixer with wesnoth binary | |
depends_on 'libvorbis' | |
depends_on 'sdl_mixer' => 'with-libvorbis' | |
depends_on 'sdl_net' | |
depends_on 'sdl_ttf' | |
depends_on 'ccache' => :optional | |
option "with-ccache", "speeds recompilation, convenient for beta testers" | |
def install | |
gettext = Formula["gettext"].opt_prefix | |
args = %W[prefix=#{prefix} docdir=#{doc} mandir=#{man} fifodir=#{var}/run/wesnothd] | |
args << "gettextdir=#{gettext}" unless OS.linux? #use system-installed gettext on linux, the gettext package seems broken on linux and doesn't provide libintl.h | |
args << "install" | |
args << "wesnoth" | |
args << "wesnothd" | |
args << "-j#{ENV.make_jobs}" | |
args << "ccache=true" if build.with? "ccache" | |
args << "build=debug" if build.with? "debug" | |
scons *args | |
if build.include? "build-os-x-bundle" | |
scons "wesnoth-bundle" | |
etc.install "Battle For Wesnoth.app" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment