commit:     1ad7d6ae49a3522c71c69e999fd317f2eb147724
Author:     Mario Haustein <mario.haustein <AT> hrz <DOT> tu-chemnitz <DOT> de>
AuthorDate: Tue May 10 21:33:40 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 11 02:10:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ad7d6ae

dev-util/rizin: restrict to Capstone 4

Code doesn't build yet with Capstone 5.

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Mario Haustein <mario.haustein <AT> hrz.tu-chemnitz.de>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/rizin/rizin-0.3.4-r1.ebuild | 103 +++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/dev-util/rizin/rizin-0.3.4-r1.ebuild 
b/dev-util/rizin/rizin-0.3.4-r1.ebuild
new file mode 100644
index 000000000000..cc3e0fb5efbd
--- /dev/null
+++ b/dev-util/rizin/rizin-0.3.4-r1.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+# This is the commit that the CI for the release commit used
+BINS_COMMIT="aa6a88dcdfaad54335e3935c16ce21a124ff861d"
+
+inherit meson python-any-r1
+
+DESCRIPTION="reverse engineering framework for binary analysis"
+HOMEPAGE="https://rizin.re/";
+
+SRC_URI="mirror+https://github.com/rizinorg/rizin/releases/download/v${PV}/rizin-src-v${PV}.tar.xz
+       test? ( 
https://github.com/rizinorg/rizin-testbins/archive/${BINS_COMMIT}.tar.gz -> 
rizin-testbins-${BINS_COMMIT}.tar.gz )"
+KEYWORDS="~amd64 ~arm64 ~x86"
+
+LICENSE="Apache-2.0 BSD LGPL-3 MIT"
+SLOT="0/${PV}"
+IUSE="test"
+
+# Need to audit licenses of the binaries used for testing
+RESTRICT="fetch !test? ( test )"
+
+RDEPEND="
+       sys-apps/file
+       app-arch/lz4:0=
+       <dev-libs/capstone-5:0=
+       dev-libs/libuv:0=
+       dev-libs/libzip:0=
+       dev-libs/openssl:0=
+       >=dev-libs/tree-sitter-0.19.0
+       dev-libs/xxhash
+       sys-libs/zlib:0=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="${PYTHON_DEPS}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.3.0-typedb-prefix.patch"
+       "${FILESDIR}/${PN}-0.3.2-never-rebuild-parser.patch"
+)
+
+S="${WORKDIR}/${PN}-v${PV}"
+
+src_prepare() {
+       default
+
+       local py_to_mangle=(
+               librz/core/cmd_descs/cmd_descs_generate.py
+               
subprojects/lz4-1.9.3/contrib/meson/meson/GetLz4LibraryVersion.py
+               subprojects/lz4-1.9.3/contrib/meson/meson/InstallSymlink.py
+               subprojects/lz4-1.9.3/tests/test-lz4-list.py
+               subprojects/lz4-1.9.3/tests/test-lz4-speed.py
+               subprojects/lz4-1.9.3/tests/test-lz4-versions.py
+               sys/clang-format.py
+               test/fuzz/scripts/fuzz_rz_asm.py
+               test/scripts/gdbserver.py
+       )
+
+       python_fix_shebang "${py_to_mangle[@]}"
+
+       if use test; then
+               cp -r "${WORKDIR}/rizin-testbins-${BINS_COMMIT}" 
"${S}/test/bins" || die
+               cp -r "${WORKDIR}/rizin-testbins-${BINS_COMMIT}" "${S}" || die
+       fi
+}
+
+src_configure() {
+       local emesonargs=(
+               -Dcli=enabled
+               -Duse_sys_capstone=enabled
+               -Duse_sys_magic=enabled
+               -Duse_sys_libzip=enabled
+               -Duse_sys_zlib=enabled
+               -Duse_sys_lz4=enabled
+               -Duse_sys_xxhash=enabled
+               -Duse_sys_openssl=enabled
+               -Duse_sys_tree_sitter=enabled
+
+               $(meson_use test enable_tests)
+               $(meson_use test enable_rz_test)
+       )
+       meson_src_configure
+}
+
+src_test() {
+       # Rizin uses data files that it expects to be installed on the
+       # system. To hack around this, we create a tree of what it expects
+       # in ${T}, and patch the tests to support a prefix from the
+       # environment. https://github.com/rizinorg/rizin/issues/1789
+       mkdir -p "${T}/usr/share/${PN}/${PV}" || die
+       ln -sf "${BUILD_DIR}/librz/analysis/d" 
"${T}/usr/share/${PN}/${PV}/types" || die
+       ln -sf "${BUILD_DIR}/librz/syscall/d" 
"${T}/usr/share/${PN}/${PV}/syscall" || die
+       ln -sf "${BUILD_DIR}/librz/asm/d" "${T}/usr/share/${PN}/${PV}/opcodes" 
|| die
+       # https://github.com/rizinorg/rizin/issues/1797
+       ln -sf "${BUILD_DIR}/librz/flag/d" "${T}/usr/share/${PN}/${PV}/flag" || 
die
+       export RZ_PREFIX="${T}/usr"
+
+       meson_src_test
+}

Reply via email to