buildxenocara.sh 732 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. # Only root should build xenocara
  3. _uid=$(id -u)
  4. if [ ${_uid} -ne 0 ]; then
  5. echo "Error: Need to be root to build xenocara" 1>&2
  6. exit 1;
  7. fi
  8. START_TIME=$(date)
  9. if [ -e /etc/mk.conf ]; then
  10. XSRCDIR=${XSRCDIR:-`make -f /etc/mk.conf -V XSRCDIR`}
  11. XOBJDIR=${XOBJDIR:-`make -f /etc/mk.conf -V XOBJDIR`}
  12. fi
  13. XSRCDIR=${XSRCDIR:=/usr/xenocara}
  14. XOBJDIR=${XOBJDIR:=/usr/xobj}
  15. NUMCPUS=$(sysctl hw.ncpuonline | sed 's/.*=//')
  16. mkdir -p "${XOBJDIR}"
  17. cd "${XSRCDIR}"
  18. if [ $? -ne 0 ]; then
  19. echo "Error: Unable to cd into \"${XSRCDIR}\"" 1>&2
  20. exit 2
  21. fi
  22. rm -rf "${XOBJDIR}"/*
  23. make bootstrap
  24. make obj
  25. make build -j ${NUMCPUS}
  26. _result=$?
  27. END_TIME=$(date)
  28. echo "Build started at ${START_TIME}, finished at ${END_TIME}"
  29. exit ${_result}