#!/bin/sh
#
# configure/build/install MacPorts in the chroot
#

if [[ -z "$PREFIX" ]]; then
    PREFIX=/opt/local
fi
if [[ -z "$SRC_PREFIX" ]]; then
    SRC_PREFIX=/opt/mports
fi

cd ${SRC_PREFIX}/base
./configure --prefix=${PREFIX} && make -j2 all && make install && make distclean
if [[ $? == 0 ]]; then
   echo "file://${SRC_PREFIX}/dports [default,nosync]" > ${PREFIX}/etc/macports/sources.conf
fi
