Building Haiku on Mac OS X 10.6 or 10.7 with Homebrew

Article contributed by jscipione on Tue, 2012-05-08 02:24

The recommended method for building Haiku on Mac OS X is to use MacPorts, but, with a little bit of work it is possible to build Haiku using homebrew on Mac OS X 10.6 or 10.7 instead. You'll need to install Xcode or at least the Command Line Tools before installing homebrew.

If you don't want to install all of XCode you can install just gcc from the packages available here:

https://github.com/kennethreitz/osx-gcc-installer

Once you've installed gcc and homebrew installing most of the required software can be done with this command:

brew install autoconf automake gawk gnu-sed yasm wget libjpg

Optionally you can install cdrtools to build iso images with this command:

brew install cdrtools

There are a few formulas required by Haiku that are not included in homebrew including flex, bison, and gnu-regex. I have created formulas for these missing pieces of software.

bison:

require 'formula'
 
class Bison < Formula
  url 'http://mirrors.xmission.com/gnu/bison/bison-2.5.tar.gz'
  homepage 'http://www.gnu.org/software/bison/manual/'
  md5 '687e1dcd29452789d34eaeea4c25abe4'
  version '2.5'
 
  def install
    system "./configure", "--disable-debug", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make install"
  end
 
  def test
    system "bison --version"
  end
end

flex:

require 'formula'
 
class Flex < Formula
  url 'http://sourceforge.net/projects/flex/files/flex/flex-2.5.35/flex-2.5.35.tar.gz'
  homepage 'http://flex.sourceforge.net'
  md5 '201d3f38758d95436cbc64903386de0b'
  version '2.5.35'
 
  def install
    system "./configure", "--disable-debug", "--disable-dependency-tracking",
                          "--prefix=#{prefix}", "--mandir=#{man}", "--infodir=#{info}"
    system "make install"
  end
 
  def test
    system "flex --version"
  end
end

gnu-regex:

require 'formula'
 
class GnuRegex < Formula
  homepage 'http://ftp.gnu.org/old-gnu/regex/'
  url 'http://ftp.gnu.org/old-gnu/regex/regex-0.12.tar.gz'
  sha256 'f36e2d8d56bf15054a850128fcb2f51807706a92d3bb4b37ceadd731535ce230'
 
  def install
    system "./configure"
    system "make subdirs=test all"
    system "mkdir -p #{prefix}/lib"
    system "libtool -lSystem -dynamic -install_name #{prefix}/lib/libgnuregex.dylib -o #{prefix}/lib/libgnuregex.dylib regex.o"
    system