#!/bin/bash
[% c("var/set_default_env") -%]
distdir=/var/tmp/dist/[% project %]
mkdir -p /var/tmp/dist
tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
export PATH="/var/tmp/dist/clang/bin:$PATH"
mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
cd /var/tmp/build/[% project %]-[% c('version') %]/cctools

export CC=clang
export CXX=clang++
./autogen.sh
./configure --prefix=$distdir --target=x86_64-apple-darwin11 --with-llvm-config=llvm-config
export LDFLAGS=-lpthread

make -j[% c("buildconf/num_procs") %] install

cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]

