[arch-commits] Commit in distorm/repos (4 files)
Felix Yan
felixonmars at archlinux.org
Sat Jun 30 18:13:11 UTC 2018
Date: Saturday, June 30, 2018 @ 18:13:11
Author: felixonmars
Revision: 348906
archrelease: copy trunk to community-staging-x86_64
Added:
distorm/repos/community-staging-x86_64/
distorm/repos/community-staging-x86_64/PKGBUILD
(from rev 348902, distorm/trunk/PKGBUILD)
distorm/repos/community-staging-x86_64/build.patch
(from rev 348902, distorm/trunk/build.patch)
distorm/repos/community-staging-x86_64/python3.patch
(from rev 348902, distorm/trunk/python3.patch)
---------------+
PKGBUILD | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build.patch | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
python3.patch | 40 +++++++++++++++++++++++++++++++++
3 files changed, 168 insertions(+)
Copied: distorm/repos/community-staging-x86_64/PKGBUILD (from rev 348902, distorm/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD (rev 0)
+++ community-staging-x86_64/PKGBUILD 2018-06-30 18:13:11 UTC (rev 348906)
@@ -0,0 +1,67 @@
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Mike Sampson <mike at sambodata dot com>
+# Contributor: Dmitry A. Ilyashevich <dmitry.ilyashevich at gmail.com>
+
+pkgbase=distorm
+pkgname=('distorm' 'python-distorm' 'python2-distorm')
+pkgver=3.3.4
+pkgrel=3
+pkgdesc='Powerful disassembler library for x86/AMD64'
+url='https://github.com/gdabah/distorm'
+arch=('x86_64')
+license=('BSD')
+makedepends=('python' 'python2' 'glibc')
+options=('staticlibs')
+source=(${pkgname}-${pkgver}.tar.gz::https://github.com/gdabah/distorm/archive/v${pkgver}.tar.gz
+ python3.patch
+ build.patch)
+sha512sums=('172bb1a9a3f92089daf140fd019c94cf3b63f646b78e7aa527640819f418b1e3df2e2d727a76863a7800e6e3735c404054aeb48fceeec7a94f95480b89883b90'
+ '91bfa096e8de1c494a84e781aa27c48a1063239c4d1e1c746d32fde9273e79769af37240559341edf6547055fbf80698339474ad77c3581c01d4057ba5cef0ea'
+ 'f7ec10c577715b3c8907dc999652de377f21b33acb78954544f920bc65be7e19d13368cf9915be10a5162c149cb9b48816f52f0258d219a3ea1cf26bb63ed8c2')
+
+prepare() {
+ (cd ${pkgbase}-${pkgver}
+ patch -p1 < "${srcdir}/build.patch"
+ patch -p1 < "${srcdir}/python3.patch"
+ )
+ cp -ra ${pkgbase}-${pkgver}{,-py2}
+ sed -e '1i#!/usr/bin/env python' -i ${pkgbase}-${pkgver}/python/distorm3/sample.py
+ sed -e '1i#!/usr/bin/env python2' -i ${pkgbase}-${pkgver}-py2/python/distorm3/sample.py
+}
+
+build() {
+ (cd ${pkgbase}-${pkgver}
+ make -C make/linux
+ python setup.py build
+ )
+ (cd ${pkgbase}-${pkgver}-py2
+ python2 setup.py build
+ )
+}
+
+package_distorm() {
+ depends=('glibc')
+ cd ${pkgbase}-${pkgver}
+ make -C make/linux PREFIX=/usr DESTDIR="${pkgdir}" install
+ install -Dm 644 include/*.h -t "${pkgdir}/usr/include"
+ install -Dm 644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
+
+package_python-distorm() {
+ depends=('python')
+ cd ${pkgbase}-${pkgver}
+ python setup.py install --root="${pkgdir}" -O1 --skip-build
+ install -Dm 755 python/distorm3/sample.py "${pkgdir}/usr/bin/disasm"
+ install -Dm 644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}
+
+package_python2-distorm() {
+ depends=('python2')
+ cd ${pkgbase}-${pkgver}-py2
+ python2 setup.py install --root="${pkgdir}" -O1 --skip-build
+ install -Dm 755 python/distorm3/sample.py "${pkgdir}/usr/bin/disasm"
+ install -Dm 644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ mv "${pkgdir}/usr/bin/disasm"{,-py2}
+}
+
+# vim: ts=2 sw=2 et:
Copied: distorm/repos/community-staging-x86_64/build.patch (from rev 348902, distorm/trunk/build.patch)
===================================================================
--- community-staging-x86_64/build.patch (rev 0)
+++ community-staging-x86_64/build.patch 2018-06-30 18:13:11 UTC (rev 348906)
@@ -0,0 +1,61 @@
+From 26d3959ac90cfbecd36458fee2fbb67807457d54 Mon Sep 17 00:00:00 2001
+From: anthraxx <levente at leventepolyak.net>
+Date: Mon, 6 Jun 2016 00:03:20 +0200
+Subject: [PATCH] more distribution friendly Makefile improvements
+
+- append CFLAGS instead of force-set it, this was distributions
+ can also add their own CFLAGS in addition (this is very common).
+- introduce LDFLAGS so distributions can set their own additional
+ flags for the linker and append instead of set (this is very common)
+- replace static /usr/local/lib with a PREFIX variable with default
+ value of /usr/local so a distribution can easily use PREFIX=/usr
+ (this is also common)
+- introduce DESTDIR for distribution wide packaging as they build in
+ chroots and deploy into a special directory structure that will later
+ put into a tarball and lands in a distribution package.
+ f.e. DESTDIR="/build/package" (this is also common for packaging)
+- adding -D to install call to create all leading components of the
+ destination. This is very important if the DESTDIR is set for
+ packaging the therefor the structure does not yet exists. This will
+ then basically freate the directory structure. in case DESTDIR is not
+ used and /usr/local/lib f.e. already exists this will do nothing
+ this is highly common to do it this way.
+ We add the ${TARGET} to the end because we use the -D parameter and
+ therefor we need to also pass the resulting filename
+---
+ make/linux/Makefile | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/make/linux/Makefile b/make/linux/Makefile
+index c2ad39e..d142bb4 100644
+--- a/make/linux/Makefile
++++ b/make/linux/Makefile
+@@ -5,7 +5,10 @@
+ TARGET = 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
++CFLAGS += -fPIC -O2 -Wall -DSUPPORT_64BIT_OFFSET -DDISTORM_STATIC
++LDFLAGS += -shared
++PREFIX = /usr/local
++DESTDIR =
+
+ all: clib
+
+@@ -13,11 +16,11 @@ clean:
+ /bin/rm -rf ../../src/*.o ${TARGET} ../../distorm3.a ./../*.o
+
+ clib: ${COBJS}
+- ${CC} ${CFLAGS} ${VERSION} ${COBJS} -shared -o ${TARGET}
++ ${CC} ${CFLAGS} ${VERSION} ${COBJS} ${LDFLAGS} -o ${TARGET}
+ ar rs ../../distorm3.a ${COBJS}
+
+ install: libdistorm3.so
+- install -s ${TARGET} /usr/local/lib
++ install -D -s ${TARGET} ${DESTDIR}/${PREFIX}/lib/${TARGET}
+ @echo "... running ldconfig might be smart ..."
+
+ .c.o:
+--
+2.8.3
+
Copied: distorm/repos/community-staging-x86_64/python3.patch (from rev 348902, distorm/trunk/python3.patch)
===================================================================
--- community-staging-x86_64/python3.patch (rev 0)
+++ community-staging-x86_64/python3.patch 2018-06-30 18:13:11 UTC (rev 348906)
@@ -0,0 +1,40 @@
+From 28b3af2136bcc465830631afa9357fbf73048e52 Mon Sep 17 00:00:00 2001
+From: gil_dabah <dabah at north-bit.com>
+Date: Sat, 4 Jun 2016 17:37:40 +0300
+Subject: [PATCH] Fix for cross Python support.
+
+---
+ python/distorm3/__init__.py | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/python/distorm3/__init__.py b/python/distorm3/__init__.py
+index c8f881c..176677b 100644
+--- a/python/distorm3/__init__.py
++++ b/python/distorm3/__init__.py
+@@ -537,6 +537,15 @@ def DecodeGenerator(codeOffset, code, dt):
+ p_result = byref(result)
+ instruction_off = 0
+
++ # Support cross Python compatibility
++ toUnicode = lambda s: s
++ spaceCh = b" "
++ if sys.version_info[0] >= 3:
++ if sys.version_info[1] > 0:
++ toUnicode = lambda s: s.decode()
++ else:
++ spaceCh = " "
++
+ while codeLen > 0:
+
+ usedInstructionsCount = c_uint(0)
+@@ -553,8 +562,8 @@ def DecodeGenerator(codeOffset, code, dt):
+ di = result[index]
+ asm = di.mnemonic.p
+ if len(di.operands.p):
+- asm += b" " + di.operands.p
+- pydi = (di.offset, di.size, asm, di.instructionHex.p)
++ asm += spaceCh + di.operands.p
++ pydi = (di.offset, di.size, toUnicode(asm), toUnicode(di.instructionHex.p))
+ instruction_off += di.size
+ yield pydi
+
More information about the arch-commits
mailing list