Skip to content

Commit

Permalink
Add user-install and user-uninstall make targets
Browse files Browse the repository at this point in the history
- Add sys/user.sh to install r2 at home
  • Loading branch information
radare committed Dec 22, 2014
1 parent 2a95a1e commit dff0ccb
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 12 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ purge-doc:
cd man ; for a in *.1 ; do rm -f "${MDR}/man1/$$a" ; done
rm -f ${MDR}/man1/r2.1

user-wrap=echo "\#!/bin/sh" > ~/bin/$1 \
; echo "${PWD}/env.sh ${PREFIX} $1" >> ~/bin/$1 \
; chmod +x ~/bin/$1 ;

user-install:
mkdir -p ~/bin
$(foreach mod,$(R2BINS),$(call user-wrap,$(mod)))

user-uninstall:
$(foreach mod,$(R2BINS),rm -f ~/bin/$(mod))
-rmdir ~/bin

purge-dev:
rm -f ${DESTDIR}/${LIBDIR}/libr_*.${EXT_AR}
rm -f ${DESTDIR}/${LIBDIR}/pkgconfig/r_*.pc
Expand Down
26 changes: 14 additions & 12 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pfx=$1
if [ -z "$pfx" ]; then
echo "Usage: ./env.sh [path-to-prefix]"
echo "Usage: ./env.sh [path-to-prefix] [program]"
exit 1
fi

Expand All @@ -14,17 +14,19 @@ DYLD_LIBRARY_PATH=$pfx/lib:$LD_LIBRARY_PATH
PKG_CONFIG_PATH=$PWD/libr/
'

echo
echo "==> Entering radare2 environment shell..."
echo
echo $new_env $SHELL \
| sed -e 's, ,\n,g' \
| sed -e 's,^, ,g' \
| sed -e 's,$, \\,'
echo
[ -n "$2" ] && SHELL=$2

#echo
#echo "==> Entering radare2 environment shell..."
#echo
#echo $new_env $SHELL \
# | sed -e 's, ,\n,g' \
# | sed -e 's,^, ,g' \
# | sed -e 's,$, \\,'
#echo

eval $new_env $SHELL

echo
echo "==> Back to system shell..."
echo
#echo
#echo "==> Back to system shell..."
#echo
45 changes: 45 additions & 0 deletions sys/user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

MAKE=make
gmake --help >/dev/null 2>&1
[ $? = 0 ] && MAKE=gmake

# find root
cd `dirname $PWD/$0` ; cd ..

# update
if [ "$1" != "--without-pull" ]; then
if [ -d .git ]; then
git branch | grep "^\* master" > /dev/null
if [ $? = 0 ]; then
echo "WARNING: Updating from remote repository"
git pull
fi
fi
else
shift
fi

if [ -z "${HOME}" ]; then
echo "HOME not set"
exit 1
fi

if [ ! -d "${HOME}" ]; then
echo "HOME is not a directory"
exit 1
fi

ROOT=${HOME}/.radare2-prefix

if [ "${HARDEN}" = 1 ]; then
./sys/build-harden.sh ${ROOT} && ${MAKE} symstall
else
./sys/build.sh ${ROOT} && ${MAKE} symstall
fi
${MAKE} user-install
echo
echo radare2 is now installed in ~/.radare2-prefix
echo
echo Now add ${HOME}/bin to your ${PATH}
echo

0 comments on commit dff0ccb

Please sign in to comment.