homebrew-core/Formula/mesalib-glw.rb
Fernando Mut d692c10848 New Formula: MesaLib-GLw
Installation of the GLw library compiled against the OS X version of
OpenGL libraries. Version 7.2 is considered by many (e.g. Fink, Ubuntu)
to be the stable version of MesaLib. GLw is not provided with OS X.
By default, MesaLib first compiles GL(mesa) and then GLw against it.
This forces that any application compiled against GLw will also need
to be linked with GL(mesa), not the native OS X version of OpenGL,
since otherwise you get a version incompatibility error.
In order to avoid having a duplicated version of the OpenGL library,
and also to take advantage of any hardware acceleration that the OS X
OpenGL version could provide, it is best to compile the GLw library
against the provided OS X OpenGL library. For this purpose, some
modifications to the autoconf setting file and the GLw Makefile
were performed. In particular, the inclusion of the OS X OpenGL header
files (located in /usr/X11/include/GL) instead of the header files
provided with the mesalib package, and the linkage against the OS X
OpenGL libraries (located in /usr/X11/lib). The compilation of the
GL(mesa) libraries was also removed from the autoconf settings file.
The installation of the package files is performed manually since the
'make install' fails due to a bad detection of symbolic links.

Closes Homebrew/homebrew#6074.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-04-22 17:59:58 -07:00

44 lines
1 KiB
Ruby

require 'formula'
class MesalibGlw < Formula
url 'http://downloads.sourceforge.net/project/mesa3d/MesaLib/7.2/MesaLib-7.2.tar.gz'
homepage 'http://www.mesa3d.org'
md5 '81a2a4b7cbfce7553f7ad8d924edbe2f'
def options
[
['--enable-static', "build static library"]
]
end
def install
args = ["--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"]
args << "--with-driver=xlib"
args << "--disable-gl-osmesa"
args << "--disable-glu"
args << "--disable-glut"
if ARGV.include? '--enable-static'
args << "--enable-static"
end
system "./configure", *args
inreplace 'configs/autoconf' do |s|
s.gsub! /.so/, '.dylib'
s.gsub! /SRC_DIRS = mesa glw/, 'SRC_DIRS = glw'
s.gsub! /-L\$\(TOP\)\/\$\(LIB_DIR\)/, '-L/usr/X11/lib'
end
inreplace 'src/glw/Makefile' do |s|
s.gsub! /-I\$\(TOP\)\/include /, ''
end
system "make"
(include+'GL').mkpath
(include+'GL').install Dir['src/glw/*.h']
lib.install Dir['lib/*']
end
end