Skip to content

Instantly share code, notes, and snippets.

@serras
Last active October 10, 2015 21:48
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 serras/3755713 to your computer and use it in GitHub Desktop.
Save serras/3755713 to your computer and use it in GitHub Desktop.
Install Ciao and Purrs on Mac OS X 1.7

Preparing the environment

To install everything in an automated fashion, we will use Homebrew, which is a package manager for Mac OS X:

  • Go to Apple Developers Page (you may need to register),
  • Download the XCode Command Line Tools and XQuartz and install them,
  • Open a terminal,
  • Execute ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go).

Now you have Homebrew installed. Everything installed with this tool will go to /usr/local.

Installing GCC

Ciao doesn't like the GCC that comes with XCode 4.4. So you need to recompile GCC: doing so is as easy as following these steps in a terminal:

> brew install gmp mpfr libmpc
> brew install https://gist.github.com/raw/3755872/46e2aeb881063053d9bd560376334c2e972a065e/gcc.rb --enable-cxx --enable-fortran --enable-nls

The installed GCC will go to /usr/local/bin/gcc-4.x (the x will depend on your version, in my case it is 4.7).

Modifying Homebrew to use the new GCC

You need Homebrew to build the rest of the elements using this new GCC instead of the system one. To do so go to file /usr/local/Library/Homebrew/superenv.rb in your system, and modify lines 44 and 45 to make them read

    ENV['CC'] = ENV['LD'] = '/usr/local/bin/gcc-4.7'
    ENV['CXX'] = '/usr/local/bin/g++-4.7'

where you may have to change the version of GCC from 4.7 to other one.

Installing Ciao

Now just run Ciao setup in your machine passing the new GCC as compiler and linker:

./ciaosetup user-install --cc=/usr/local/bin/gcc-4.7 --ld=/usr/local/bin/gcc-4.7

Installing PPL

Run the following command to get a Ciao-enabled PPL:

brew install https://gist.github.com/serras/5402806/raw/b8f0c21c347af491ee2d7bacf3f00fc14d8e8f6a/ppl.rb

If this doesn't work, you may need to install it by hand:

  • Download PPL from http://bugseng.com/products/ppl/download
  • Unpack it anywhere
  • Change line 46 of m4/ac_check_ciao.m4 to format("~p/../build/include/~p~p", [[Lib_Dir, Os, Arch]]).
  • Make the same change in line 11938 of configure
  • Open a terminal and change to the directory
  • Run brew sh: a new Homebrew session will open
  • Run ./configure --prefix=/usr/local/Cellar/ppl/1.0 --enable-optimization=sspeed --enable-interfaces=all
  • Run make install

Installing Purrs

We have created a file for automatically installing Purrs using Homebrew, which downloads the code, applies some patches and installs the rrs_driver tool. However, you need to follow some steps until you reach that point:

  • brew install --build-from-source pkg-config
  • brew install --build-from-source gettext
  • brew link gettext
  • brew install https://gist.github.com/raw/3755664/e153a5417699e5c5a43d4c247ff24c2b613ef521/purrs.rb

And you will find rrs_driver in your system, along with all the libraries :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment