#!/bin/sh

# Settings

PKG_NAME=mpc
NCORES=`cat /proc/cpuinfo | grep "core\ id" | wc -l`

# Work out the root directory

pushd ../.. > /dev/null
ROOT_DIR=`pwd`
popd > /dev/null

# Change into build dir

BUILD_DIR=$ROOT_DIR/src/$PKG_NAME

echo "Building in $BUILD_DIR"

cd $BUILD_DIR

# Clean up

make distclean

# Configure

./configure --build=x86_64-pc-linux-gnu \
    --prefix=$ROOT_DIR \
    --with-gmp=$ROOT_DIR \
    --with-mpfr=$ROOT_DIR

# Build

make -j$NCORES

# Install

make install

# Finish
