#!/bin/sh # Only root should build xenocara _uid=$(id -u) if [ ${_uid} -ne 0 ]; then echo "Error: Need to be root to build xenocara" 1>&2 exit 1; fi START_TIME=$(date) if [ -e /etc/mk.conf ]; then XSRCDIR=${XSRCDIR:-`make -f /etc/mk.conf -V XSRCDIR`} XOBJDIR=${XOBJDIR:-`make -f /etc/mk.conf -V XOBJDIR`} fi XSRCDIR=${XSRCDIR:=/usr/xenocara} XOBJDIR=${XOBJDIR:=/usr/xobj} NUMCPUS=$(sysctl hw.ncpuonline | sed 's/.*=//') mkdir -p "${XOBJDIR}" cd "${XSRCDIR}" if [ $? -ne 0 ]; then echo "Error: Unable to cd into \"${XSRCDIR}\"" 1>&2 exit 2 fi rm -rf "${XOBJDIR}"/* make bootstrap make obj make build -j ${NUMCPUS} _result=$? END_TIME=$(date) echo "Build started at ${START_TIME}, finished at ${END_TIME}" exit ${_result}