[gentoo-commits] repo/gentoo:master commit in: dev-libs/capstone/, dev-libs/capstone/files/

2024-06-01 Thread Sam James
commit: 9e75d69eba362f8033d454a2003bbd6afe22cbfd
Author: Mario Haustein  hrz  tu-chemnitz  de>
AuthorDate: Sun Apr 28 15:04:52 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Jun  2 00:40:48 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e75d69e

dev-libs/capstone: fix patch for upstream changes

Signed-off-by: Mario Haustein  hrz.tu-chemnitz.de>
Signed-off-by: Sam James  gentoo.org>

 dev-libs/capstone/capstone-.ebuild |  4 ++--
 dev-libs/capstone/files/capstone--werror.patch | 14 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/dev-libs/capstone/capstone-.ebuild 
b/dev-libs/capstone/capstone-.ebuild
index 12ef627d0db9..76028da788a3 100644
--- a/dev-libs/capstone/capstone-.ebuild
+++ b/dev-libs/capstone/capstone-.ebuild
@@ -37,8 +37,8 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
 PATCHES=(
# Currently "-Werror" is only added in the `next`-development branch, 
but
-   # not merged into 5.* releases. Eventually this patch may be needed in
-   # version 5 releas line. See bug #911481.
+   # not merged into 5.* releases. Eventually this patch may be needed in 
the
+   # version 5 release line. See bug #911481.
"${FILESDIR}/${P}-werror.patch"
 )
 

diff --git a/dev-libs/capstone/files/capstone--werror.patch 
b/dev-libs/capstone/files/capstone--werror.patch
index 1ec58fa056a3..d5f09ca7d656 100644
--- a/dev-libs/capstone/files/capstone--werror.patch
+++ b/dev-libs/capstone/files/capstone--werror.patch
@@ -2,12 +2,12 @@ Bug: https://bugs.gentoo.org/911481
 Upstream: https://github.com/capstone-engine/capstone/pull/2114
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -28,7 +28,7 @@ project(capstone
- if (MSVC)
- add_compile_options(/W1 /w14189)
- else()
--add_compile_options(-Werror -Wformat -Wmissing-braces -Wunused-function 
-Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context)
-+add_compile_options(-Wformat -Wmissing-braces -Wunused-function 
-Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context)
- endif()
+@@ -25,7 +25,7 @@ project(capstone
+ VERSION 5.0
+ )
  
+-set(UNIX_COMPILER_OPTIONS -Werror -Wall -Warray-bounds -Wshift-negative-value 
-Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds 
-Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
++set(UNIX_COMPILER_OPTIONS -Wall -Warray-bounds -Wshift-negative-value 
-Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds 
-Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
  
+ # maybe-unitialzied is only supported by newer versions of GCC.
+ # Unfortunately, it is pretty unreliable and reports wrong results.



[gentoo-commits] repo/gentoo:master commit in: dev-libs/capstone/, dev-libs/capstone/files/

2023-08-27 Thread Sam James
commit: f8ca69dcc50e60f841b3288e662a388800f6fd58
Author: Mario Haustein  hrz  tu-chemnitz  de>
AuthorDate: Sun Aug 27 16:47:20 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Aug 28 04:03:46 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8ca69dc

dev-libs/capstone: don't add -Werror to compiler options

Closes: https://bugs.gentoo.org/911481
Signed-off-by: Mario Haustein  hrz.tu-chemnitz.de>
Closes: https://github.com/gentoo/gentoo/pull/32478
Signed-off-by: Sam James  gentoo.org>

 dev-libs/capstone/capstone-.ebuild |  7 +++
 dev-libs/capstone/files/capstone--werror.patch | 13 +
 2 files changed, 20 insertions(+)

diff --git a/dev-libs/capstone/capstone-.ebuild 
b/dev-libs/capstone/capstone-.ebuild
index fd6e6133cc4f..6d46a0133be7 100644
--- a/dev-libs/capstone/capstone-.ebuild
+++ b/dev-libs/capstone/capstone-.ebuild
@@ -35,6 +35,13 @@ DEPEND="${RDEPEND}
 BDEPEND="${DISTUTILS_DEPS}"
 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
+PATCHES=(
+   # Currently "-Werror" is only added in the `next`-development branch, 
but
+   # not merged into 5.* releases. Eventually this patch may be needed in
+   # version 5 releas line. See bug #911481.
+   "${FILESDIR}/${P}-werror.patch"
+)
+
 distutils_enable_tests setup.py
 
 if [[ ${PV} == *_rc* ]]; then

diff --git a/dev-libs/capstone/files/capstone--werror.patch 
b/dev-libs/capstone/files/capstone--werror.patch
new file mode 100644
index ..1ec58fa056a3
--- /dev/null
+++ b/dev-libs/capstone/files/capstone--werror.patch
@@ -0,0 +1,13 @@
+Bug: https://bugs.gentoo.org/911481
+Upstream: https://github.com/capstone-engine/capstone/pull/2114
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -28,7 +28,7 @@ project(capstone
+ if (MSVC)
+ add_compile_options(/W1 /w14189)
+ else()
+-add_compile_options(-Werror -Wformat -Wmissing-braces -Wunused-function 
-Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context)
++add_compile_options(-Wformat -Wmissing-braces -Wunused-function 
-Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context)
+ endif()
+ 
+ 



[gentoo-commits] repo/gentoo:master commit in: dev-libs/capstone/, dev-libs/capstone/files/

2022-10-10 Thread Joonas Niilola
commit: cf6e9c648407a023b5383021d62310d93d60fb70
Author: Mario Haustein  hrz  tu-chemnitz  de>
AuthorDate: Thu Sep  8 06:05:15 2022 +
Commit: Joonas Niilola  gentoo  org>
CommitDate: Mon Oct 10 13:10:42 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf6e9c64

dev-libs/capstone: fix out of bound memory access

Closes: https://bugs.gentoo.org/865151
Signed-off-by: Mario Haustein  hrz.tu-chemnitz.de>
Closes: https://github.com/gentoo/gentoo/pull/27188
Signed-off-by: Joonas Niilola  gentoo.org>

 dev-libs/capstone/capstone-5.0_rc2-r2.ebuild   | 83 ++
 .../files/capstone-5.0_rc2-oob-mem-access.patch| 40 +++
 2 files changed, 123 insertions(+)

diff --git a/dev-libs/capstone/capstone-5.0_rc2-r2.ebuild 
b/dev-libs/capstone/capstone-5.0_rc2-r2.ebuild
new file mode 100644
index ..854077b25d6a
--- /dev/null
+++ b/dev-libs/capstone/capstone-5.0_rc2-r2.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit cmake distutils-r1 toolchain-funcs
+
+DESCRIPTION="disassembly/disassembler framework + bindings"
+HOMEPAGE="http://www.capstone-engine.org/;
+SRC_URI="https://github.com/capstone-engine/capstone/archive/${PV/_rc/-rc}.tar.gz
 -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/5" # libcapstone.so.5
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
+
+IUSE="python test"
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+   python? ( dev-python/setuptools[${PYTHON_USEDEP}] )
+"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+distutils_enable_tests setup.py
+
+S=${WORKDIR}/${P/_rc/-rc}
+
+PATCHES=(
+   "${FILESDIR}"/${P}-pkgconfig.patch
+   "${FILESDIR}"/${P}-oob-mem-access.patch
+)
+
+if [[ ${PV} == *_rc* ]]; then
+   # Upstream doesn't flag release candidates (bug 858350)
+   QA_PKGCONFIG_VERSION=""
+fi
+
+wrap_python() {
+   local phase=$1
+   shift
+
+   if use python; then
+   pushd bindings/python >/dev/null || die
+   distutils-r1_${phase} "$@"
+   popd >/dev/null || die
+   fi
+}
+
+src_prepare() {
+   tc-export RANLIB
+   cmake_src_prepare
+
+   wrap_python ${FUNCNAME}
+}
+
+src_configure() {
+   local mycmakeargs=(
+   -DCAPSTONE_BUILD_TESTS="$(usex test)"
+   )
+   cmake_src_configure
+
+   wrap_python ${FUNCNAME}
+}
+
+src_compile() {
+   cmake_src_compile
+
+   wrap_python ${FUNCNAME}
+}
+
+src_test() {
+   cmake_src_test
+
+   wrap_python ${FUNCNAME}
+}
+
+src_install() {
+   cmake_src_install
+
+   wrap_python ${FUNCNAME}
+}

diff --git a/dev-libs/capstone/files/capstone-5.0_rc2-oob-mem-access.patch 
b/dev-libs/capstone/files/capstone-5.0_rc2-oob-mem-access.patch
new file mode 100644
index ..4e538ef4d5fb
--- /dev/null
+++ b/dev-libs/capstone/files/capstone-5.0_rc2-oob-mem-access.patch
@@ -0,0 +1,40 @@
+Author: Mario Haustein 
+Date:   Mon Aug 22 18:52:19 2022 +0200
+
+PPC: fix out of bound memory access
+
+closes #1912
+
+Bug: https://bugs.gentoo.org/865151
+Upstream: https://github.com/capstone-engine/capstone/pull/1913
+
+diff --git a/arch/PowerPC/PPCInstPrinter.c b/arch/PowerPC/PPCInstPrinter.c
+index 22eef4ee..a5a30a8b 100644
+--- a/arch/PowerPC/PPCInstPrinter.c
 b/arch/PowerPC/PPCInstPrinter.c
+@@ -1116,7 +1116,8 @@ static char *stripRegisterPrefix(const char *RegName)
+   char *name = cs_strdup(RegName + 2);
+ 
+   // also strip the last 2 letters
+-  name[strlen(name) - 2] = '\0';
++  if(strlen(name) > 2)
++  name[strlen(name) - 2] = '\0';
+ 
+   return name;
+   }
+diff --git a/suite/cstest/issues.cs b/suite/cstest/issues.cs
+index e4fb6cfa..3183f43f 100644
+--- a/suite/cstest/issues.cs
 b/suite/cstest/issues.cs
+@@ -1,3 +1,11 @@
++!# issue 1912 PPC register name
++!# CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, None
++0x2d,0x03,0x00,0x80 == cmpwi cr2, r3, 0x80
++
++!# issue 1912 PPC no register name
++!# CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, CS_OPT_SYNTAX_NOREGNAME
++0x2d,0x03,0x00,0x80 == cmpwi 2, 3, 0x80
++
+ !# issue 1839 AArch64 Incorrect detailed disassembly of ldr
+ !# CS_ARCH_ARM64, CS_MODE_ARM, CS_OPT_DETAIL
+ 0x41,0x00,0x40,0xf9 == ldr x1, [x2] ; operands[0].access: WRITE ; 
operands[1].access: READ



[gentoo-commits] repo/gentoo:master commit in: dev-libs/capstone/, dev-libs/capstone/files/

2018-12-18 Thread Sergei Trofimovich
commit: e477d6aca1b5848044ed2f72fe6d78e7f5b966cd
Author: Sergei Trofimovich  gentoo  org>
AuthorDate: Wed Dec 19 00:37:36 2018 +
Commit: Sergei Trofimovich  gentoo  org>
CommitDate: Wed Dec 19 07:22:04 2018 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e477d6ac

dev-libs/capstone: bump up to 4.0

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich  gentoo.org>

 dev-libs/capstone/Manifest |  1 +
 dev-libs/capstone/capstone-4.0.ebuild  | 85 ++
 dev-libs/capstone/files/capstone-4.0-FLAGS.patch   | 20 +
 .../files/capstone-4.0-double-DESTDIR.patch| 12 +++
 .../files/capstone-4.0-no-fuzz-tests.patch | 10 +++
 5 files changed, 128 insertions(+)

diff --git a/dev-libs/capstone/Manifest b/dev-libs/capstone/Manifest
index 4832b61e74a..f3ffa497b09 100644
--- a/dev-libs/capstone/Manifest
+++ b/dev-libs/capstone/Manifest
@@ -1 +1,2 @@
 DIST capstone-3.0.5_rc2.tar.gz 2829338 BLAKE2B 
dd35fc6c31ec008f78840410ea0d20de56ea8f01c3af1d28488beaceee7fa06ce03c8cd0f56d834eb738d23f528d240693586122b9c1e353365f7348fb6f8362
 SHA512 
31bafdb0b3183d0c054a4244cc135db9a3c3dc5cb2e2af706bfede0d53cca8cba81d74b74ef9a4adbfd6c79cc408864dd80b8203791e17bd6c98bb69ea4f6894
+DIST capstone-4.0.tar.gz 3411532 BLAKE2B 
3e60a946e81f6d6ea88c314ad066e1855e2401cd9e8e61a67d48071b0fe4b705b2276b0d2b52d0979f472895a69cbe7609f6a2c60b79be668730f41ea98bf92e
 SHA512 
5a10c67e88b246ad905364c62c56b4741df242c22f1b62bdea171e4d1d43e484f42f30b33e17324be6cff4c6fb10365528a9c3f4b2a5339ad24b0564fdd40bdb

diff --git a/dev-libs/capstone/capstone-4.0.ebuild 
b/dev-libs/capstone/capstone-4.0.ebuild
new file mode 100644
index 000..78213838489
--- /dev/null
+++ b/dev-libs/capstone/capstone-4.0.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+
+inherit distutils-r1 toolchain-funcs
+
+DESCRIPTION="disassembly/disassembler framework + bindings"
+HOMEPAGE="http://www.capstone-engine.org/;
+SRC_URI="https://github.com/aquynh/${PN}/archive/${PV/_rc/-rc}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/4" # libcapstone.so.4
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+
+IUSE="python"
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}
+   python? ( dev-python/setuptools[${PYTHON_USEDEP}] )
+"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+PATCHES=(
+   "${FILESDIR}"/${P}-FLAGS.patch
+   "${FILESDIR}"/${P}-no-fuzz-tests.patch
+   "${FILESDIR}"/${P}-double-DESTDIR.patch
+)
+
+S=${WORKDIR}/${P/_rc/-rc}
+
+wrap_python() {
+   if use python; then
+   pushd bindings/python >/dev/null || die
+   distutils-r1_${1} "$@"
+   popd >/dev/null
+   fi
+}
+
+src_prepare() {
+   default
+
+   wrap_python ${FUNCNAME}
+}
+
+src_configure() {
+   {
+   cat <<-EOF
+   # Gentoo overrides:
+   #   verbose build
+   V = 1
+   #   toolchain
+   AR = $(tc-getAR)
+   CC = $(tc-getCC)
+   RANLIB = $(tc-getRANLIB)
+   #  toolchain flags
+   CFLAGS = ${CFLAGS}
+   LDFLAGS = ${LDFLAGS}
+   #  libs
+   LIBDIRARCH = $(get_libdir)
+   EOF
+   } >> config.mk || die
+
+   wrap_python ${FUNCNAME}
+}
+
+src_compile() {
+   default
+
+   wrap_python ${FUNCNAME}
+}
+
+src_test() {
+   default
+
+   wrap_python ${FUNCNAME}
+}
+
+src_install() {
+   default
+
+   wrap_python ${FUNCNAME}
+}

diff --git a/dev-libs/capstone/files/capstone-4.0-FLAGS.patch 
b/dev-libs/capstone/files/capstone-4.0-FLAGS.patch
new file mode 100644
index 000..66e855c0c34
--- /dev/null
+++ b/dev-libs/capstone/files/capstone-4.0-FLAGS.patch
@@ -0,0 +1,20 @@
+Drop -O3 and allow user to specify their optimizations.
+
+--- a/cstool/Makefile
 b/cstool/Makefile
+@@ -1,13 +1,14 @@
+ # Makefile for Cstool of Capstone Disassembly Engine
+ 
+ include ../functions.mk
++include ../config.mk
+ 
+ .PHONY: clean all
+ 
+ LIBNAME = capstone
+ 
+ CFLAGS += -I../include -I.
+-LDFLAGS += -O3 -Wall -L.. -l$(LIBNAME)
++LDFLAGS += -Wall -L.. -l$(LIBNAME)
+ 
+ TARGET = cstool
+ SOURCES := $(wildcard *.c)

diff --git a/dev-libs/capstone/files/capstone-4.0-double-DESTDIR.patch 
b/dev-libs/capstone/files/capstone-4.0-double-DESTDIR.patch
new file mode 100644
index 000..46aca725e40
--- /dev/null
+++ b/dev-libs/capstone/files/capstone-4.0-double-DESTDIR.patch
@@ -0,0 +1,12 @@
+https://github.com/aquynh/capstone/issues/1311
+
+Avoid double DESTDIR in install.
+--- a/Makefile
 b/Makefile
+@@ -75,4 +75,4 @@ LIBDIRARCH ?= lib
+ #LIBDIRARCH ?= lib64
+-LIBDIR = $(DESTDIR)$(PREFIX)/$(LIBDIRARCH)
+-BINDIR = $(DESTDIR)$(PREFIX)/bin
++LIBDIR = $(PREFIX)/$(LIBDIRARCH)
++BINDIR =