Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: app-editors/imhex/
Date: Thu, 08 Sep 2022 09:31:58
Message-Id: 1662609278.71e281d115da9bdb59cfca587a61f8035f03a6e4.andrewammerlaan@gentoo
1 commit: 71e281d115da9bdb59cfca587a61f8035f03a6e4
2 Author: Huang Rui <vowstar <AT> gmail <DOT> com>
3 AuthorDate: Thu Sep 8 03:54:38 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 8 03:54:38 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=71e281d1
7
8 app-editors/imhex: improved ebuild and fix 866464
9
10 Improved ebuild, thanks @tastytea
11
12 Closes: https://bugs.gentoo.org/866464
13 Signed-off-by: Huang Rui <vowstar <AT> gmail.com>
14
15 app-editors/imhex/imhex-1.22.0-r1.ebuild | 133 +++++++++++++++++++++++++++++++
16 1 file changed, 133 insertions(+)
17
18 diff --git a/app-editors/imhex/imhex-1.22.0-r1.ebuild b/app-editors/imhex/imhex-1.22.0-r1.ebuild
19 new file mode 100644
20 index 000000000..6d16b8837
21 --- /dev/null
22 +++ b/app-editors/imhex/imhex-1.22.0-r1.ebuild
23 @@ -0,0 +1,133 @@
24 +# Copyright 1999-2022 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=8
28 +
29 +CMAKE_BUILD_TYPE="Release"
30 +CMAKE_MAKEFILE_GENERATOR="emake"
31 +PYTHON_COMPAT=( python3_{8..11} )
32 +
33 +inherit cmake desktop llvm python-r1 xdg
34 +
35 +DESCRIPTION="A hex editor for reverse engineers, programmers, and eyesight"
36 +HOMEPAGE="https://github.com/WerWolv/ImHex"
37 +SRC_URI="
38 + https://github.com/WerWolv/ImHex/releases/download/v${PV}/Full.Sources.tar.gz -> ${P}.tar.gz
39 + https://github.com/WerWolv/ImHex-Patterns/archive/refs/tags/ImHex-v${PV}.tar.gz -> ${PN}-patterns-${PV}.tar.gz
40 +"
41 +S="${WORKDIR}/ImHex"
42 +S_PATTERNS="${WORKDIR}/ImHex-Patterns-ImHex-v${PV}"
43 +
44 +LICENSE="GPL-2"
45 +SLOT="0"
46 +KEYWORDS="~amd64"
47 +IUSE="python"
48 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
49 +
50 +DEPEND="
51 + python? ( ${PYTHON_DEPS} )
52 + app-forensics/yara
53 + >=dev-cpp/nlohmann_json-3.10.2
54 + dev-libs/capstone
55 + >=dev-libs/libfmt-8.0.0:=
56 + dev-libs/openssl
57 + dev-libs/tre
58 + media-libs/freetype
59 + media-libs/glfw
60 + media-libs/glm
61 + net-libs/libssh2
62 + net-libs/mbedtls
63 + net-misc/curl
64 + sys-apps/dbus
65 + sys-apps/file
66 + sys-apps/xdg-desktop-portal
67 + virtual/libiconv
68 + virtual/libintl
69 +"
70 +RDEPEND="${DEPEND}"
71 +BDEPEND="
72 + app-admin/chrpath
73 + gnome-base/librsvg
74 + sys-devel/llvm
75 +"
76 +
77 +src_prepare() {
78 + default
79 + # Due to network sandboxing, we can't do network test here.
80 + sed -i \
81 + -e 's/StoreAPI$/#StoreAPI/' \
82 + -e 's/TipsAPI$/#TipsAPI/' \
83 + -e 's/ContentAPI$/#ContentAPI/' \
84 + "${S}/tests/helpers/CMakeLists.txt" || die
85 + cmake_src_prepare
86 +}
87 +
88 +src_configure() {
89 + use python && python_setup
90 +
91 + local mycmakeargs=(
92 + -D CMAKE_SKIP_RPATH=ON \
93 + -D IMHEX_IGNORE_BAD_CLONE=ON \
94 + -D IMHEX_OFFLINE_BUILD=ON \
95 + -D IMHEX_STRIP_RELEASE=OFF \
96 + -D IMHEX_VERSION="${PV}" \
97 + -D PROJECT_VERSION="${PV}" \
98 + -D USE_SYSTEM_CAPSTONE=ON \
99 + -D USE_SYSTEM_CURL=ON \
100 + -D USE_SYSTEM_FMT=ON \
101 + -D USE_SYSTEM_LLVM=ON \
102 + -D USE_SYSTEM_NLOHMANN_JSON=ON \
103 + -D USE_SYSTEM_YARA=ON
104 + )
105 + if use python; then
106 + mycmakeargs+=( -D PYTHON_VERSION_MAJOR_MINOR="\"${EPYTHON/python/}\"" )
107 + fi
108 + cmake_src_configure
109 +}
110 +
111 +src_test() {
112 + pushd "${BUILD_DIR}" || die
113 + emake unit_tests
114 + popd || die
115 + cmake_src_test
116 +}
117 +
118 +src_install() {
119 + # Can't use cmake_src_install, doing it manual
120 + # Executable
121 + dobin "${BUILD_DIR}/${PN}"
122 + chrpath -d "${ED}/usr/bin/${PN}" || die
123 + # Shared lib and plugins
124 + dolib.so "${BUILD_DIR}"/lib/lib"${PN}"/lib"${PN}".so*
125 + chrpath -d "${ED}"/usr/"$(get_libdir)"/lib"${PN}".so* || die
126 + exeinto "/usr/$(get_libdir)/${PN}/plugins"
127 + for plugin in builtin; do
128 + doexe "${BUILD_DIR}/plugins/${plugin}.hexplug"
129 + chrpath -d "${ED}/usr/$(get_libdir)/${PN}/plugins/${plugin}.hexplug" || die
130 + done
131 + # Desktop and icon files
132 + domenu "${S}/dist/${PN}.desktop"
133 + newicon -s scalable "${S}/resources/icon.svg" "${PN}.svg"
134 + for i in 16 22 24 32 36 48 64 72 96 128 192 256 512; do
135 + mkdir "${T}/${i}x${i}" || die
136 + rsvg-convert -a -f png -w "${i}" -o "${T}/${i}x${i}/${PN}.png" "${S}/resources/icon.svg" || die
137 + doicon -s "${i}" "${T}/${i}x${i}/${PN}.png"
138 + done
139 +
140 + if use python; then
141 + installation() {
142 + mypythondir="${D}/$(python_get_sitedir)/${PN}"
143 + mkdir -p "${mypythondir}" || die
144 + cp -r "${S}"/resources/lib/python/lib/* "${mypythondir}" || die
145 + python_optimize "${mypythondir}"
146 + }
147 + python_foreach_impl installation
148 + fi
149 +
150 + # Install docs
151 + einstalldocs
152 +
153 + # Install patterns
154 + insinto /usr/share/imhex
155 + doins -r "${S_PATTERNS}"/*
156 +}