Skip to content

Instantly share code, notes, and snippets.

@nl5887
Forked from sparkhom/radare2-0.9.9-homebrew.patch
Created December 22, 2015 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nl5887/16fb3da4c870c51ad32e to your computer and use it in GitHub Desktop.
Save nl5887/16fb3da4c870c51ad32e to your computer and use it in GitHub Desktop.
diff --git a/binr/Makefile b/binr/Makefile
index e9876a2..ef0e7d6 100644
--- a/binr/Makefile
+++ b/binr/Makefile
@@ -14,6 +14,8 @@ BINS=rax2 rasm2 rabin2 rahash2 radiff2 radare2 rafind2 rarun2 ragg2 r2agent
# this command needs more love to bring it back
#BINS+=ranal2
+LIBR2=$(call libname-version,libr2.$(EXT_SO),${LIBVERSION})
+
all: preload
@for a in ${BINS} ; do (cd $$a && ${MAKE} all) || exit 1; done
@@ -27,8 +29,8 @@ install:
-cd "${BFX}" && rm -f r2 ; ln -fs radare2 r2
${INSTALL_LIB} "preload/libr2.$(EXT_SO)" "$(LFX)"
-cd "$(LFX)" && \
- mv libr2.$(EXT_SO) libr2.$(EXT_SO).$(VERSION) && \
- ln -fs libr2.$(EXT_SO).$(VERSION) libr2.$(EXT_SO)
+ mv libr2.$(EXT_SO) $(LIBR2) && \
+ ln -fs $(LIBR2) libr2.$(EXT_SO)
symstall install-symlink:
mkdir -p "${BFX}"
@@ -37,8 +39,8 @@ symstall install-symlink:
-ln -fs "${PFX}/bin/radare2" "${BFX}/r2"
-ln -fs "${BTOP}/preload/libr2.$(EXT_SO)" "${LFX}/libr2.$(EXT_SO)"
-cd "$(LFX)" && \
- mv libr2.$(EXT_SO) libr2.$(EXT_SO).$(VERSION) && \
- ln -fs libr2.$(EXT_SO).$(VERSION) libr2.$(EXT_SO)
+ mv libr2.$(EXT_SO) $(LIBR2) && \
+ ln -fs $(LIBR2) libr2.$(EXT_SO)
deinstall uninstall:
for a in ${BINS} ; do rm -f "${BFX}/$$a" ; done
diff --git a/shlr/Makefile b/shlr/Makefile
index a1796ce..278994b 100644
--- a/orig/shlr/Makefile
+++ b/shlr/Makefile
@@ -146,23 +146,7 @@ ifeq ($(CS_TAR),)
capstone: capstone-sync
capstone-sync:
- if [ ! -d capstone ]; then \
- git clone $(CS_URL) ; \
- fi
- cd capstone ; \
- git reset --hard @^^^ ; \
- git checkout $(CS_BRA) ; \
- git reset --hard $(CS_TIP) || \
- ( if [ -d .git ]; then \
- git pull ; git reset --hard $(CS_TIP) ; \
- else true ; fi)
- if [ -n "${CS_REV}" ]; then \
- cd capstone ; \
- git config user.name || ( \
- git config user.name "radare-travis" ; \
- git config user.email radare-travis@foo.com ) ; \
- EDITOR=cat git revert ${CS_REV} ; \
- fi
+ $(SHELL) capstone.sh "${CS_URL}" "${CS_BRA}" "${CS_TIP}" "${CS_REV}"
.PHONY: capstone
else
diff --git a/shlr/capstone.sh b/shlr/capstone.sh
new file mode 100644
index 0000000..db3698a
--- /dev/null
+++ b/shlr/capstone.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+CS_URL="$1" # url
+CS_BRA="$2" # branch name
+CS_TIP="$3" # tip commit
+CS_REV="$4" # revert
+
+if [ -d capstone -a ! -d capstone/.git ]; then
+ echo "[capstone] release with no git?"
+else
+ if [ ! -d capstone ]; then
+ git clone "${CS_URL}" capstone
+ fi
+ cd capstone || exit 1
+ if [ -n "${CS_REV}" ]; then
+ HEAD="`git log|grep ^commit | head -n2|tail -n1 | awk '{print $2}'`"
+ else
+ HEAD="`git log|head -n1 awk '{print $2}'`"
+ fi
+ if [ "${HEAD}" = "${CS_TIP}" ]; then
+ echo "[capstone] Already in TIP, no need to update from git"
+ exit 0
+ fi
+ echo "[capstone] Updating capstone from git..."
+ echo "HEAD ${HEAD}"
+ echo "TIP ${CS_TIP}"
+
+ git reset --hard @^^^
+ git checkout "${CS_BRA}"
+ git pull
+ if [ -n "${CS_TIP}" ]; then
+ git reset --hard "${CS_TIP}"
+ fi
+ if [ -n "${CS_REV}" ]; then
+ if ! git config user.name ; then
+ git config user.name "radare-travis"
+ git config user.email "radare-travis@foo.com"
+ fi
+ EDITOR=cat git revert --no-edit ${CS_REV}
+ fi
+fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment