devel/capstone: Multi-platform, multi-architecture disassembly framework [NEW PORT]

Capstone is a lightweight multi-platform, multi-architecture disassembly
framework.

Features:
 * Supported architectures: ARM, ARM64 (aka ARMv8), Mips, PowerPC & X86
 * Clean/simple/lightweight/intuitive architecture-neutral API
 * Provide details on disassembled instruction (called "decomposer")
 * Provide some semantics of the disassembled instruction, such as list of
   implicit registers read & written.
 * Implemented in pure C language, with bindings for Python, Ruby, C#, Java,
   GO, OCaml & Vala available.
 * Native support for Windows & *nix (including MacOSX, Linux, *BSD & Solaris)
 * Thread-safe by design
 * Distributed under the open source BSD license

WWW: http://capstone-engine.org/

PR:		ports/186102
Submitted by:	Oliver Pinter <oliver.pntr@gmail.com>
This commit is contained in:
Kubilay Kocak 2014-01-27 07:00:24 +00:00
parent 6d9c0ebc96
commit f7980a1f73
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=341330
7 changed files with 125 additions and 0 deletions

View File

@ -182,6 +182,7 @@
SUBDIR += c-unit
SUBDIR += c4
SUBDIR += calibrator
SUBDIR += capstone
SUBDIR += cbind
SUBDIR += cbrowser
SUBDIR += cc65

22
devel/capstone/Makefile Normal file
View File

@ -0,0 +1,22 @@
# $FreeBSD$
PORTNAME= capstone
PORTVERSION= 2.0
CATEGORIES= devel
MASTER_SITES= http://capstone-engine.org/download/2.0/
MAINTAINER= oliver.pntr@gmail.com
COMMENT= Multi-platform, multi-architecture disassembly framework
LICENSE= BSD3CLAUSE
USES= gmake
USE_LDCONFIG= yes
MAKE_ENV= INSTALL_LIBRARY="${INSTALL_LIB}"
post-build:
# The pkgconfig file is generated and points to stagedir
${REINPLACE_CMD} -e '/libdir/s|\(libdir=\)\(.*\)\(devel/capstone/work/stage\)|\1|g' ${WRKSRC}/capstone.pc
.include <bsd.port.mk>

2
devel/capstone/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (capstone-2.0.tar.gz) = 5d871b1e52047d1b2882bbcc6f049205ba6acc8d55d746937d22af5d0b33fa9e
SIZE (capstone-2.0.tar.gz) = 1731759

View File

@ -0,0 +1,52 @@
--- Makefile.orig 2014-01-22 11:33:35.000000000 +0100
+++ Makefile 2014-01-25 19:13:32.000000000 +0100
@@ -15,7 +15,7 @@
STRIP = $(CROSS)strip
endif
-CFLAGS += -fPIC -O3 -Wall -Iinclude
+CFLAGS += -fPIC -Wall -Iinclude
ifeq ($(USE_SYS_DYN_MEM),yes)
CFLAGS += -DUSE_SYS_DYN_MEM
@@ -38,6 +38,14 @@
endif
endif
+LIBDATADIR = $(LIBDIR)
+UNAME_S := $(shell uname -s)
+ifeq ($(UNAME_S), FreeBSD)
+LIBDATADIR = $(DESTDIR)$(PREFIX)/libdata
+else
+LIBDATADIR = $(LIBDIR)
+endif
+
INSTALL_BIN ?= install
INSTALL_DATA ?= $(INSTALL_BIN) -m0644
INSTALL_LIBRARY ?= $(INSTALL_BIN) -m0755
@@ -88,7 +96,6 @@
LIBOBJ += MCInst.o
-UNAME_S := $(shell uname -s)
# OSX?
ifeq ($(UNAME_S),Darwin)
EXT = dylib
@@ -156,14 +163,14 @@
$(INSTALL_DATA) lib$(LIBNAME).$(AR_EXT) $(LIBDIR)
mkdir -p $(INCDIR)/$(LIBNAME)
$(INSTALL_DATA) include/*.h $(INCDIR)/$(LIBNAME)
- mkdir -p $(LIBDIR)/pkgconfig
- $(INSTALL_DATA) $(PKGCFGF) $(LIBDIR)/pkgconfig/
+ mkdir -p $(LIBDATADIR)/pkgconfig
+ $(INSTALL_DATA) $(PKGCFGF) $(LIBDATADIR)/pkgconfig/
uninstall:
rm -rf $(INCDIR)/$(LIBNAME)
rm -f $(LIBDIR)/lib$(LIBNAME).$(EXT)
rm -f $(LIBDIR)/lib$(LIBNAME).$(AR_EXT)
- rm -f $(LIBDIR)/pkgconfig/$(LIBNAME).pc
+ rm -f $(LIBDATADIR)/pkgconfig/$(LIBNAME).pc
clean:
rm -f $(LIBOBJ) lib$(LIBNAME).*

View File

@ -0,0 +1,22 @@
--- tests/Makefile.orig 2014-01-25 19:14:03.000000000 +0100
+++ tests/Makefile 2014-01-25 19:14:24.000000000 +0100
@@ -11,7 +11,7 @@
endif
-CFLAGS += -fPIC -O3 -Wall -I$(INCDIR) -L$(LIBDIR)
+CFLAGS += -fPIC -Wall -I$(INCDIR) -L$(LIBDIR)
LIBNAME = capstone
@@ -48,8 +48,8 @@
$(BINARY): $(OBJS)
%$(BIN_EXT): %.o
- ${CC} $(CFLAGS) $(LDFLAGS) $< -O3 -Wall -l$(LIBNAME) -o $@
- ${CC} $(CFLAGS) $(LDFLAGS) $< -O3 -Wall ../lib$(LIBNAME).$(AR_EXT) -o $(subst $(BIN_EXT),,$@).static$(BIN_EXT)
+ ${CC} $(CFLAGS) $(LDFLAGS) $< -Wall -l$(LIBNAME) -o $@
+ ${CC} $(CFLAGS) $(LDFLAGS) $< -Wall ../lib$(LIBNAME).$(AR_EXT) -o $(subst $(BIN_EXT),,$@).static$(BIN_EXT)
%.o: %.c
${CC} ${CFLAGS} -c $< -o $@

16
devel/capstone/pkg-descr Normal file
View File

@ -0,0 +1,16 @@
Capstone is a lightweight multi-platform, multi-architecture disassembly
framework.
Features:
* Supported architectures: ARM, ARM64 (aka ARMv8), Mips, PowerPC & X86
* Clean/simple/lightweight/intuitive architecture-neutral API
* Provide details on disassembled instruction (called "decomposer")
* Provide some semantics of the disassembled instruction, such as list of
implicit registers read & written.
* Implemented in pure C language, with bindings for Python, Ruby, C#, Java,
GO, OCaml & Vala available.
* Native support for Windows & *nix (including MacOSX, Linux, *BSD & Solaris)
* Thread-safe by design
* Distributed under the open source BSD license
WWW: http://capstone-engine.org/

10
devel/capstone/pkg-plist Normal file
View File

@ -0,0 +1,10 @@
include/capstone/arm.h
include/capstone/arm64.h
include/capstone/capstone.h
include/capstone/mips.h
include/capstone/ppc.h
include/capstone/x86.h
lib/libcapstone.a
lib/libcapstone.so
libdata/pkgconfig/capstone.pc
@dirrmtry include/capstone