app-editors/imhex: initial import

Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2021-07-04 12:57:29 +02:00
parent f4f9d84119
commit c277f9004f
7 changed files with 236 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST imhex-1.8.1.tar.gz 1758664 BLAKE2B 62c58358810bd4f1192495001d01fc6c6fe8f28a35adc1478c8b2d0dab0fd929c0f46018c9afd51c1094cbae0c04002f4887fb2fb9377b6c645abaee006b9a03 SHA512 c6ec73a282c9eb90b58d164c29abbef3dceba09aa706a8295cecdcb429d5efa4015fac0dd0a3111eae3efe667f5b16f063624bf188a00a400fc06b008e3b51f8

View File

@@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,7 +93,7 @@
if (WIN32)
target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} wsock32 ws2_32 libyara)
else ()
- target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread libyara)
+ target_link_libraries(imhex magic ${CMAKE_DL_LIBS} capstone LLVMDemangle libimhex ${Python_LIBRARIES} dl pthread yara)
endif ()
createPackage()

View File

@@ -0,0 +1,11 @@
--- a/plugins/libimhex/include/hex/helpers/utils.hpp
+++ b/plugins/libimhex/include/hex/helpers/utils.hpp
@@ -25,7 +25,7 @@
#define fopen64 fopen
#define fseeko64 fseek
#define ftello64 ftell
-#else
+#elif __cplusplus < 201703L
template<>
struct std::is_integral<u128> : public std::true_type { };
template<>

View File

@@ -0,0 +1,19 @@
--- a/plugins/libimhex/CMakeLists.txt
+++ b/plugins/libimhex/CMakeLists.txt
@@ -12,7 +12,6 @@
find_package(nlohmann_json REQUIRED)
endif()
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nativefiledialog ${CMAKE_CURRENT_BINARY_DIR}/external/nativefiledialog EXCLUDE_FROM_ALL)
if(NOT USE_SYSTEM_FMT)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt)
else()
@@ -32,7 +31,7 @@
pkg_check_modules(LIBCURL REQUIRED IMPORTED_TARGET libcurl)
endif()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -lnfd")
set(CMAKE_SHARED_LIBRARY_PREFIX "")

View File

@@ -0,0 +1,11 @@
--- a/plugins/libimhex/CMakeLists.txt
+++ b/plugins/libimhex/CMakeLists.txt
@@ -19,7 +19,7 @@
find_package(fmt REQUIRED)
endif()
-set(XDGPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../external/xdgpp")
+set(XDGPP_INCLUDE_DIRS "/usr/include")
set(CMAKE_USE_MBEDTLS ON)
set(BUILD_CURL_EXE OFF)
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")

View File

@@ -0,0 +1,106 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
CMAKE_BUILD_TYPE="Release"
CMAKE_MAKEFILE_GENERATOR="emake"
LLVM_MAX_SLOT=12
PYTHON_COMPAT=( python3_{8..10} )
inherit cmake desktop llvm python-single-r1 xdg-utils
DESCRIPTION="A hex editor for reverse engineers, programmers, and eyesight"
HOMEPAGE="https://github.com/WerWolv/ImHex"
SRC_URI="https://github.com/WerWolv/ImHex/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/ImHex-${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
DEPEND="
${PYTHON_DEPS}
app-forensics/yara
dev-cpp/nlohmann_json
dev-cpp/xdgpp
dev-libs/capstone
<dev-libs/libfmt-8.0.0
dev-libs/nativefiledialog-extended
dev-libs/openssl
dev-libs/tre
media-libs/freetype
media-libs/glfw
media-libs/glm
net-libs/mbedtls
net-misc/curl
sys-apps/file
sys-devel/llvm:${LLVM_MAX_SLOT}
virtual/libiconv
virtual/libintl
"
RDEPEND="${DEPEND}"
BDEPEND="app-admin/chrpath"
PATCHES=(
"${FILESDIR}/${P}-gcc11.patch"
"${FILESDIR}/${P}-system-xdgpp.patch"
"${FILESDIR}/${P}-system-nativefiledialog.patch"
"${FILESDIR}/${P}-fix-yara-linking.patch"
)
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
src_prepare() {
rm -r external/{curl,fmt,llvm,nativefiledialog,nlohmann_json,xdgpp,yara} || die
cmake_src_prepare
}
src_configure() {
python_setup
local mycmakeargs=(
-DPROJECT_VERSION="${PV}"
-DUSE_SYSTEM_CURL=ON
-DUSE_SYSTEM_FMT=ON
-DUSE_SYSTEM_LLVM=ON
-DUSE_SYSTEM_NLOHMANN_JSON=ON
-DUSE_SYSTEM_YARA=ON
)
cmake_src_configure
}
src_install() {
# can't use cmake_src_install, doing it manual
dobin "${BUILD_DIR}/${PN}"
insinto "/usr/$(get_libdir)"
doins "${BUILD_DIR}/plugins/builtin/builtin.hexplug"
dolib.so "${BUILD_DIR}/plugins/lib${PN}/lib${PN}.so"
insinto "/usr/share/${PN}"
doins "${S}/res/icon.ico"
doins -r "${S}/res/resources"
insinto "/usr/share/${PN}/magic"
newins "${BUILD_DIR}/magic_dbs.mgc" "magic.mgc"
chrpath -d "${ED}/usr/bin/imhex"
chrpath -d "${ED}/usr/$(get_libdir)/builtin.hexplug"
mypythondir="${D}/$(python_get_sitedir)/imhex"
mkdir -p "${mypythondir}" || die
mv "${S}"/python_libs/lib/* "${mypythondir}" || die
python_optimize "${mypythondir}"
# create desktop icon
make_desktop_entry "imhex" "ImHex" "/usr/share/${PN}/icon.ico" "X-Editor"
# install docs
einstalldocs
}
pkg_postinst() {
xdg_desktop_database_update
xdg_mimeinfo_database_update
}
pkg_postrm() {
xdg_desktop_database_update
xdg_mimeinfo_database_update
}

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<description>co-maintainers welcome</description>
<email>lssndrbarbieri@gmail.com</email>
<name>Alessandro Barbieri</name>
</maintainer>
<upstream>
<changelog>https://github.com/WerWolv/ImHex/releases</changelog>
<bugs-to>https://github.com/WerWolv/ImHex/issues</bugs-to>
</upstream>
<longdescription lang="en">
Features
Featureful hex view
Byte patching
Patch management
Copy bytes as feature
Bytes
Hex string
C, C++, C sharp, Rust, Python, Java and JavaScript array
ASCII-Art hex view
HTML self contained div
String and hex search
Colorful highlighting
Goto from start, end and current cursor position
Custom C++-like pattern language for parsing highlighting a file's content
Automatic loading based on MIME type
arrays, pointers, structs, unions, enums, bitfields, using declarations, little and big endian support, conditionals and much more!
Useful error messages, syntax highlighting and error marking
Data importing
Base64 files
IPS and IPS32 patches
Data exporting
IPS and IPS32 patches
Data inspector allowing interpretation of data as many different types (little and big endian)
Huge file support with fast and efficient loading
String search
Copying of strings
Copying of demangled strings
File hashing support
CRC16 and CRC32 with custom initial values and polynomials
MD4, MD5
SHA-1, SHA-224, SHA-256, SHA-384, SHA-512
Disassembler supporting many different architectures
ARM32 (ARM, Thumb, Cortex-M, AArch32)
ARM64
MIPS (MIPS32, MIPS64, MIPS32R6, Micro)
x86 (16-bit, 32-bit, 64-bit)
PowerPC (32-bit, 64-bit)
SPARC
IBM SystemZ
xCORE
M68K
TMS320C64X
M680X
Ethereum
Bookmarks
Region highlighting
Comments
Data Analyzer
File magic-based file parser and MIME type database
Byte distribution graph
Entropy graph
Highest and average entropy
Encrypted / Compressed file detection
Helpful tools
Itanium and MSVC demangler
ASCII table
Regex replacer
Mathematical expression evaluator (Calculator)
Hexadecimal Color picker
Built-in cheat sheet for pattern language and Math evaluator
Doesn't burn out your retinas when used in late-night sessions
</longdescription>
</pkgmetadata>