forked from codedreality/homebrew-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pygame.rb
55 lines (51 loc) · 2.24 KB
/
pygame.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
class Pygame < Formula
desc "Set of Python modules designed for writing video games"
homepage "http://pygame.org"
url "https://bitbucket.org/pygame/pygame",
:revision => "faa5879a7e6bfe10e4e5c79d04a3d2fb65d74a62",
:using => :hg
version "1.9.2a0"
head "https://bitbucket.org/pygame/pygame", :using => :hg
option "without-python", "Build without python2 support"
depends_on :python3 => :optional
depends_on "sdl"
depends_on "sdl_image"
depends_on "sdl_mixer"
depends_on "sdl_ttf"
depends_on "smpeg"
depends_on "jpeg"
depends_on "libpng"
depends_on "portmidi"
depends_on "homebrew/python/numpy"
depends_on "freetype"
def install
# We provide a "Setup" file based on the "Setup.in" because the detection
# code in config.py does not know about the HOMEBREW_PREFIX, assumes SDL
# is built as a framework and cannot find the Frameworks inside of Xcode.
mv "Setup.in", "Setup"
sdl = Formula["sdl"].opt_prefix
sdl_ttf = Formula["sdl_ttf"].opt_prefix
sdl_image = Formula["sdl_image"].opt_prefix
sdl_mixer = Formula["sdl_mixer"].opt_prefix
smpeg = Formula["smpeg"].opt_prefix
portmidi = Formula["portmidi"].opt_prefix
inreplace "Setup" do |s|
s.gsub!(/^SDL =.*$/, "SDL = -I#{sdl}/include/SDL -Ddarwin -lSDL")
s.gsub!(/^FONT =.*$/, "FONT = -I#{sdl_ttf}/include/SDL -lSDL_ttf")
s.gsub!(/^IMAGE =.*$/, "IMAGE = -I#{sdl_image}/include/SDL -lSDL_image")
s.gsub!(/^MIXER =.*$/, "MIXER = -I#{sdl_mixer}/include/SDL -lSDL_mixer")
s.gsub!(/^SMPEG =.*$/, "SMPEG = -I#{smpeg}/include/smpeg2 -lsmpeg")
s.gsub!(/^PNG =.*$/, "PNG = -lpng")
s.gsub!(/^JPEG =.*$/, "JPEG = -ljpeg")
s.gsub!(/^PORTMIDI =.*$/, "PORTMIDI = -I#{portmidi}/include/ -lportmidi")
s.gsub!(/^PORTTIME =.*$/, "PORTTIME = -I#{portmidi}/include/ -lportmidi")
s.gsub!(/^FREETYPE =.*$/, "FREETYPE = -I#{Formula["freetype"].opt_include}/freetype2 -lfreetype")
end
# Manually append what is the default for PyGame on the Mac
system "cat Setup_Darwin.in >> Setup"
Language::Python.each_python(build) do |python, version|
ENV.prepend_create_path "PYTHONPATH", lib+"python#{version}/site-packages"
system python, *Language::Python.setup_install_args(prefix)
end
end
end