New upstream version 3.4.1

parent 77317b96
......@@ -14,6 +14,6 @@ diStorm3 is licensed under BSD!
Installing diStorm3 -
Clone repo locally and then 'python setup.py install' or alternatively: 'python -m pip install distorm3'.
For Windows, use these pre-built installers in https://pypi.org/manage/project/distorm3/release/3.3.8/.
For Windows, use these pre-built installers in https://pypi.org/project/distorm3/#files.
RTFM, the wiki has plenty of info.
/* diStorm 3.3.3 */
/* diStorm 3.4.0 */
/*
distorm.h
......@@ -471,7 +471,7 @@ typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR, D
*
* Output: unsigned int - version of compiled library.
*/
unsigned int distorm_version();
unsigned int distorm_version(void);
#endif /* DISTORM_STATIC */
......
......@@ -2,7 +2,7 @@
# diStorm3 (Linux Port)
#
TARGET = libdistorm3.so
TARGET_BASE = libdistorm3.so
COBJS = ../../src/mnemonics.o ../../src/wstring.o ../../src/textdefs.o ../../src/prefix.o ../../src/operands.o ../../src/insts.o ../../src/instructions.o ../../src/distorm.o ../../src/decoder.o
CC = gcc
CFLAGS += -fPIC -O2 -Wall -DSUPPORT_64BIT_OFFSET -DDISTORM_STATIC
......@@ -11,21 +11,23 @@ PREFIX = /usr/local
# The lib SONAME version:
LIB_S_VERSION = 3
# The lib real version:
LIB_R_VERSION = 3.3.8
LDFLAGS += -Wl,-soname,${TARGET}.${LIB_S_VERSION}
LIB_R_VERSION = 3.4.0
LDFLAGS += -Wl,-soname,${TARGET_BASE}.${LIB_S_VERSION}
DESTDIR =
TARGET_NAME = ${TARGET_BASE}.${LIB_R_VERSION}
all: clib
clean:
/bin/rm -rf ../../src/*.o ${TARGET} ../../distorm3.a ./../*.o
/bin/rm -rf ../../src/*.o ${TARGET_NAME} ../../distorm3.a ./../*.o
clib: ${COBJS}
${CC} ${CFLAGS} ${VERSION} ${COBJS} ${LDFLAGS} -o ${TARGET}
${CC} ${CFLAGS} ${VERSION} ${COBJS} ${LDFLAGS} -o ${TARGET_NAME}
ar rs ../../distorm3.a ${COBJS}
install: libdistorm3.so
install -D -s ${TARGET} ${DESTDIR}/${PREFIX}/lib/${TARGET}
install: ${TARGET_NAME}
install -D -s ${TARGET_NAME} ${DESTDIR}${PREFIX}/lib/${TARGET_NAME}
ln -sf ${DESTDIR}${PREFIX}/lib/${TARGET_NAME} ${DESTDIR}${PREFIX}/lib/${TARGET_BASE}
@echo "... running ldconfig might be smart ..."
.c.o:
......
......@@ -2,11 +2,12 @@
# diStorm3 (Mac Port)
#
DISTORM_MODE ?= DISTORM_DYNAMIC
TARGET = libdistorm3.dylib
PYTHON_BUILD_DIR = ../../Python/macosx-x86
COBJS = ../../src/mnemonics.o ../../src/wstring.o ../../src/textdefs.o ../../src/prefix.o ../../src/operands.o ../../src/insts.o ../../src/instructions.o ../../src/distorm.o ../../src/decoder.o
CC = gcc
CFLAGS = -arch i386 -arch x86_64 -O2 -Wall -fPIC -DSUPPORT_64BIT_OFFSET -DDISTORM_DYNAMIC
CFLAGS = -arch i386 -arch x86_64 -O2 -Wall -fPIC -DSUPPORT_64BIT_OFFSET -D${DISTORM_MODE}
all: clib
......@@ -14,11 +15,14 @@ clean:
/bin/rm -rf ../../src/*.o ${TARGET} ../../libdistorm3.dylib ../../distorm3.a ../../*.a
clib: ${COBJS}
ifeq '$(DISTORM_MODE)' 'DISTORM_DYNAMIC'
${CC} ${CFLAGS} ${VERSION} ${COBJS} -fPIC -dynamiclib -o ${TARGET}
[ -d ${PYTHON_BUILD_DIR} ] && rm -rf ${PYTHON_BUILD_DIR} || true
mkdir ${PYTHON_BUILD_DIR}
cp ${TARGET} ${PYTHON_BUILD_DIR}/
#ar rs ../../distorm3.a ${COBJS}
else
ar rs ../../distorm3.a ${COBJS}
endif
.c.o:
${CC} ${CFLAGS} ${VERSION} -c $< -o $@
B// Microsoft Visual C++ generated resource script.
......
......@@ -20,11 +20,12 @@ import subprocess as sp
from glob import glob
from shutil import ignore_patterns
from setuptools import dist
from distutils import log
from distutils.command.build import build
from distutils.command.build_clib import build_clib
from distutils.command.clean import clean
from setuptools.command.install import install
from distutils.command.install_lib import install_lib
from distutils.command.sdist import sdist
from distutils.core import setup, Extension
......@@ -100,7 +101,7 @@ class custom_build_clib(build_clib):
libraries alongside the python packages, to facilitate the use of ctypes.
"""
def finalize_options (self):
def finalize_options(self):
# We want build-clib to default to build-lib as defined by the
# "build" command. This is so the compiled library will be put
# in the right place along side the python code.
......@@ -146,7 +147,7 @@ class custom_build_clib(build_clib):
log.info('running custom_build_clib')
build_clib.run(self)
def build_libraries (self, libraries):
def build_libraries(self, libraries):
for (lib_name, build_info) in libraries:
sources = self.get_source_files_for_lib(lib_name, build_info)
sources = list(sources)
......@@ -203,23 +204,32 @@ class custom_clean(clean):
clean.run(self)
class custom_sdist(sdist):
"""Customized sdist command"""
def run(self):
log.info('running custom_sdist')
sdist.run(self)
class BinaryDistribution(dist.Distribution):
def is_pure(self):
return False
def has_ext_modules(self):
return True
class custom_install(install):
def finalize_options(self):
install.finalize_options(self)
self.install_lib = self.install_platlib
def main():
# Just in case we are being called from a different directory
cwd = os.path.dirname(__file__)
if cwd:
os.chdir(cwd)
# Get the target platform
system = platform.system().lower()
# Setup the extension module
# Setup the library
ext_modules = None
......@@ -233,8 +243,8 @@ def main():
package='distorm3',
sources=get_sources,
include_dirs=['src', 'include'],
extra_compile_args=['-arch', 'i386', '-arch', 'x86_64', '-O2',
'-Wall', '-fPIC', '-DSUPPORT_64BIT_OFFSET',
extra_compile_args=['-arch', 'i386', '-arch', 'x86_64', '-O2',
'-Wall', '-fPIC', '-DSUPPORT_64BIT_OFFSET',
'-DDISTORM_DYNAMIC']))]
elif 'cygwin' in system:
libraries = [(
......@@ -242,21 +252,20 @@ def main():
package='distorm3',
sources=get_sources,
include_dirs=['src', 'include'],
extra_compile_args=['-fPIC', '-O2', '-Wall',
'-DSUPPORT_64BIT_OFFSET',
'-DDISTORM_STATIC',
'-Wl,-soname,libdistorm3.so.3']))]
extra_compile_args=['-fPIC', '-O2', '-Wall',
'-DSUPPORT_64BIT_OFFSET',
'-DDISTORM_STATIC']))]
else:
libraries = [(
'distorm3', dict(
package='distorm3',
sources=get_sources,
include_dirs=['src', 'include'],
extra_compile_args=['-fPIC', '-O2', '-Wall',
'-DSUPPORT_64BIT_OFFSET',
'-DDISTORM_STATIC',
'-Wl,-soname,libdistorm3.so.3']))]
extra_link_args=['-Wl,-soname,libdistorm3.so.3'],
extra_compile_args=['-fPIC', '-O2', '-Wall',
'-DSUPPORT_64BIT_OFFSET',
'-DDISTORM_STATIC']))]
options = {
# Setup instructions
......@@ -267,13 +276,15 @@ def main():
'cmdclass' : { 'build' : custom_build,
'build_clib' : custom_build_clib,
'clean' : custom_clean,
'sdist' : custom_sdist },
'sdist' : custom_sdist,
'install' : custom_install },
'libraries' : libraries,
'package_data' : {'distorm3': package_data},
'distclass' : BinaryDistribution,
# Metadata
'name' : 'distorm3',
'version' : '3.3.8',
'version' : '3.4.1',
'description' : 'The goal of diStorm3 is to decode x86/AMD64' \
' binary streams and return a structure that' \
' describes each instruction.',
......
......@@ -13,7 +13,7 @@ This library is licensed under the BSD license. See the file COPYING.
#define CONFIG_H
/* diStorm version number. */
#define __DISTORMV__ 0x030308
#define __DISTORMV__ 0x030400
#include <string.h> /* memset, memcpy - can be easily self implemented for libc independency. */
......
......@@ -407,7 +407,7 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t
#endif /* DISTORM_LIGHT */
_DLLEXPORT_ unsigned int distorm_version()
_DLLEXPORT_ unsigned int distorm_version(void)
{
return __DISTORMV__;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment