radare2/r2-bindings/configure-langs
2012-06-13 18:15:28 +02:00

78 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
#
# Script to choose which langs you want to build
# author: pancake // nopcode
# update: 2012-07-13
#
LANGS=""
help () {
echo "Usage: ./configure-langs [options]"
echo " --enable=python,perl,php5"
echo " --disable=java,ruby"
echo " --list"
echo "Filter out supported.langs"
}
ENABLE=""
DISABLE=""
enable() {
if [ -n "${DISABLE}" ]; then
echo "Cannot use --enable and --disable"
exit 1
fi
ENABLE="`echo $1 | sed -e 's/:/ /g'`"
DISABLE=""
}
disable() {
if [ -n "${ENABLE}" ]; then
echo "Cannot use --enable and --disable"
exit 1
fi
ENABLE=""
DISABLE="`echo $1 | sed -e 's/:/ /g'`"
}
MODE=""
DONOTHING=0
while : ; do
[ -z "$1" ] && break
k=$(echo $1 | cut -d = -f 1)
v=$(echo $1 | cut -d = -f 2)
case "$k" in
"--enable") enable "$v" ; ;;
"--disable") disable "$v" ; ;;
"--list") cat supported.langs ; exit 0 ; ;;
"-h"|"--help") help ; exit 0 ; ;;
esac
shift
done
root=`dirname -- $0`
sh $root/check-langs.sh
if [ -n "${ENABLE}" ]; then
mv supported.langs .sl
cat .sl | grep -e `echo ${ENABLE} | sed -e 's/,/ -e/g'` > supported.langs
rm -f .sl
fi
if [ -n "${DISABLE}" ]; then
mv supported.langs .sl
cat .sl | grep -v -e `echo ${DISABLE} | sed -e 's/,/ -e/g'` > supported.langs
rm -f .sl
fi
mv supported.langs .sl
cat .sl | sort | uniq > supported.langs
rm -f .sl
echo "Supported langs:"
cat supported.langs | sed -e 's,^, - ,'
# check for python
# check for perl
:> langs.cfg
exit 0