1#!/bin/sh 2 3MAKE_JOBS=8 4[ -z "${PREFIX}" ] && PREFIX=/usr 5 6case "$1" in 7-h) 8 echo "Usage: sys/build.sh [/usr]" 9 exit 0 10 ;; 11'') 12 : 13 ;; 14*) 15 PREFIX="$1" 16 ;; 17esac 18 19[ ! "${PREFIX}" = /usr ] && \ 20 CFGARG=--with-rpath 21 22if [ -z "${MAKE}" ]; then 23 MAKE=make 24 gmake --help >/dev/null 2>&1 25 [ $? = 0 ] && MAKE=gmake 26fi 27 28# find root 29cd `dirname $PWD/$0` ; cd .. 30 31ccache --help > /dev/null 2>&1 32if [ $? = 0 ]; then 33 [ -z "${CC}" ] && CC=gcc 34 CC="ccache ${CC}" 35 export CC 36fi 37 38# build 39echo "Cleaning up the whole thing..." 40${MAKE} mrproper > /dev/null 2>&1 41[ "`uname`" = Linux ] && export LDFLAGS="-Wl,--as-needed" 42rm -f plugins.cfg 43# STATIC BUILD 44CFLAGS="${CFLAGS} -m32" 45export CFLAGS 46 47./configure ${CFGARG} --prefix=${PREFIX} || exit 1 48exec ${MAKE} -s -j ${MAKE_JOBS} 49