Gentoo Archives: gentoo-commits

From: Alessandro Barbieri <lssndrbarbieri@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: app-editors/imhex/, app-editors/imhex/files/
Date: Sun, 04 Jul 2021 10:58:35
Message-Id: 1625396249.c277f9004f24cd056df72790b26ec78b6ce3e3c9.Alessandro-Barbieri@gentoo
1 commit: c277f9004f24cd056df72790b26ec78b6ce3e3c9
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Sun Jul 4 10:57:29 2021 +0000
4 Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
5 CommitDate: Sun Jul 4 10:57:29 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c277f900
7
8 app-editors/imhex: initial import
9
10 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
11
12 app-editors/imhex/Manifest | 1 +
13 .../imhex/files/imhex-1.8.1-fix-yara-linking.patch | 11 +++
14 app-editors/imhex/files/imhex-1.8.1-gcc11.patch | 11 +++
15 .../imhex-1.8.1-system-nativefiledialog.patch | 19 ++++
16 .../imhex/files/imhex-1.8.1-system-xdgpp.patch | 11 +++
17 app-editors/imhex/imhex-1.8.1.ebuild | 106 +++++++++++++++++++++
18 app-editors/imhex/metadata.xml | 77 +++++++++++++++
19 7 files changed, 236 insertions(+)
20
21 diff --git a/app-editors/imhex/Manifest b/app-editors/imhex/Manifest
22 new file mode 100644
23 index 000000000..aae2af6f2
24 --- /dev/null
25 +++ b/app-editors/imhex/Manifest
26 @@ -0,0 +1 @@
27 +DIST imhex-1.8.1.tar.gz 1758664 BLAKE2B 62c58358810bd4f1192495001d01fc6c6fe8f28a35adc1478c8b2d0dab0fd929c0f46018c9afd51c1094cbae0c04002f4887fb2fb9377b6c645abaee006b9a03 SHA512 c6ec73a282c9eb90b58d164c29abbef3dceba09aa706a8295cecdcb429d5efa4015fac0dd0a3111eae3efe667f5b16f063624bf188a00a400fc06b008e3b51f8
28
29 diff --git a/app-editors/imhex/files/imhex-1.8.1-fix-yara-linking.patch b/app-editors/imhex/files/imhex-1.8.1-fix-yara-linking.patch
30 new file mode 100644
31 index 000000000..54754d241
32 --- /dev/null
33 +++ b/app-editors/imhex/files/imhex-1.8.1-fix-yara-linking.patch
34 @@ -0,0 +1,11 @@
35 +--- a/CMakeLists.txt
36 ++++ b/CMakeLists.txt
37 +@@ -93,7 +93,7 @@
38 + if (WIN32)
39 + target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} wsock32 ws2_32 libyara)
40 + else ()
41 +- target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread libyara)
42 ++ target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread yara)
43 + endif ()
44 +
45 + createPackage()
46
47 diff --git a/app-editors/imhex/files/imhex-1.8.1-gcc11.patch b/app-editors/imhex/files/imhex-1.8.1-gcc11.patch
48 new file mode 100644
49 index 000000000..7c62768ea
50 --- /dev/null
51 +++ b/app-editors/imhex/files/imhex-1.8.1-gcc11.patch
52 @@ -0,0 +1,11 @@
53 +--- a/plugins/libimhex/include/hex/helpers/utils.hpp
54 ++++ b/plugins/libimhex/include/hex/helpers/utils.hpp
55 +@@ -25,7 +25,7 @@
56 + #define fopen64 fopen
57 + #define fseeko64 fseek
58 + #define ftello64 ftell
59 +-#else
60 ++#elif __cplusplus < 201703L
61 + template<>
62 + struct std::is_integral<u128> : public std::true_type { };
63 + template<>
64
65 diff --git a/app-editors/imhex/files/imhex-1.8.1-system-nativefiledialog.patch b/app-editors/imhex/files/imhex-1.8.1-system-nativefiledialog.patch
66 new file mode 100644
67 index 000000000..185b35469
68 --- /dev/null
69 +++ b/app-editors/imhex/files/imhex-1.8.1-system-nativefiledialog.patch
70 @@ -0,0 +1,19 @@
71 +--- a/plugins/libimhex/CMakeLists.txt
72 ++++ b/plugins/libimhex/CMakeLists.txt
73 +@@ -12,7 +12,6 @@
74 + find_package(nlohmann_json REQUIRED)
75 + endif()
76 +
77 +-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nativefiledialog ${CMAKE_CURRENT_BINARY_DIR}/external/nativefiledialog EXCLUDE_FROM_ALL)
78 + if(NOT USE_SYSTEM_FMT)
79 + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt)
80 + else()
81 +@@ -32,7 +31,7 @@
82 + pkg_check_modules(LIBCURL REQUIRED IMPORTED_TARGET libcurl)
83 + endif()
84 +
85 +-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
86 ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -lnfd")
87 +
88 + set(CMAKE_SHARED_LIBRARY_PREFIX "")
89 +
90
91 diff --git a/app-editors/imhex/files/imhex-1.8.1-system-xdgpp.patch b/app-editors/imhex/files/imhex-1.8.1-system-xdgpp.patch
92 new file mode 100644
93 index 000000000..511fe67ea
94 --- /dev/null
95 +++ b/app-editors/imhex/files/imhex-1.8.1-system-xdgpp.patch
96 @@ -0,0 +1,11 @@
97 +--- a/plugins/libimhex/CMakeLists.txt
98 ++++ b/plugins/libimhex/CMakeLists.txt
99 +@@ -19,7 +19,7 @@
100 + find_package(fmt REQUIRED)
101 + endif()
102 +
103 +-set(XDGPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../external/xdgpp")
104 ++set(XDGPP_INCLUDE_DIRS "/usr/include")
105 + set(CMAKE_USE_MBEDTLS ON)
106 + set(BUILD_CURL_EXE OFF)
107 + set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
108
109 diff --git a/app-editors/imhex/imhex-1.8.1.ebuild b/app-editors/imhex/imhex-1.8.1.ebuild
110 new file mode 100644
111 index 000000000..8f9fd4480
112 --- /dev/null
113 +++ b/app-editors/imhex/imhex-1.8.1.ebuild
114 @@ -0,0 +1,106 @@
115 +# Copyright 1999-2021 Gentoo Authors
116 +# Distributed under the terms of the GNU General Public License v2
117 +
118 +EAPI="7"
119 +
120 +CMAKE_BUILD_TYPE="Release"
121 +CMAKE_MAKEFILE_GENERATOR="emake"
122 +LLVM_MAX_SLOT=12
123 +PYTHON_COMPAT=( python3_{8..10} )
124 +
125 +inherit cmake desktop llvm python-single-r1 xdg-utils
126 +
127 +DESCRIPTION="A hex editor for reverse engineers, programmers, and eyesight"
128 +HOMEPAGE="https://github.com/WerWolv/ImHex"
129 +SRC_URI="https://github.com/WerWolv/ImHex/archive/v${PV}.tar.gz -> ${P}.tar.gz"
130 +S="${WORKDIR}/ImHex-${PV}"
131 +
132 +LICENSE="GPL-2"
133 +SLOT="0"
134 +KEYWORDS="~amd64"
135 +
136 +DEPEND="
137 + ${PYTHON_DEPS}
138 + app-forensics/yara
139 + dev-cpp/nlohmann_json
140 + dev-cpp/xdgpp
141 + dev-libs/capstone
142 + <dev-libs/libfmt-8.0.0
143 + dev-libs/nativefiledialog-extended
144 + dev-libs/openssl
145 + dev-libs/tre
146 + media-libs/freetype
147 + media-libs/glfw
148 + media-libs/glm
149 + net-libs/mbedtls
150 + net-misc/curl
151 + sys-apps/file
152 + sys-devel/llvm:${LLVM_MAX_SLOT}
153 + virtual/libiconv
154 + virtual/libintl
155 +"
156 +RDEPEND="${DEPEND}"
157 +BDEPEND="app-admin/chrpath"
158 +
159 +PATCHES=(
160 + "${FILESDIR}/${P}-gcc11.patch"
161 + "${FILESDIR}/${P}-system-xdgpp.patch"
162 + "${FILESDIR}/${P}-system-nativefiledialog.patch"
163 + "${FILESDIR}/${P}-fix-yara-linking.patch"
164 +)
165 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
166 +
167 +src_prepare() {
168 + rm -r external/{curl,fmt,llvm,nativefiledialog,nlohmann_json,xdgpp,yara} || die
169 + cmake_src_prepare
170 +}
171 +
172 +src_configure() {
173 + python_setup
174 + local mycmakeargs=(
175 + -DPROJECT_VERSION="${PV}"
176 + -DUSE_SYSTEM_CURL=ON
177 + -DUSE_SYSTEM_FMT=ON
178 + -DUSE_SYSTEM_LLVM=ON
179 + -DUSE_SYSTEM_NLOHMANN_JSON=ON
180 + -DUSE_SYSTEM_YARA=ON
181 + )
182 + cmake_src_configure
183 +}
184 +
185 +src_install() {
186 + # can't use cmake_src_install, doing it manual
187 + dobin "${BUILD_DIR}/${PN}"
188 + insinto "/usr/$(get_libdir)"
189 + doins "${BUILD_DIR}/plugins/builtin/builtin.hexplug"
190 + dolib.so "${BUILD_DIR}/plugins/lib${PN}/lib${PN}.so"
191 + insinto "/usr/share/${PN}"
192 + doins "${S}/res/icon.ico"
193 + doins -r "${S}/res/resources"
194 + insinto "/usr/share/${PN}/magic"
195 + newins "${BUILD_DIR}/magic_dbs.mgc" "magic.mgc"
196 +
197 + chrpath -d "${ED}/usr/bin/imhex"
198 + chrpath -d "${ED}/usr/$(get_libdir)/builtin.hexplug"
199 +
200 + mypythondir="${D}/$(python_get_sitedir)/imhex"
201 + mkdir -p "${mypythondir}" || die
202 + mv "${S}"/python_libs/lib/* "${mypythondir}" || die
203 + python_optimize "${mypythondir}"
204 +
205 + # create desktop icon
206 + make_desktop_entry "imhex" "ImHex" "/usr/share/${PN}/icon.ico" "X-Editor"
207 +
208 + # install docs
209 + einstalldocs
210 +}
211 +
212 +pkg_postinst() {
213 + xdg_desktop_database_update
214 + xdg_mimeinfo_database_update
215 +}
216 +
217 +pkg_postrm() {
218 + xdg_desktop_database_update
219 + xdg_mimeinfo_database_update
220 +}
221
222 diff --git a/app-editors/imhex/metadata.xml b/app-editors/imhex/metadata.xml
223 new file mode 100644
224 index 000000000..03dbc45fc
225 --- /dev/null
226 +++ b/app-editors/imhex/metadata.xml
227 @@ -0,0 +1,77 @@
228 +<?xml version="1.0" encoding="UTF-8"?>
229 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
230 +<pkgmetadata>
231 + <maintainer type="person">
232 + <description>co-maintainers welcome</description>
233 + <email>lssndrbarbieri@×××××.com</email>
234 + <name>Alessandro Barbieri</name>
235 + </maintainer>
236 + <upstream>
237 + <changelog>https://github.com/WerWolv/ImHex/releases</changelog>
238 + <bugs-to>https://github.com/WerWolv/ImHex/issues</bugs-to>
239 + </upstream>
240 + <longdescription lang="en">
241 +Features
242 +
243 +Featureful hex view
244 +Byte patching
245 +Patch management
246 +Copy bytes as feature
247 +Bytes
248 +Hex string
249 +C, C++, C sharp, Rust, Python, Java and JavaScript array
250 +ASCII-Art hex view
251 +HTML self contained div
252 +String and hex search
253 +Colorful highlighting
254 +Goto from start, end and current cursor position
255 +Custom C++-like pattern language for parsing highlighting a file's content
256 +Automatic loading based on MIME type
257 +arrays, pointers, structs, unions, enums, bitfields, using declarations, little and big endian support, conditionals and much more!
258 +Useful error messages, syntax highlighting and error marking
259 +Data importing
260 +Base64 files
261 +IPS and IPS32 patches
262 +Data exporting
263 +IPS and IPS32 patches
264 +Data inspector allowing interpretation of data as many different types (little and big endian)
265 +Huge file support with fast and efficient loading
266 +String search
267 +Copying of strings
268 +Copying of demangled strings
269 +File hashing support
270 +CRC16 and CRC32 with custom initial values and polynomials
271 +MD4, MD5
272 +SHA-1, SHA-224, SHA-256, SHA-384, SHA-512
273 +Disassembler supporting many different architectures
274 +ARM32 (ARM, Thumb, Cortex-M, AArch32)
275 +ARM64
276 +MIPS (MIPS32, MIPS64, MIPS32R6, Micro)
277 +x86 (16-bit, 32-bit, 64-bit)
278 +PowerPC (32-bit, 64-bit)
279 +SPARC
280 +IBM SystemZ
281 +xCORE
282 +M68K
283 +TMS320C64X
284 +M680X
285 +Ethereum
286 +Bookmarks
287 +Region highlighting
288 +Comments
289 +Data Analyzer
290 +File magic-based file parser and MIME type database
291 +Byte distribution graph
292 +Entropy graph
293 +Highest and average entropy
294 +Encrypted / Compressed file detection
295 +Helpful tools
296 +Itanium and MSVC demangler
297 +ASCII table
298 +Regex replacer
299 +Mathematical expression evaluator (Calculator)
300 +Hexadecimal Color picker
301 +Built-in cheat sheet for pattern language and Math evaluator
302 +Doesn't burn out your retinas when used in late-night sessions
303 + </longdescription>
304 +</pkgmetadata>