sb.sh 736 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/bash

# check if script is being run
# or if it's being sourced.
(return 2>/dev/null) && sourced=1 || sourced=0

if (( sourced == 0 ));then
    WORKDIR=$(dirname "$(readlink -f "$0")")
else
10
    WORKDIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
fi

export PATH="${WORKDIR}"/bin:$PATH
TEXT_CONF=$(mktemp)
BINARY_CONF=$(mktemp)
CONFIG="dll \".so\"
module \"${WORKDIR}/module/\"
include \"${WORKDIR}/include/\"
maxstep 0
maxlocalstep 0
maxlevel 29666
maxmem 0
"
echo "$CONFIG" > "${TEXT_CONF}"
scriba -f ${BINARY_CONF} -k ${TEXT_CONF} 2>/dev/null
export SCRIBACONF="${BINARY_CONF}"

if (( sourced == 0 )); then
    scriba $@
    [[ -e "${TEXT_CONF}" ]] && rm "${TEXT_CONF}"
    [[ -e "${BINARY_CONF}" ]] && rm "${BINARY_CONF}"
fi