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/files/, app-editors/imhex/
Date: Sun, 26 Sep 2021 18:37:16
Message-Id: 1632681428.5710f27e70a191c65bc9c07cc68011cf118ff727.Alessandro-Barbieri@gentoo
1 commit: 5710f27e70a191c65bc9c07cc68011cf118ff727
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Sat Sep 25 20:20:02 2021 +0000
4 Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
5 CommitDate: Sun Sep 26 18:37:08 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5710f27e
7
8 app-editors/imhex: add 1.10.0
9
10 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
11
12 app-editors/imhex/Manifest | 1 +
13 .../files/imhex-1.10.0-fix-yara-linking.patch | 11 +++
14 .../imhex/files/imhex-1.10.0-link-mbedtls.patch | 14 +++
15 .../files/imhex-1.10.0-no-lnlohmann_json.patch | 14 +++
16 app-editors/imhex/imhex-1.10.0.ebuild | 106 +++++++++++++++++++++
17 5 files changed, 146 insertions(+)
18
19 diff --git a/app-editors/imhex/Manifest b/app-editors/imhex/Manifest
20 index aae2af6f2..d9a07528d 100644
21 --- a/app-editors/imhex/Manifest
22 +++ b/app-editors/imhex/Manifest
23 @@ -1 +1,2 @@
24 +DIST imhex-1.10.0.tar.gz 8509953 BLAKE2B e258693f44d5524a86c88e29152bfe9777a149236f146a16b88bc7a49d3450f1b46138649a830c7164175afaea3c0d5e76c998e3e65020627b3c978c504431bb SHA512 03d84e30d5ee064ef2c3faf5cb40965f2c94b41e4d8b3e2e3e800f079d0710f0660b4c751dc0c4516b9b19bbf57df44a102ae61fa41d56606ce1f37c9aa8313c
25 DIST imhex-1.8.1.tar.gz 1758664 BLAKE2B 62c58358810bd4f1192495001d01fc6c6fe8f28a35adc1478c8b2d0dab0fd929c0f46018c9afd51c1094cbae0c04002f4887fb2fb9377b6c645abaee006b9a03 SHA512 c6ec73a282c9eb90b58d164c29abbef3dceba09aa706a8295cecdcb429d5efa4015fac0dd0a3111eae3efe667f5b16f063624bf188a00a400fc06b008e3b51f8
26
27 diff --git a/app-editors/imhex/files/imhex-1.10.0-fix-yara-linking.patch b/app-editors/imhex/files/imhex-1.10.0-fix-yara-linking.patch
28 new file mode 100644
29 index 000000000..d1a5f4afa
30 --- /dev/null
31 +++ b/app-editors/imhex/files/imhex-1.10.0-fix-yara-linking.patch
32 @@ -0,0 +1,11 @@
33 +--- a/CMakeLists.txt
34 ++++ b/CMakeLists.txt
35 +@@ -93,7 +93,7 @@
36 + if (WIN32)
37 + target_link_libraries(imhex ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} wsock32 ws2_32 libyara Dwmapi.lib dl)
38 + else ()
39 +- target_link_libraries(imhex ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread libyara)
40 ++ target_link_libraries(imhex ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread yara)
41 + endif ()
42 +
43 + createPackage()
44
45 diff --git a/app-editors/imhex/files/imhex-1.10.0-link-mbedtls.patch b/app-editors/imhex/files/imhex-1.10.0-link-mbedtls.patch
46 new file mode 100644
47 index 000000000..087faef0b
48 --- /dev/null
49 +++ b/app-editors/imhex/files/imhex-1.10.0-link-mbedtls.patch
50 @@ -0,0 +1,14 @@
51 +--- a/plugins/libimhex/CMakeLists.txt
52 ++++ b/plugins/libimhex/CMakeLists.txt
53 +@@ -95,9 +95,9 @@
54 +
55 + if (APPLE)
56 + find_library(FOUNDATION NAMES Foundation)
57 +- target_link_libraries(libimhex PUBLIC imgui mbedcrypto ${FOUNDATION} nfd fmt-header-only libcurl magic)
58 ++ target_link_libraries(libimhex PUBLIC imgui mbedtls ${FOUNDATION} nfd fmt-header-only libcurl magic)
59 + else ()
60 +- target_link_libraries(libimhex PUBLIC imgui mbedcrypto nfd magic)
61 ++ target_link_libraries(libimhex PUBLIC imgui mbedtls nfd magic)
62 +
63 + if (NOT USE_SYSTEM_FMT)
64 + target_link_libraries(libimhex PUBLIC fmt-header-only)
65
66 diff --git a/app-editors/imhex/files/imhex-1.10.0-no-lnlohmann_json.patch b/app-editors/imhex/files/imhex-1.10.0-no-lnlohmann_json.patch
67 new file mode 100644
68 index 000000000..63f77e60f
69 --- /dev/null
70 +++ b/app-editors/imhex/files/imhex-1.10.0-no-lnlohmann_json.patch
71 @@ -0,0 +1,14 @@
72 +--- a/plugins/libimhex/CMakeLists.txt
73 ++++ b/plugins/libimhex/CMakeLists.txt
74 +@@ -95,9 +95,9 @@
75 +
76 + if (APPLE)
77 + find_library(FOUNDATION NAMES Foundation)
78 +- target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto ${FOUNDATION} nfd fmt-header-only libcurl magic)
79 ++ target_link_libraries(libimhex PUBLIC imgui mbedcrypto ${FOUNDATION} nfd fmt-header-only libcurl magic)
80 + else ()
81 +- target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto nfd magic)
82 ++ target_link_libraries(libimhex PUBLIC imgui mbedcrypto nfd magic)
83 +
84 + if (NOT USE_SYSTEM_FMT)
85 + target_link_libraries(libimhex PUBLIC fmt-header-only)
86
87 diff --git a/app-editors/imhex/imhex-1.10.0.ebuild b/app-editors/imhex/imhex-1.10.0.ebuild
88 new file mode 100644
89 index 000000000..511463ff0
90 --- /dev/null
91 +++ b/app-editors/imhex/imhex-1.10.0.ebuild
92 @@ -0,0 +1,106 @@
93 +# Copyright 1999-2021 Gentoo Authors
94 +# Distributed under the terms of the GNU General Public License v2
95 +
96 +EAPI=7
97 +
98 +CMAKE_BUILD_TYPE="Release"
99 +CMAKE_MAKEFILE_GENERATOR="emake"
100 +LLVM_MAX_SLOT=12
101 +PYTHON_COMPAT=( python3_{8..10} )
102 +
103 +inherit cmake desktop llvm python-single-r1 xdg-utils
104 +
105 +DESCRIPTION="A hex editor for reverse engineers, programmers, and eyesight"
106 +HOMEPAGE="https://github.com/WerWolv/ImHex"
107 +SRC_URI="https://github.com/WerWolv/ImHex/archive/v${PV}.tar.gz -> ${P}.tar.gz"
108 +S="${WORKDIR}/ImHex-${PV}"
109 +
110 +LICENSE="GPL-2"
111 +SLOT="0"
112 +KEYWORDS="~amd64"
113 +
114 +DEPEND="
115 + ${PYTHON_DEPS}
116 + app-forensics/yara
117 + >=dev-cpp/nlohmann_json-3.10.2
118 + dev-cpp/xdgpp
119 + dev-libs/capstone
120 + >=dev-libs/libfmt-8.0.0
121 + dev-libs/nativefiledialog-extended
122 + dev-libs/openssl
123 + dev-libs/tre
124 + media-libs/freetype
125 + media-libs/glfw
126 + media-libs/glm
127 + net-libs/mbedtls
128 + net-misc/curl
129 + sys-apps/file
130 + sys-devel/llvm:${LLVM_MAX_SLOT}
131 + virtual/libiconv
132 + virtual/libintl
133 +"
134 +RDEPEND="${DEPEND}"
135 +BDEPEND="app-admin/chrpath"
136 +
137 +PATCHES=(
138 + "${FILESDIR}/${PN}-1.8.1-system-xdgpp.patch"
139 + "${FILESDIR}/${PN}-1.8.1-system-nativefiledialog.patch"
140 + "${FILESDIR}/${P}-fix-yara-linking.patch"
141 + "${FILESDIR}/${P}-no-lnlohmann_json.patch"
142 + "${FILESDIR}/${P}-link-mbedtls.patch"
143 +)
144 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
145 +
146 +src_prepare() {
147 + rm -r external/{curl,fmt,llvm,nativefiledialog,nlohmann_json,xdgpp,yara} || die
148 + cmake_src_prepare
149 +}
150 +
151 +src_configure() {
152 + python-single-r1_pkg_setup
153 + local mycmakeargs=(
154 + -DPROJECT_VERSION="${PV}"
155 + -DPYTHON_VERSION_MAJOR_MINOR="\"${EPYTHON/python/}\""
156 + -DUSE_SYSTEM_CURL=ON
157 + -DUSE_SYSTEM_FMT=ON
158 + -DUSE_SYSTEM_LLVM=ON
159 + -DUSE_SYSTEM_NLOHMANN_JSON=ON
160 + -DUSE_SYSTEM_YARA=ON
161 + )
162 + cmake_src_configure
163 +}
164 +
165 +src_install() {
166 + # can't use cmake_src_install, doing it manual
167 + dobin "${BUILD_DIR}/${PN}"
168 + insinto "/usr/$(get_libdir)"
169 + doins "${BUILD_DIR}/plugins/builtin/builtin.hexplug"
170 + dolib.so "${BUILD_DIR}/plugins/lib${PN}/lib${PN}.so"
171 + insinto "/usr/share/${PN}"
172 + doins "${S}/res/icon.ico"
173 + doins -r "${S}/res/resources"
174 +
175 + chrpath -d "${ED}/usr/bin/imhex"
176 + chrpath -d "${ED}/usr/$(get_libdir)/builtin.hexplug"
177 +
178 + mypythondir="${D}/$(python_get_sitedir)/imhex"
179 + mkdir -p "${mypythondir}" || die
180 + mv "${S}"/python_libs/lib/* "${mypythondir}" || die
181 + python_optimize "${mypythondir}"
182 +
183 + # create desktop icon
184 + make_desktop_entry "imhex" "ImHex" "/usr/share/${PN}/icon.ico" "X-Editor"
185 +
186 + # install docs
187 + einstalldocs
188 +}
189 +
190 +pkg_postinst() {
191 + xdg_desktop_database_update
192 + xdg_mimeinfo_database_update
193 +}
194 +
195 +pkg_postrm() {
196 + xdg_desktop_database_update
197 + xdg_mimeinfo_database_update
198 +}