* Added support for LUA for non-developer mode

- Added test program for r_asm api in LUA
* Use python-config-wrapper in checklangs.sh
* Do not use libr in install
This commit is contained in:
pancake 2011-03-09 19:34:22 +01:00
parent 92453e035f
commit 3a72789727
6 changed files with 39 additions and 13 deletions

View File

@ -33,7 +33,6 @@ w32dist:
mkdir -p ${DST}
cp -f python/*.dll ${DST}
cp -f python/r_*.py ${DST}
cp -f python/libr.py ${DST}
cd .. ; zip -r $(DSTNAME).zip $(DSTNAME)
dist:
@ -93,11 +92,9 @@ install-python:
echo "Installing $$a/site-packages r2 modules in ${DESTDIR}${PREFIX}/lib/$$a/site-packages/r2" ; \
mkdir -p ${DESTDIR}${PREFIX}/lib/$$a/site-packages/r2 ; \
touch ${DESTDIR}${PREFIX}/lib/$$a/site-packages/r2/__init__.py ; \
cp -rf python/*.${SOEXT} python/r_*.py python/libr.py ${DESTDIR}${PREFIX}/lib/$$a/site-packages/r2 ; \
echo "Installing $$a/dist-packages r2 modules in ${DESTDIR}${PREFIX}/lib/$$a/dist-packages/r2" ; \
mkdir -p ${DESTDIR}${PREFIX}/lib/$$a/dist-packages/r2 ; \
touch ${DESTDIR}${PREFIX}/lib/$$a/dist-packages/r2/__init__.py ; \
cp -rf python/*.${SOEXT} python/r_*.py python/libr.py ${DESTDIR}${PREFIX}/lib/$$a/dist-packages/r2 ; \
fi
install-lua:
@ -106,7 +103,6 @@ install-lua:
mkdir -p ${DESTDIR}${PREFIX}/lib/lua/$$a/r2 ; \
echo "Installing lua$$a r2 modules..." ; \
cp -rf lua/*.so ${DESTDIR}${PREFIX}/lib/lua/$$a/r2 ; \
cp -rf lua/*libr* ${DESTDIR}${PREFIX}/lib/lua/$$a ; \
done ; \
fi
@ -127,7 +123,6 @@ install-ruby:
mkdir -p ${DESTDIR}${PREFIX}/lib/ruby/$$a/r2 ; \
echo "Installing ruby$$a r2 modules..." ; \
cp -rf ruby/* ${DESTDIR}${PREFIX}/lib/ruby/$$a/r2 ; \
cp -rf ruby/*libr* ${DESTDIR}${PREFIX}/lib/ruby/$$a ; \
done ; \
fi
@ -143,7 +138,6 @@ install-perl:
echo "Installing perl r2 modules..." ; \
cp -rf perl/*.so $$target/r2 ; \
cp -rf perl/*.pm $$target/r2 ; \
cp -rf perl/*libr* $$target/ ; \
fi
install-vapi:

View File

@ -7,13 +7,18 @@ LANGS="python perl ruby lua go java"
if [ "$1" = "force-all" ]; then
:> supported.langs
for a in python-config python2-config ; do
$a --help >/dev/null 2>&1
if [ $? = 0 ]; then
echo "check-langs.sh: Detected python-dev"
PYTHONCONFIG=`./python-config-wrapper -n`
if [ -n "${PYTHONCONFIG}" ]; then
echo "check-langs.sh: Detected python"
echo python >> supported.langs
fi
done
fi
echo "#include <lua.h>" > .test.c
${CC} -c .test.c
if [ -f .test.o ]; then
echo "check-langs.sh: Detected lua"
echo lua >> supported.langs
fi
rm -f .test.c
exit 0
fi

11
swig/lua/test-r_asm.lua Normal file
View File

@ -0,0 +1,11 @@
require "r_asm"
a = r_asm.RAsm ()
a:use ("x86.olly")
opcode = "mov eax, 33"
foo = a:massemble (opcode)
if foo ~= nil then
print (string.format ('%s = %s', opcode, foo.buf_hex))
else
print "Cannot assemble opcode"
end

View File

@ -3,7 +3,7 @@ require "r_bin"
file = arg[1] or "/bin/ls"
b = r_bin.RBin ()
b:load (file, "")
b:load (file, false)
baddr = b:get_baddr ()
s = b:get_sections ()
nsects = s:size() - 1

12
swig/lua/test-r_core.lua Normal file
View File

@ -0,0 +1,12 @@
-- using RCore API as the unique entrypoint --
require "r_core"
a = r_core.RAsm ()
a:use ("x86.olly")
opcode = "mov eax, 33"
foo = a:massemble (opcode)
if foo ~= nil then
print (string.format ('%s = %s', opcode, foo.buf_hex))
else
print "Cannot assemble opcode"
end

View File

@ -20,5 +20,9 @@ for a in ${PCS} ; do
done
[ -z "${PYTHONCONFIG}" ] && exit 1
if [ "$1" = "-n" ]; then
echo ${PYTHONCONFIG}
exit 0
fi
${PYTHONCONFIG} $@ | sed -e s,-Wstrict-prototypes,,g 2>/dev/null