* Use --soname with version number

* Fix redefinition symbol build issue with r_io-desc_free
* Fix compilation of python lang plugin for py>3
This commit is contained in:
pancake 2010-10-28 03:23:42 +02:00
parent 59d81c5103
commit 1b5ea31de4
5 changed files with 22 additions and 16 deletions

1
TODO
View File

@ -7,6 +7,7 @@
TODO 0.6
========
* Check if python plugin works from inside
* Link against versioned libraries
* Review VAPIs
- xtract api for rbin?

View File

@ -30,7 +30,7 @@ libr2.${EXT_SO}:
ifeq ($(OSTYPE),darwin)
@echo Linkage of libr2.dylib is broken on OSX because of dupped .o in .objs extraction
else
${CC} ${LDFLAGS_SONAME}libr2.${EXT_SO} ${LDFLAGS_LIB} ${PIC_CFLAGS} .objs/*.o -o libr2.${EXT_SO}
${CC} ${LDFLAGS_SONAME}libr2.${EXT_SO}.${VERSION} ${LDFLAGS_LIB} ${PIC_CFLAGS} .objs/*.o -o libr2.${EXT_SO}
endif
libr2.${EXT_AR}:

View File

@ -258,8 +258,8 @@ R_API int r_io_desc_add(RIO *io, int fd, const char *file, int flags, struct r_i
R_API int r_io_desc_del(RIO *io, int fd);
R_API struct r_io_desc_t *r_io_desc_get(RIO *io, int fd);
R_API int r_io_desc_generate(RIO *io);
R_API void r_io_desc_free(RIO* io) { free (io); } // XXX
#undef r_io_desc_free
#define r_io_desc_free(x) free(x)
/* plugins */
extern struct r_io_plugin_t r_io_plugin_procpid;

View File

@ -26,15 +26,8 @@ lang_python.${EXT_SO}:
${LDFLAGS_LIB} -shared -o lang_python.${EXT_SO} python.c -lpython27
else
lang_python.${EXT_SO}:
-gcc -lpython >/dev/null 2>&1 ; \
if [ $$? = 0 ]; then \
${CC} ${CFLAGS} -I/usr/include/python2.5 \
-fPIC ${LDFLAGS_LIB} -o lang_python.${EXT_SO} python.c -lpython ; \
else \
${CC} ${CFLAGS} -I/usr/include/python2.5 \
-fPIC ${LDFLAGS_LIB} -o lang_python.${EXT_SO} python.c \
-I/usr/include/python2.6/ -lpython2.6 ; \
fi
${CC} ${CFLAGS} ${LDFLAGS} `python-config --cflags` `python-config --ldflags` \
${LDFLAGS_LIB} -fPIC -o lang_python.${EXT_SO} python.c
endif
ifeq ($(HAVE_LIB_TCC),1)

View File

@ -10,6 +10,9 @@
#undef PREFIX
#include <Python.h>
#include <structmember.h>
#if PY_MAJOR_VERSION>=3
#define PyString_FromString PyUnicode_FromString
#endif
static RCore *core = NULL;
@ -32,7 +35,6 @@ static int run_file(struct r_lang_t *lang, const char *file) {
}
/* init */
static char *py_nullstr = "";
typedef struct {
PyObject_HEAD
PyObject *first; /* first name */
@ -40,10 +42,15 @@ typedef struct {
int number;
} Radare;
#if PY_MAJOR_VERSION<3
static char *py_nullstr = "";
static void Radare_dealloc(Radare* self) {
Py_XDECREF(self->first);
Py_XDECREF(self->last);
self->ob_type->tp_free((PyObject*)self);
//self->ob_type->tp_free((PyObject*)self);
}
static PyObject * Radare_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
@ -172,11 +179,16 @@ static PyTypeObject RadareType = {
static void init_radare_module(void) {
PyObject* m;
if (PyType_Ready(&RadareType) < 0)
if (PyType_Ready (&RadareType) < 0)
return;
m = Py_InitModule3("r", Radare_methods, //module_methods,
m = Py_InitModule3 ("r", Radare_methods, //module_methods,
"Example module that creates an extension type.");
}
#else
static void init_radare_module(void) {
eprintf ("TODO: python>3.x instantiate 'r' object\n");
}
#endif
/* -init- */
static int prompt(void *user) {