On 09/19/17 20:36, Remi Pointel wrote:
Hi,

attached is the diff to have the Python bindings for Capstone.

I modified the structure, we now have:
- devel/capstone/main
- devel/capstone/python

Are you ok with this diff?

Cheers,

With the correct diff...

Cheers,

Remi.
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/capstone/Makefile,v
retrieving revision 1.10
diff -u -p -u -p -r1.10 Makefile
--- Makefile	9 Apr 2017 11:08:07 -0000	1.10
+++ Makefile	19 Sep 2017 18:50:52 -0000
@@ -1,37 +1,7 @@
 # $OpenBSD: Makefile,v 1.10 2017/04/09 11:08:07 jasper Exp $
 
-COMMENT =	multi-platform, multi-architecture disassembly framework
-
-VERSION =	3.0.4
-DISTNAME =	capstone-${VERSION}
-REVISION =	0
-CATEGORIES =	devel
-HOMEPAGE =	http://www.capstone-engine.org/
-
-MAINTAINER =	Benoit Lecocq <ben...@openbsd.org>
-
-SHARED_LIBS =	capstone	2.0
-
-# BSD
-PERMIT_PACKAGE_CDROM =	Yes
-
-MASTER_SITES = 		http://capstone-engine.org/download/${VERSION}/
-
-USE_GMAKE =		Yes
-FAKE_FLAGS =		PREFIX=${PREFIX}
-MAKE_ENV =		LIBcapstone_VERSION=${LIBcapstone_VERSION} \
-			INSTALL_DATA="${INSTALL_DATA}" \
-			INSTALL_LIBRARY="${INSTALL_DATA}" \
-			V=1
-
-do-test:
-	cd ${WRKBUILD}/tests; \
-	set -- $$(env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} \
-	    -f ${MAKE_FILE} -p -n | grep ^SOURCES); \
-	echo "$$@"; \
-	shift 2; for t; do \
-		t=$${t%.c}; LD_LIBRARY_PATH=`pwd` \
-		LD_PRELOAD=libcapstone.so.${LIBcapstone_VERSION} ./$$t; \
-	done
+SUBDIR =
+SUBDIR += main
+SUBDIR += python
 
 .include <bsd.port.mk>
Index: Makefile.inc
===================================================================
RCS file: Makefile.inc
diff -N Makefile.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Makefile.inc	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,15 @@
+# $OpenBSD: Makefile,v 1.10 2017/04/09 11:08:07 jasper Exp $
+
+VERSION =	3.0.4
+DISTNAME =	capstone-${VERSION}
+
+CATEGORIES =	devel
+HOMEPAGE =	http://www.capstone-engine.org/
+
+MAINTAINER ?=	Benoit Lecocq <ben...@openbsd.org>
+
+# BSD
+PERMIT_PACKAGE_CDROM =	Yes
+
+MASTER_SITES = 		http://capstone-engine.org/download/${VERSION}/
+
Index: distinfo
===================================================================
RCS file: distinfo
diff -N distinfo
--- distinfo	23 Jul 2015 06:05:04 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-SHA256 (capstone-3.0.4.tar.gz) = Poir32iZ0RiX8uBkYZ7cxzHMjpfp1NuGSVcCVRuzrn8=
-SIZE (capstone-3.0.4.tar.gz) = 2774764
Index: main/Makefile
===================================================================
RCS file: main/Makefile
diff -N main/Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/Makefile	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,31 @@
+# $OpenBSD: Makefile,v 1.10 2017/04/09 11:08:07 jasper Exp $
+
+COMMENT =	multi-platform, multi-architecture disassembly framework
+
+REVISION =	1
+
+MAINTAINER =	Benoit Lecocq <ben...@openbsd.org>
+
+SHARED_LIBS =	capstone	2.0
+
+# BSD
+PERMIT_PACKAGE_CDROM =	Yes
+
+USE_GMAKE =		Yes
+FAKE_FLAGS =		PREFIX=${PREFIX}
+MAKE_ENV =		LIBcapstone_VERSION=${LIBcapstone_VERSION} \
+			INSTALL_DATA="${INSTALL_DATA}" \
+			INSTALL_LIBRARY="${INSTALL_DATA}" \
+			V=1
+
+do-test:
+	cd ${WRKBUILD}/tests; \
+	set -- $$(env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} \
+	    -f ${MAKE_FILE} -p -n | grep ^SOURCES); \
+	echo "$$@"; \
+	shift 2; for t; do \
+		t=$${t%.c}; LD_LIBRARY_PATH=`pwd` \
+		LD_PRELOAD=libcapstone.so.${LIBcapstone_VERSION} ./$$t; \
+	done
+
+.include <bsd.port.mk>
Index: main/distinfo
===================================================================
RCS file: main/distinfo
diff -N main/distinfo
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/distinfo	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,2 @@
+SHA256 (capstone-3.0.4.tar.gz) = Poir32iZ0RiX8uBkYZ7cxzHMjpfp1NuGSVcCVRuzrn8=
+SIZE (capstone-3.0.4.tar.gz) = 2774764
Index: main/patches/patch-Makefile
===================================================================
RCS file: main/patches/patch-Makefile
diff -N main/patches/patch-Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/patches/patch-Makefile	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,92 @@
+$OpenBSD: patch-Makefile,v 1.8 2016/10/03 07:39:59 feinerer Exp $
+
+1. Do not force some compilation flags.
+2. Set library version, respecting OpenBSD policy.
+3. Avoid duplication of defines, linked to (2).
+4. Do not use $(INSTALL_*) at the build stage.
+
+--- Makefile.orig	Fri May  8 11:06:59 2015
++++ Makefile	Sat May  9 08:34:16 2015
+@@ -30,7 +30,7 @@ ifneq (,$(findstring yes,$(CAPSTONE_DIET)))
+ CFLAGS ?= -Os
+ CFLAGS += -DCAPSTONE_DIET
+ else
+-CFLAGS ?= -O3
++CFLAGS ?= 
+ endif
+ 
+ ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
+@@ -82,8 +82,11 @@ INSTALL_DATA ?= $(INSTALL_BIN) -m0644
+ INSTALL_LIB ?= $(INSTALL_BIN) -m0755
+ 
+ LIBNAME = capstone
++LIBVER ?= 0.0.0
++ifdef LIB$(LIBNAME)_VERSION
++LIBVER = $(LIB$(LIBNAME)_VERSION)
++endif
+ 
+-
+ DEP_ARM =
+ DEP_ARM += arch/ARM/ARMGenAsmWriter.inc
+ DEP_ARM += arch/ARM/ARMGenDisassemblerTables.inc
+@@ -282,7 +285,7 @@ else
+ EXT = so
+ VERSION_EXT = $(EXT).$(API_MAJOR)
+ AR_EXT = a
+-$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(VERSION_EXT)
++$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(EXT).$(LIBVER)
+ endif
+ endif
+ endif
+@@ -293,7 +296,7 @@ LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
+ else ifeq ($(IS_CYGWIN),1)
+ LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
+ else	# *nix
+-LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT)
++LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT).$(LIBVER)
+ CFLAGS += -fvisibility=hidden
+ endif
+ endif
+@@ -320,7 +323,7 @@ else
+ 	cd tests && $(MAKE) BUILDDIR=$(BLDIR)
+ endif
+ ifeq ($(CAPSTONE_SHARED),yes)
+-	$(INSTALL_DATA) $(LIBRARY) $(BLDIR)/tests/
++	cp $(LIBRARY) $(BLDIR)/tests/
+ endif
+ endif
+ 
+@@ -367,13 +370,9 @@ endif
+ install: $(PKGCFGF) $(ARCHIVE) $(LIBRARY)
+ 	mkdir -p $(LIBDIR)
+ ifeq ($(CAPSTONE_SHARED),yes)
+-	$(INSTALL_LIB) $(LIBRARY) $(LIBDIR)
+-ifneq ($(VERSION_EXT),)
+-	cd $(LIBDIR) && \
+-	mv lib$(LIBNAME).$(EXT) lib$(LIBNAME).$(VERSION_EXT) && \
+-	ln -s lib$(LIBNAME).$(VERSION_EXT) lib$(LIBNAME).$(EXT)
++	$(INSTALL_LIBRARY) $(LIBRARY) $(LIBDIR)
++	$(INSTALL_DATA) $(ARCHIVE) $(LIBDIR)
+ endif
+-endif
+ ifeq ($(CAPSTONE_STATIC),yes)
+ 	$(INSTALL_DATA) $(ARCHIVE) $(LIBDIR)
+ endif
+@@ -383,13 +382,12 @@ endif
+ 	$(INSTALL_DATA) $(PKGCFGF) $(PKGCFGDIR)/
+ 
+ uninstall:
+-	rm -rf $(INCDIR)/$(LIBNAME)
+-	rm -f $(LIBDIR)/lib$(LIBNAME).*
+-	rm -f $(PKGCFGDIR)/$(LIBNAME).pc
++	rm -f $(LIBDIR)/$(LIBRARY)
++	rm -f $(LIBDIR)/$(ARCHIVE)
++	rm -f $(LIBDIR)/pkgconfig/$(PKGCFGF)
+ 
+ clean:
+-	rm -f $(LIBOBJ)
+-	rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).*
++	rm -f $(LIBOBJ) $(ARCHIVE) $(LIBRARY)
+ 	rm -f $(PKGCFGF)
+ 
+ ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
Index: main/patches/patch-arch_Mips_MipsInstPrinter_c
===================================================================
RCS file: main/patches/patch-arch_Mips_MipsInstPrinter_c
diff -N main/patches/patch-arch_Mips_MipsInstPrinter_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/patches/patch-arch_Mips_MipsInstPrinter_c	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,88 @@
+$OpenBSD: patch-arch_Mips_MipsInstPrinter_c,v 1.3 2015/05/09 06:50:02 benoit Exp $
+
+The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
+conflict.
+
+--- arch/Mips/MipsInstPrinter.c.orig	Fri May  8 11:06:59 2015
++++ arch/Mips/MipsInstPrinter.c	Sat May  9 08:34:16 2015
+@@ -93,12 +93,12 @@ static void set_mem_access(MCInst *MI, bool status)
+ 		return;
+ 
+ 	if (status) {
+-		MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_MEM;
+-		MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.base = MIPS_REG_INVALID;
+-		MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.disp = 0;
++		MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_MEM;
++		MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.base = MIPS_REG_INVALID;
++		MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.disp = 0;
+ 	} else {
+ 		// done, create the next operand slot
+-		MI->flat_insn->detail->mips.op_count++;
++		MI->flat_insn->detail->mipsen.op_count++;
+ 	}
+ }
+ 
+@@ -195,11 +195,11 @@ static void printOperand(MCInst *MI, unsigned OpNo, SS
+ 		reg = Mips_map_register(reg);
+ 		if (MI->csh->detail) {
+ 			if (MI->csh->doing_mem) {
+-				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.base = reg;
++				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.base = reg;
+ 			} else {
+-				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_REG;
+-				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].reg = reg;
+-				MI->flat_insn->detail->mips.op_count++;
++				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_REG;
++				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].reg = reg;
++				MI->flat_insn->detail->mipsen.op_count++;
+ 			}
+ 		}
+ 	} else if (MCOperand_isImm(Op)) {
+@@ -219,7 +219,7 @@ static void printOperand(MCInst *MI, unsigned OpNo, SS
+ 				}
+ 			}
+ 			if (MI->csh->detail)
+-				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.disp = imm;
++				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.disp = imm;
+ 		} else {
+ 			if (imm >= 0) {
+ 				if (imm > HEX_THRESHOLD)
+@@ -234,9 +234,9 @@ static void printOperand(MCInst *MI, unsigned OpNo, SS
+ 			}
+ 
+ 			if (MI->csh->detail) {
+-				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
+-				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = imm;
+-				MI->flat_insn->detail->mips.op_count++;
++				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_IMM;
++				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].imm = imm;
++				MI->flat_insn->detail->mipsen.op_count++;
+ 			}
+ 		}
+ 	}
+@@ -259,9 +259,9 @@ static void printUnsignedImm(MCInst *MI, int opNum, SS
+ 				SStream_concat(O, "-%u", (short int)-imm);
+ 		}
+ 		if (MI->csh->detail) {
+-			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
+-			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = (unsigned short int)imm;
+-			MI->flat_insn->detail->mips.op_count++;
++			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_IMM;
++			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].imm = (unsigned short int)imm;
++			MI->flat_insn->detail->mipsen.op_count++;
+ 		}
+ 	} else
+ 		printOperand(MI, opNum, O);
+@@ -277,9 +277,9 @@ static void printUnsignedImm8(MCInst *MI, int opNum, S
+ 		else
+ 			SStream_concat(O, "%u", imm);
+ 		if (MI->csh->detail) {
+-			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
+-			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = imm;
+-			MI->flat_insn->detail->mips.op_count++;
++			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_IMM;
++			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].imm = imm;
++			MI->flat_insn->detail->mipsen.op_count++;
+ 		}
+ 	} else
+ 		printOperand(MI, opNum, O);
Index: main/patches/patch-cs_c
===================================================================
RCS file: main/patches/patch-cs_c
diff -N main/patches/patch-cs_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/patches/patch-cs_c	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,29 @@
+$OpenBSD: patch-cs_c,v 1.4 2015/05/09 06:50:02 benoit Exp $
+
+The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
+conflict.
+
+--- cs.c.orig	Fri May  8 11:06:59 2015
++++ cs.c	Sat May  9 08:34:16 2015
+@@ -919,8 +919,8 @@ int cs_op_count(csh ud, const cs_insn *insn, unsigned 
+ 					count++;
+ 			break;
+ 		case CS_ARCH_MIPS:
+-			for (i = 0; i < insn->detail->mips.op_count; i++)
+-				if (insn->detail->mips.operands[i].type == (mips_op_type)op_type)
++			for (i = 0; i < insn->detail->mipsen.op_count; i++)
++				if (insn->detail->mipsen.operands[i].type == (mips_op_type)op_type)
+ 					count++;
+ 			break;
+ 		case CS_ARCH_PPC:
+@@ -1005,8 +1005,8 @@ int cs_op_index(csh ud, const cs_insn *insn, unsigned 
+ 			}
+ 			break;
+ 		case CS_ARCH_MIPS:
+-			for (i = 0; i < insn->detail->mips.op_count; i++) {
+-				if (insn->detail->mips.operands[i].type == (mips_op_type)op_type)
++			for (i = 0; i < insn->detail->mipsen.op_count; i++) {
++				if (insn->detail->mipsen.operands[i].type == (mips_op_type)op_type)
+ 					count++;
+ 				if (count == post)
+ 					return i;
Index: main/patches/patch-include_capstone_h
===================================================================
RCS file: main/patches/patch-include_capstone_h
diff -N main/patches/patch-include_capstone_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/patches/patch-include_capstone_h	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,16 @@
+$OpenBSD: patch-include_capstone_h,v 1.3 2015/05/09 06:50:02 benoit Exp $
+
+The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
+conflict.
+
+--- include/capstone.h.orig	Fri May  8 11:06:59 2015
++++ include/capstone.h	Sat May  9 08:34:16 2015
+@@ -225,7 +225,7 @@ typedef struct cs_detail {
+ 		cs_x86 x86;	// X86 architecture, including 16-bit, 32-bit & 64-bit mode
+ 		cs_arm64 arm64;	// ARM64 architecture (aka AArch64)
+ 		cs_arm arm;		// ARM architecture (including Thumb/Thumb2)
+-		cs_mips mips;	// MIPS architecture
++		cs_mips mipsen;	// MIPS architecture
+ 		cs_ppc ppc;	// PowerPC architecture
+ 		cs_sparc sparc;	// Sparc architecture
+ 		cs_sysz sysz;	// SystemZ architecture
Index: main/patches/patch-tests_test_mips_c
===================================================================
RCS file: main/patches/patch-tests_test_mips_c
diff -N main/patches/patch-tests_test_mips_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/patches/patch-tests_test_mips_c	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,32 @@
+$OpenBSD: patch-tests_test_mips_c,v 1.3 2015/02/04 07:33:11 benoit Exp $
+
+The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
+conflict.
+
+--- tests/test_mips.c.orig	Tue Feb  3 15:41:07 2015
++++ tests/test_mips.c	Wed Feb  4 08:05:44 2015
+@@ -32,18 +32,18 @@ static void print_string_hex(char *comment, unsigned c
+ static void print_insn_detail(cs_insn *ins)
+ {
+ 	int i;
+-	cs_mips *mips;
++	cs_mips *mipsen;
+ 
+ 	// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
+ 	if (ins->detail == NULL)
+ 		return;
+ 
+-	mips = &(ins->detail->mips);
+-	if (mips->op_count)
+-		printf("\top_count: %u\n", mips->op_count);
++	mipsen = &(ins->detail->mipsen);
++	if (mipsen->op_count)
++		printf("\top_count: %u\n", mipsen->op_count);
+ 
+-	for (i = 0; i < mips->op_count; i++) {
+-		cs_mips_op *op = &(mips->operands[i]);
++	for (i = 0; i < mipsen->op_count; i++) {
++		cs_mips_op *op = &(mipsen->operands[i]);
+ 		switch((int)op->type) {
+ 			default:
+ 				break;
Index: main/pkg/DESCR
===================================================================
RCS file: main/pkg/DESCR
diff -N main/pkg/DESCR
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/pkg/DESCR	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,2 @@
+Capstone is a lightweight multi-platform, multi-architecture disassembly
+framework.
Index: main/pkg/PLIST
===================================================================
RCS file: main/pkg/PLIST
diff -N main/pkg/PLIST
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ main/pkg/PLIST	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,16 @@
+@comment $OpenBSD: PLIST,v 1.4 2014/11/19 21:59:31 benoit Exp $
+@pkgpath devel/capstone
+include/capstone/
+include/capstone/arm.h
+include/capstone/arm64.h
+include/capstone/capstone.h
+include/capstone/mips.h
+include/capstone/platform.h
+include/capstone/ppc.h
+include/capstone/sparc.h
+include/capstone/systemz.h
+include/capstone/x86.h
+include/capstone/xcore.h
+lib/libcapstone.a
+@lib lib/libcapstone.so.${LIBcapstone_VERSION}
+lib/pkgconfig/capstone.pc
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- patches/patch-Makefile	3 Oct 2016 07:39:59 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,92 +0,0 @@
-$OpenBSD: patch-Makefile,v 1.8 2016/10/03 07:39:59 feinerer Exp $
-
-1. Do not force some compilation flags.
-2. Set library version, respecting OpenBSD policy.
-3. Avoid duplication of defines, linked to (2).
-4. Do not use $(INSTALL_*) at the build stage.
-
---- Makefile.orig	Fri May  8 11:06:59 2015
-+++ Makefile	Sat May  9 08:34:16 2015
-@@ -30,7 +30,7 @@ ifneq (,$(findstring yes,$(CAPSTONE_DIET)))
- CFLAGS ?= -Os
- CFLAGS += -DCAPSTONE_DIET
- else
--CFLAGS ?= -O3
-+CFLAGS ?= 
- endif
- 
- ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
-@@ -82,8 +82,11 @@ INSTALL_DATA ?= $(INSTALL_BIN) -m0644
- INSTALL_LIB ?= $(INSTALL_BIN) -m0755
- 
- LIBNAME = capstone
-+LIBVER ?= 0.0.0
-+ifdef LIB$(LIBNAME)_VERSION
-+LIBVER = $(LIB$(LIBNAME)_VERSION)
-+endif
- 
--
- DEP_ARM =
- DEP_ARM += arch/ARM/ARMGenAsmWriter.inc
- DEP_ARM += arch/ARM/ARMGenDisassemblerTables.inc
-@@ -282,7 +285,7 @@ else
- EXT = so
- VERSION_EXT = $(EXT).$(API_MAJOR)
- AR_EXT = a
--$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(VERSION_EXT)
-+$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(EXT).$(LIBVER)
- endif
- endif
- endif
-@@ -293,7 +296,7 @@ LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
- else ifeq ($(IS_CYGWIN),1)
- LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
- else	# *nix
--LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT)
-+LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT).$(LIBVER)
- CFLAGS += -fvisibility=hidden
- endif
- endif
-@@ -320,7 +323,7 @@ else
- 	cd tests && $(MAKE) BUILDDIR=$(BLDIR)
- endif
- ifeq ($(CAPSTONE_SHARED),yes)
--	$(INSTALL_DATA) $(LIBRARY) $(BLDIR)/tests/
-+	cp $(LIBRARY) $(BLDIR)/tests/
- endif
- endif
- 
-@@ -367,13 +370,9 @@ endif
- install: $(PKGCFGF) $(ARCHIVE) $(LIBRARY)
- 	mkdir -p $(LIBDIR)
- ifeq ($(CAPSTONE_SHARED),yes)
--	$(INSTALL_LIB) $(LIBRARY) $(LIBDIR)
--ifneq ($(VERSION_EXT),)
--	cd $(LIBDIR) && \
--	mv lib$(LIBNAME).$(EXT) lib$(LIBNAME).$(VERSION_EXT) && \
--	ln -s lib$(LIBNAME).$(VERSION_EXT) lib$(LIBNAME).$(EXT)
-+	$(INSTALL_LIBRARY) $(LIBRARY) $(LIBDIR)
-+	$(INSTALL_DATA) $(ARCHIVE) $(LIBDIR)
- endif
--endif
- ifeq ($(CAPSTONE_STATIC),yes)
- 	$(INSTALL_DATA) $(ARCHIVE) $(LIBDIR)
- endif
-@@ -383,13 +382,12 @@ endif
- 	$(INSTALL_DATA) $(PKGCFGF) $(PKGCFGDIR)/
- 
- uninstall:
--	rm -rf $(INCDIR)/$(LIBNAME)
--	rm -f $(LIBDIR)/lib$(LIBNAME).*
--	rm -f $(PKGCFGDIR)/$(LIBNAME).pc
-+	rm -f $(LIBDIR)/$(LIBRARY)
-+	rm -f $(LIBDIR)/$(ARCHIVE)
-+	rm -f $(LIBDIR)/pkgconfig/$(PKGCFGF)
- 
- clean:
--	rm -f $(LIBOBJ)
--	rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).*
-+	rm -f $(LIBOBJ) $(ARCHIVE) $(LIBRARY)
- 	rm -f $(PKGCFGF)
- 
- ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
Index: patches/patch-arch_Mips_MipsInstPrinter_c
===================================================================
RCS file: patches/patch-arch_Mips_MipsInstPrinter_c
diff -N patches/patch-arch_Mips_MipsInstPrinter_c
--- patches/patch-arch_Mips_MipsInstPrinter_c	9 May 2015 06:50:02 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,88 +0,0 @@
-$OpenBSD: patch-arch_Mips_MipsInstPrinter_c,v 1.3 2015/05/09 06:50:02 benoit Exp $
-
-The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
-conflict.
-
---- arch/Mips/MipsInstPrinter.c.orig	Fri May  8 11:06:59 2015
-+++ arch/Mips/MipsInstPrinter.c	Sat May  9 08:34:16 2015
-@@ -93,12 +93,12 @@ static void set_mem_access(MCInst *MI, bool status)
- 		return;
- 
- 	if (status) {
--		MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_MEM;
--		MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.base = MIPS_REG_INVALID;
--		MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.disp = 0;
-+		MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_MEM;
-+		MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.base = MIPS_REG_INVALID;
-+		MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.disp = 0;
- 	} else {
- 		// done, create the next operand slot
--		MI->flat_insn->detail->mips.op_count++;
-+		MI->flat_insn->detail->mipsen.op_count++;
- 	}
- }
- 
-@@ -195,11 +195,11 @@ static void printOperand(MCInst *MI, unsigned OpNo, SS
- 		reg = Mips_map_register(reg);
- 		if (MI->csh->detail) {
- 			if (MI->csh->doing_mem) {
--				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.base = reg;
-+				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.base = reg;
- 			} else {
--				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_REG;
--				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].reg = reg;
--				MI->flat_insn->detail->mips.op_count++;
-+				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_REG;
-+				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].reg = reg;
-+				MI->flat_insn->detail->mipsen.op_count++;
- 			}
- 		}
- 	} else if (MCOperand_isImm(Op)) {
-@@ -219,7 +219,7 @@ static void printOperand(MCInst *MI, unsigned OpNo, SS
- 				}
- 			}
- 			if (MI->csh->detail)
--				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].mem.disp = imm;
-+				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].mem.disp = imm;
- 		} else {
- 			if (imm >= 0) {
- 				if (imm > HEX_THRESHOLD)
-@@ -234,9 +234,9 @@ static void printOperand(MCInst *MI, unsigned OpNo, SS
- 			}
- 
- 			if (MI->csh->detail) {
--				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
--				MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = imm;
--				MI->flat_insn->detail->mips.op_count++;
-+				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_IMM;
-+				MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].imm = imm;
-+				MI->flat_insn->detail->mipsen.op_count++;
- 			}
- 		}
- 	}
-@@ -259,9 +259,9 @@ static void printUnsignedImm(MCInst *MI, int opNum, SS
- 				SStream_concat(O, "-%u", (short int)-imm);
- 		}
- 		if (MI->csh->detail) {
--			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
--			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = (unsigned short int)imm;
--			MI->flat_insn->detail->mips.op_count++;
-+			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_IMM;
-+			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].imm = (unsigned short int)imm;
-+			MI->flat_insn->detail->mipsen.op_count++;
- 		}
- 	} else
- 		printOperand(MI, opNum, O);
-@@ -277,9 +277,9 @@ static void printUnsignedImm8(MCInst *MI, int opNum, S
- 		else
- 			SStream_concat(O, "%u", imm);
- 		if (MI->csh->detail) {
--			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].type = MIPS_OP_IMM;
--			MI->flat_insn->detail->mips.operands[MI->flat_insn->detail->mips.op_count].imm = imm;
--			MI->flat_insn->detail->mips.op_count++;
-+			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].type = MIPS_OP_IMM;
-+			MI->flat_insn->detail->mipsen.operands[MI->flat_insn->detail->mipsen.op_count].imm = imm;
-+			MI->flat_insn->detail->mipsen.op_count++;
- 		}
- 	} else
- 		printOperand(MI, opNum, O);
Index: patches/patch-cs_c
===================================================================
RCS file: patches/patch-cs_c
diff -N patches/patch-cs_c
--- patches/patch-cs_c	9 May 2015 06:50:02 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-$OpenBSD: patch-cs_c,v 1.4 2015/05/09 06:50:02 benoit Exp $
-
-The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
-conflict.
-
---- cs.c.orig	Fri May  8 11:06:59 2015
-+++ cs.c	Sat May  9 08:34:16 2015
-@@ -919,8 +919,8 @@ int cs_op_count(csh ud, const cs_insn *insn, unsigned 
- 					count++;
- 			break;
- 		case CS_ARCH_MIPS:
--			for (i = 0; i < insn->detail->mips.op_count; i++)
--				if (insn->detail->mips.operands[i].type == (mips_op_type)op_type)
-+			for (i = 0; i < insn->detail->mipsen.op_count; i++)
-+				if (insn->detail->mipsen.operands[i].type == (mips_op_type)op_type)
- 					count++;
- 			break;
- 		case CS_ARCH_PPC:
-@@ -1005,8 +1005,8 @@ int cs_op_index(csh ud, const cs_insn *insn, unsigned 
- 			}
- 			break;
- 		case CS_ARCH_MIPS:
--			for (i = 0; i < insn->detail->mips.op_count; i++) {
--				if (insn->detail->mips.operands[i].type == (mips_op_type)op_type)
-+			for (i = 0; i < insn->detail->mipsen.op_count; i++) {
-+				if (insn->detail->mipsen.operands[i].type == (mips_op_type)op_type)
- 					count++;
- 				if (count == post)
- 					return i;
Index: patches/patch-include_capstone_h
===================================================================
RCS file: patches/patch-include_capstone_h
diff -N patches/patch-include_capstone_h
--- patches/patch-include_capstone_h	9 May 2015 06:50:02 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-include_capstone_h,v 1.3 2015/05/09 06:50:02 benoit Exp $
-
-The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
-conflict.
-
---- include/capstone.h.orig	Fri May  8 11:06:59 2015
-+++ include/capstone.h	Sat May  9 08:34:16 2015
-@@ -225,7 +225,7 @@ typedef struct cs_detail {
- 		cs_x86 x86;	// X86 architecture, including 16-bit, 32-bit & 64-bit mode
- 		cs_arm64 arm64;	// ARM64 architecture (aka AArch64)
- 		cs_arm arm;		// ARM architecture (including Thumb/Thumb2)
--		cs_mips mips;	// MIPS architecture
-+		cs_mips mipsen;	// MIPS architecture
- 		cs_ppc ppc;	// PowerPC architecture
- 		cs_sparc sparc;	// Sparc architecture
- 		cs_sysz sysz;	// SystemZ architecture
Index: patches/patch-tests_test_mips_c
===================================================================
RCS file: patches/patch-tests_test_mips_c
diff -N patches/patch-tests_test_mips_c
--- patches/patch-tests_test_mips_c	4 Feb 2015 07:33:11 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-$OpenBSD: patch-tests_test_mips_c,v 1.3 2015/02/04 07:33:11 benoit Exp $
-
-The 'mips' symbol is special on MIPS platforms, so rename it to prevent a
-conflict.
-
---- tests/test_mips.c.orig	Tue Feb  3 15:41:07 2015
-+++ tests/test_mips.c	Wed Feb  4 08:05:44 2015
-@@ -32,18 +32,18 @@ static void print_string_hex(char *comment, unsigned c
- static void print_insn_detail(cs_insn *ins)
- {
- 	int i;
--	cs_mips *mips;
-+	cs_mips *mipsen;
- 
- 	// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
- 	if (ins->detail == NULL)
- 		return;
- 
--	mips = &(ins->detail->mips);
--	if (mips->op_count)
--		printf("\top_count: %u\n", mips->op_count);
-+	mipsen = &(ins->detail->mipsen);
-+	if (mipsen->op_count)
-+		printf("\top_count: %u\n", mipsen->op_count);
- 
--	for (i = 0; i < mips->op_count; i++) {
--		cs_mips_op *op = &(mips->operands[i]);
-+	for (i = 0; i < mipsen->op_count; i++) {
-+		cs_mips_op *op = &(mipsen->operands[i]);
- 		switch((int)op->type) {
- 			default:
- 				break;
Index: pkg/DESCR
===================================================================
RCS file: pkg/DESCR
diff -N pkg/DESCR
--- pkg/DESCR	24 Jan 2014 22:47:46 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-Capstone is a lightweight multi-platform, multi-architecture disassembly
-framework.
Index: pkg/PLIST
===================================================================
RCS file: pkg/PLIST
diff -N pkg/PLIST
--- pkg/PLIST	19 Nov 2014 21:59:31 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-@comment $OpenBSD: PLIST,v 1.4 2014/11/19 21:59:31 benoit Exp $
-include/capstone/
-include/capstone/arm.h
-include/capstone/arm64.h
-include/capstone/capstone.h
-include/capstone/mips.h
-include/capstone/platform.h
-include/capstone/ppc.h
-include/capstone/sparc.h
-include/capstone/systemz.h
-include/capstone/x86.h
-include/capstone/xcore.h
-lib/libcapstone.a
-@lib lib/libcapstone.so.${LIBcapstone_VERSION}
-lib/pkgconfig/capstone.pc
Index: python/Makefile
===================================================================
RCS file: python/Makefile
diff -N python/Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ python/Makefile	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,27 @@
+# $OpenBSD: Makefile,v 1.10 2017/04/09 11:08:07 jasper Exp $
+
+COMMENT =	Python bindings for capstone
+
+MODPY_EGG_VERSION = ${VERSION}
+
+PKGNAME =	py-${DISTNAME}
+
+MODULES =	lang/python
+USE_GMAKE =	Yes
+
+WRKDIST =	${WRKDIR}/${DISTNAME}/bindings/python
+
+FLAVORS =	python3
+FLAVOR ?=
+
+RUN_DEPENDS =	devel/capstone/main
+
+TEST_DEPENDS =  devel/capstone/python
+TEST_TARGET = 	check
+
+MODPY_ADJ_FILES = test*.py
+
+do-test:
+	cd ${WRKSRC} && ${MAKE_PROGRAM} ${TEST_TARGET}
+
+.include <bsd.port.mk>
Index: python/distinfo
===================================================================
RCS file: python/distinfo
diff -N python/distinfo
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ python/distinfo	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,2 @@
+SHA256 (capstone-3.0.4.tar.gz) = Poir32iZ0RiX8uBkYZ7cxzHMjpfp1NuGSVcCVRuzrn8=
+SIZE (capstone-3.0.4.tar.gz) = 2774764
Index: python/pkg/DESCR
===================================================================
RCS file: python/pkg/DESCR
diff -N python/pkg/DESCR
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ python/pkg/DESCR	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1 @@
+Python bindings for Capstone.
Index: python/pkg/PLIST
===================================================================
RCS file: python/pkg/PLIST
diff -N python/pkg/PLIST
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ python/pkg/PLIST	19 Sep 2017 18:50:52 -0000
@@ -0,0 +1,38 @@
+@comment $OpenBSD$
+lib/python${MODPY_VERSION}/site-packages/capstone/
+lib/python${MODPY_VERSION}/site-packages/capstone-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info
+lib/python${MODPY_VERSION}/site-packages/capstone/__init__.py
+${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}/
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}arm.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}arm64.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}arm64_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}arm_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}mips.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}mips_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}ppc.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}ppc_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}sparc.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}sparc_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}systemz.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}sysz_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}x86.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}x86_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}xcore.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/${MODPY_PYCACHE}xcore_const.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/capstone/arm.py
+lib/python${MODPY_VERSION}/site-packages/capstone/arm64.py
+lib/python${MODPY_VERSION}/site-packages/capstone/arm64_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/arm_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/mips.py
+lib/python${MODPY_VERSION}/site-packages/capstone/mips_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/ppc.py
+lib/python${MODPY_VERSION}/site-packages/capstone/ppc_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/sparc.py
+lib/python${MODPY_VERSION}/site-packages/capstone/sparc_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/systemz.py
+lib/python${MODPY_VERSION}/site-packages/capstone/sysz_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/x86.py
+lib/python${MODPY_VERSION}/site-packages/capstone/x86_const.py
+lib/python${MODPY_VERSION}/site-packages/capstone/xcore.py
+lib/python${MODPY_VERSION}/site-packages/capstone/xcore_const.py

Reply via email to