Gentoo Archives: gentoo-commits

From: John Helmert III <ajak@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/rizin/, dev-util/rizin/files/
Date: Mon, 04 Jul 2022 20:01:39
Message-Id: 1656964866.de8b82fad57e57633c0d3e4c666e4c8b916501cc.ajak@gentoo
1 commit: de8b82fad57e57633c0d3e4c666e4c8b916501cc
2 Author: John Helmert III <ajak <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 4 19:08:01 2022 +0000
4 Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 4 20:01:06 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de8b82fa
7
8 dev-util/rizin: add 0.4.0, enable py3.11
9
10 Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
11
12 dev-util/rizin/Manifest | 2 +
13 .../files/rizin-0.4.0-never-rebuild-parser.patch | 38 +++++++++
14 dev-util/rizin/rizin-0.4.0.ebuild | 94 ++++++++++++++++++++++
15 3 files changed, 134 insertions(+)
16
17 diff --git a/dev-util/rizin/Manifest b/dev-util/rizin/Manifest
18 index c38b64e65193..39d5687e41c8 100644
19 --- a/dev-util/rizin/Manifest
20 +++ b/dev-util/rizin/Manifest
21 @@ -1,2 +1,4 @@
22 DIST rizin-src-v0.3.4.tar.xz 10411432 BLAKE2B 99745f069e6bd72aec6a6f335f3aa0ccc46ebf186b1dc0aaf32b4f95d2be4bb49e8d3d976a72978c22fce82d896e70bf8403568e100b73898731045ef06a2ad5 SHA512 cda35afe8c031f3207c055ed31d7f76a46b7addd04cead0f5aadf0733b66f4dd953ca16f054b47da7921d4726d6ea1250436012954a9755c1cd524a8fd0d670c
23 +DIST rizin-src-v0.4.0.tar.xz 11432232 BLAKE2B 095ca9d317296afca9514a70f208e9aa87fc426e6b7e41163f64d5a1192a4d9ccd8ece9c4f13a24fc973668dece625fa13ad75542695a66c542fe2f0d9e66733 SHA512 9d576bee48e5ceae46b4e309c53e01b82edf89a95046f576e1c38fefa73353d6d1f04e6d444332324387d4e115bc87659a358629f7277a41dfef44c82364547b
24 +DIST rizin-testbins-64a6f26369bf5893ecc20cb8984a5ad506ef8566.tar.gz 172591261 BLAKE2B e78843fd95ac0406f66490b7253206e77787fc65780bc7c6a67d26aa9618a6f85803a88724ad424a7bdeeb20d95ebf9314e582029ac778d7d4de4f207ff54aad SHA512 ada4a3faad94553f0f2802419ba604177bb66d332b1a351effd485d65bd8365abb36d736486bbd0bcbc0da584ad4a2edaa7aa3cb62fa12811282c2e0afecb950
25 DIST rizin-testbins-aa6a88dcdfaad54335e3935c16ce21a124ff861d.tar.gz 127254454 BLAKE2B e7a4536be7169abd197c2128e103b8d669fbb7532ce265b27da3ce347b1aa58c8a96c95d85cf7700f66a44c041a0575175de3a0e176a0d31c490f7ccfb2f6d6b SHA512 20cf299e5324793f07f8a2fdcfa3d66c3a418f09bfc6a272e35ab31d4a64408bf91532ae431098dede1a2d0ad0b1c02433304c514816d98dc068f6c0528a4099
26
27 diff --git a/dev-util/rizin/files/rizin-0.4.0-never-rebuild-parser.patch b/dev-util/rizin/files/rizin-0.4.0-never-rebuild-parser.patch
28 new file mode 100644
29 index 000000000000..0e6e95c09318
30 --- /dev/null
31 +++ b/dev-util/rizin/files/rizin-0.4.0-never-rebuild-parser.patch
32 @@ -0,0 +1,38 @@
33 +commit 7af437dbedaaa478b579d19133b6711923b037d8
34 +Author: John Helmert III <ajak@g.o>
35 +Date: Mon Jul 4 12:44:43 2022 -0500
36 +
37 + subprojects/rizin-shell-parser/src: Never rebuild parser.c
38 +
39 + This requires dev-libs/tree-sitter[ts-cli] and net-libs/nodejs, both
40 + of which would be heavy new dependencies. However, these are only
41 + needed to rebuild the already-existing tree-sitter parser, which
42 + doesn't do much for us (if anything) since it already exists. In this
43 + case, it's better to just reduce fragility by unconditionally
44 + disabling this.
45 +
46 + Newly forward-ported from the 0.3.2 version.
47 +
48 + Bug: https://bugs.gentoo.org/830068
49 + Signed-off-by: John Helmert III <ajak@g.o>
50 +
51 +diff --git a/subprojects/rizin-shell-parser/src/meson.build b/subprojects/rizin-shell-parser/src/meson.build
52 +index ae31896a98..14324daba0 100644
53 +--- a/subprojects/rizin-shell-parser/src/meson.build
54 ++++ b/subprojects/rizin-shell-parser/src/meson.build
55 +@@ -1,14 +1,4 @@
56 +-tree_sitter_bin = find_program('tree-sitter', required: false)
57 +-node_bin = find_program('node', required: false)
58 +-if tree_sitter_bin.found() and node_bin.found() and tree_sitter_dep.type_name() != 'internal'
59 +- parser_c = custom_target('parser_src_c',
60 +- command: [tree_sitter_wrap_py, tree_sitter_bin, '@OUTDIR@/..', '@INPUT@'],
61 +- input: [grammar_js],
62 +- output: 'parser.c',
63 +- )
64 +-else
65 +- parser_c = files('parser.c')
66 +-endif
67 ++parser_c = files('parser.c')
68 +
69 + shell_parser_files = [files('scanner.c'), parser_c]
70 + shell_parser_inc = [include_directories('tree_sitter')]
71
72 diff --git a/dev-util/rizin/rizin-0.4.0.ebuild b/dev-util/rizin/rizin-0.4.0.ebuild
73 new file mode 100644
74 index 000000000000..7602de44178a
75 --- /dev/null
76 +++ b/dev-util/rizin/rizin-0.4.0.ebuild
77 @@ -0,0 +1,94 @@
78 +# Copyright 1999-2022 Gentoo Authors
79 +# Distributed under the terms of the GNU General Public License v2
80 +
81 +EAPI=8
82 +
83 +PYTHON_COMPAT=( python3_{9..11} )
84 +
85 +# This is the commit that the CI for the release commit used
86 +BINS_COMMIT="64a6f26369bf5893ecc20cb8984a5ad506ef8566"
87 +
88 +inherit meson python-any-r1
89 +
90 +DESCRIPTION="reverse engineering framework for binary analysis"
91 +HOMEPAGE="https://rizin.re/"
92 +
93 +SRC_URI="mirror+https://github.com/rizinorg/rizin/releases/download/v${PV}/rizin-src-v${PV}.tar.xz
94 + test? ( https://github.com/rizinorg/rizin-testbins/archive/${BINS_COMMIT}.tar.gz -> rizin-testbins-${BINS_COMMIT}.tar.gz )"
95 +KEYWORDS="~amd64 ~arm64 ~x86"
96 +
97 +LICENSE="Apache-2.0 BSD LGPL-3 MIT"
98 +SLOT="0/${PV}"
99 +IUSE="test"
100 +
101 +# Need to audit licenses of the binaries used for testing
102 +RESTRICT="fetch !test? ( test )"
103 +
104 +RDEPEND="
105 + sys-apps/file
106 + app-arch/lz4:0=
107 + <dev-libs/capstone-5:0=
108 + dev-libs/libuv:0=
109 + dev-libs/libzip:0=
110 + dev-libs/openssl:0=
111 + >=dev-libs/tree-sitter-0.19.0
112 + dev-libs/xxhash
113 + sys-libs/zlib:0=
114 +"
115 +DEPEND="${RDEPEND}"
116 +BDEPEND="${PYTHON_DEPS}"
117 +
118 +PATCHES=(
119 + "${FILESDIR}/${PN}-0.4.0-never-rebuild-parser.patch"
120 +)
121 +
122 +S="${WORKDIR}/${PN}-v${PV}"
123 +
124 +src_prepare() {
125 + default
126 +
127 + local py_to_mangle=(
128 + librz/core/cmd_descs/cmd_descs_generate.py
129 + subprojects/lz4-1.9.3/contrib/meson/meson/GetLz4LibraryVersion.py
130 + subprojects/lz4-1.9.3/contrib/meson/meson/InstallSymlink.py
131 + subprojects/lz4-1.9.3/tests/test-lz4-list.py
132 + subprojects/lz4-1.9.3/tests/test-lz4-speed.py
133 + subprojects/lz4-1.9.3/tests/test-lz4-versions.py
134 + sys/clang-format.py
135 + test/fuzz/scripts/fuzz_rz_asm.py
136 + test/scripts/gdbserver.py
137 + )
138 +
139 + python_fix_shebang "${py_to_mangle[@]}"
140 +
141 + if use test; then
142 + cp -r "${WORKDIR}/rizin-testbins-${BINS_COMMIT}" "${S}/test/bins" || die
143 + cp -r "${WORKDIR}/rizin-testbins-${BINS_COMMIT}" "${S}" || die
144 + fi
145 +}
146 +
147 +src_configure() {
148 + local emesonargs=(
149 + -Dcli=enabled
150 + -Duse_sys_capstone=enabled
151 + -Duse_sys_magic=enabled
152 + -Duse_sys_libzip=enabled
153 + -Duse_sys_zlib=enabled
154 + -Duse_sys_lz4=enabled
155 + -Duse_sys_xxhash=enabled
156 + -Duse_sys_openssl=enabled
157 + -Duse_sys_tree_sitter=enabled
158 +
159 + $(meson_use test enable_tests)
160 + $(meson_use test enable_rz_test)
161 + )
162 + meson_src_configure
163 +}
164 +
165 +src_test() {
166 + # We can select running either unit or integration tests, or all of
167 + # them by not passing --suite. According to upstream, integration
168 + # tests are more fragile and unit tests are sufficient for testing
169 + # packaging, so only run those.
170 + meson_src_test --suite unit
171 +}