2014-12-22 03:50:08 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
MAKE=make
|
|
|
|
gmake --help >/dev/null 2>&1
|
|
|
|
[ $? = 0 ] && MAKE=gmake
|
|
|
|
|
2018-09-02 20:06:48 +00:00
|
|
|
${MAKE} --help 2>&1 | grep -q gnu
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo "You need GNU Make to build me"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-12-22 03:50:08 +00:00
|
|
|
# find root
|
2018-09-01 23:40:25 +00:00
|
|
|
cd "$(dirname "$0")" ; cd ..
|
2014-12-22 03:50:08 +00:00
|
|
|
|
2018-12-05 11:30:36 +00:00
|
|
|
export WITHOUT_PULL=0
|
|
|
|
ROOT=
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
"--without-pull")
|
|
|
|
WITHOUT_PULL=1
|
|
|
|
;;
|
|
|
|
"--install-path")
|
|
|
|
shift
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
ROOT="$1"
|
|
|
|
BINDIR="$1/bin"
|
|
|
|
else
|
|
|
|
echo "ERROR: install-path must not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "WARNING: unknown argument \"$1\""
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2014-12-22 03:50:08 +00:00
|
|
|
# update
|
2018-12-05 11:30:36 +00:00
|
|
|
if [ $WITHOUT_PULL -eq 0 ]; then
|
2014-12-22 03:50:08 +00:00
|
|
|
if [ -d .git ]; then
|
|
|
|
git branch | grep "^\* master" > /dev/null
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
echo "WARNING: Updating from remote repository"
|
|
|
|
git pull
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-05 11:30:36 +00:00
|
|
|
if [ -z "${ROOT}" ]; then
|
|
|
|
if [ -z "${HOME}" ]; then
|
|
|
|
echo "HOME not set"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-12-22 03:50:08 +00:00
|
|
|
|
2018-12-05 11:30:36 +00:00
|
|
|
if [ ! -d "${HOME}" ]; then
|
|
|
|
echo "HOME is not a directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ROOT="${HOME}/bin/prefix/radare2"
|
|
|
|
BINDIR="${HOME}/bin"
|
2014-12-22 03:50:08 +00:00
|
|
|
fi
|
|
|
|
|
2015-09-08 21:47:45 +00:00
|
|
|
mkdir -p "${ROOT}/lib"
|
2014-12-22 03:50:08 +00:00
|
|
|
|
2015-09-14 17:21:57 +00:00
|
|
|
if [ "${M32}" = 1 ]; then
|
|
|
|
./sys/build-m32.sh "${ROOT}" && ${MAKE} symstall
|
|
|
|
elif [ "${HARDEN}" = 1 ]; then
|
2015-06-17 02:19:48 +00:00
|
|
|
./sys/build-harden.sh "${ROOT}" && ${MAKE} symstall
|
2014-12-22 03:50:08 +00:00
|
|
|
else
|
2015-06-17 02:19:48 +00:00
|
|
|
./sys/build.sh "${ROOT}" && ${MAKE} symstall
|
2014-12-22 03:50:08 +00:00
|
|
|
fi
|
2015-09-08 21:47:45 +00:00
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo "Oops"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-12-22 03:50:08 +00:00
|
|
|
${MAKE} user-install
|
|
|
|
echo
|
2018-12-05 11:30:36 +00:00
|
|
|
echo "radare2 is now installed in ${BINDIR}"
|
2014-12-22 03:50:08 +00:00
|
|
|
echo
|
2018-12-05 11:30:36 +00:00
|
|
|
echo "Now add ${BINDIR} to your PATH"
|
2014-12-22 03:50:08 +00:00
|
|
|
echo
|