forked from radareorg/radare2-bindings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do-swig.sh
executable file
·55 lines (50 loc) · 1.15 KB
/
do-swig.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Copyleft 2011-2012
# Author: pancake(at)nopcode.org
# Wrapper for valabind-cc
LNG=$1
MOD=$2
VALABINDFLAGS="" ; [ 1 = "${DIST}" ] && VALABINDFLAGS="-C"
R2_JAVA_DIR=org/radare/radare2
if [ -z "${MOD}" ]; then
echo "Usage: ./libr-swig.sh [python] [r_foo]"
exit 1
fi
mkdir -p ${LNG}
cd ${LNG}
#valabind-cc ${LNG} ${MOD} -I../../libr/include ../../libr/vapi/${MOD}.vapi -l${MOD} -L../../libr/$(echo ${MOD} | sed -e s,r_,,)
echo "Build ${MOD} `pkg-config --libs ${MOD}`"
case "${LNG}" in
*node*|ctypes)
VBMODE=''
;;
java)
export SWIGFLAGS="-package org.radare.radare2 -outdir ${R2_JAVA_DIR}"
VBMODE=--swig
;;
go)
case $(uname -m) in
*86)
export SWIGFLAGS="-intgosize 32"
VBMODE=--swig
;;
*64*)
export SWIGFLAGS="-intgosize 64"
VBMODE=--swig
;;
esac
;;
*)
VBMODE=--swig
;;
esac
PYTHON_CONFIG=$(../python-config-wrapper -n)
export PYTHON_CONFIG
echo valabind-cc ${LNG} ${MOD} ${VALABINDFLAGS} \
-NRadare ${VBMODE} \
-x --vapidir=../vapi ../vapi/${MOD} \
`pkg-config --cflags --libs ${MOD}`
exec valabind-cc ${LNG} ${MOD} ${VALABINDFLAGS} \
-NRadare ${VBMODE} \
-x --vapidir=../vapi ../vapi/${MOD} \
`pkg-config --cflags --libs ${MOD}`