From 51aa79ab0d2f83276d0500a14d2f81bb6b272390 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 3 May 2022 02:27:08 -0400 Subject: [PATCH] New package: imhex-1.18.1 closes #36954 --- srcpkgs/imhex-patterns | 1 + srcpkgs/imhex/patches/fix-cmake.patch | 20 ++++++++ srcpkgs/imhex/patches/no-Werror.patch | 37 ++++++++++++++ srcpkgs/imhex/template | 73 +++++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 120000 srcpkgs/imhex-patterns create mode 100644 srcpkgs/imhex/patches/fix-cmake.patch create mode 100644 srcpkgs/imhex/patches/no-Werror.patch create mode 100644 srcpkgs/imhex/template diff --git a/srcpkgs/imhex-patterns b/srcpkgs/imhex-patterns new file mode 120000 index 000000000000..9f335cad9f82 --- /dev/null +++ b/srcpkgs/imhex-patterns @@ -0,0 +1 @@ +imhex \ No newline at end of file diff --git a/srcpkgs/imhex/patches/fix-cmake.patch b/srcpkgs/imhex/patches/fix-cmake.patch new file mode 100644 index 000000000000..cfc209e8dcca --- /dev/null +++ b/srcpkgs/imhex/patches/fix-cmake.patch @@ -0,0 +1,20 @@ +upstream tries to detect a clone without submodules, but poorly +it also tries to pull in a repo at compile-time using git + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,6 @@ + + # Make sure project is configured correctly + setDefaultBuiltTypeIfUnset() +-detectBadClone() + + # List plugin names here. Project name must match folder name + set(PLUGINS +@@ -36,6 +36,3 @@ + + # Configure packaging + createPackage() +- +-# Download and install all current files from the ImHex-Patterns repo +-downloadImHexPatternsFiles() diff --git a/srcpkgs/imhex/patches/no-Werror.patch b/srcpkgs/imhex/patches/no-Werror.patch new file mode 100644 index 000000000000..0dcc3eded0da --- /dev/null +++ b/srcpkgs/imhex/patches/no-Werror.patch @@ -0,0 +1,37 @@ +--- a/lib/libimhex/CMakeLists.txt ++++ b/lib/libimhex/CMakeLists.txt +@@ -149,7 +149,7 @@ + + add_library(libimhex SHARED ${LIBIMHEX_SOURCES}) + set_target_properties(libimhex PROPERTIES POSITION_INDEPENDENT_CODE ON) +-target_compile_options(libimhex PRIVATE -Wall -Wextra -Werror) ++target_compile_options(libimhex PRIVATE -Wall -Wextra) + + target_include_directories(libimhex PUBLIC include ${XDGPP_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS} ${CAPSTONE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS} ${FMT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${YARA_INCLUDE_DIRS}) + target_link_directories(libimhex PUBLIC ${MBEDTLS_LIBRARY_DIR} ${CAPSTONE_LIBRARY_DIRS} ${MAGIC_LIBRARY_DIRS}) +--- a/main/CMakeLists.txt ++++ b/main/CMakeLists.txt +@@ -15,7 +15,7 @@ + ) + + target_include_directories(main PUBLIC include) +-target_compile_options(main PRIVATE -Wall -Wextra -Werror) ++target_compile_options(main PRIVATE -Wall -Wextra) + + set_target_properties(main PROPERTIES + OUTPUT_NAME "imhex" +@@ -33,4 +33,4 @@ + + if (APPLE) + add_compile_definitions(GL_SILENCE_DEPRECATION) +-endif () +\ No newline at end of file ++endif () +--- a/plugins/builtin/CMakeLists.txt ++++ b/plugins/builtin/CMakeLists.txt +@@ -75,4 +75,4 @@ + + add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}") + set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) +-target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) ++target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra) diff --git a/srcpkgs/imhex/template b/srcpkgs/imhex/template new file mode 100644 index 000000000000..1782e799b446 --- /dev/null +++ b/srcpkgs/imhex/template @@ -0,0 +1,73 @@ +# Template file for 'imhex' +# TODO: when capstone v5 is out, -DUSE_SYSTEM_CAPSTONE=ON +pkgname=imhex +version=1.18.1 +revision=1 +_capstone_version=5.0-rc2 +_nativefiledialog_version=28ade5a5cc5d17cea8fe4034572cac8fd54eb53f +_libromfs_version=f14e88a72759f7121cb611abb7afa6d6a126c7cf +_patternlanguage_version=23ec4e4ef18d55b7201363b3b3ce8ab8635599b8 +_patterns_version=68edebbe4f13434fa480a1a9bc44c0bc7735407a +_xdgpp_version=f01f810714443d0f10c333d4d1d9c0383be41375 +create_wrksrc=yes +build_wrksrc="ImHex-${version}" +build_style=cmake +configure_args="-DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_FMT=ON -DUSE_SYSTEM_LLVM=ON + -DUSE_SYSTEM_YARA=ON" +hostmakedepends="pkg-config clang-tools-extra" +makedepends="libcurl-devel fmt-devel llvm12 jansson-devel yara-devel + freetype-devel glfw-devel gtk+3-devel python3-devel file-devel mbedtls-devel" +short_desc="Hex editor for reverse engineers and programmers" +maintainer="classabbyamp " +license="GPL-2.0-or-later" +homepage="https://imhex.werwolv.net/" +changelog="https://github.com/WerWolv/ImHex/releases" +distfiles="https://github.com/WerWolv/ImHex/archive/refs/tags/v${version}.tar.gz + https://github.com/capstone-engine/capstone/archive/refs/tags/${_capstone_version}.tar.gz + https://github.com/btzy/nativefiledialog-extended/archive/${_nativefiledialog_version}.tar.gz + https://github.com/WerWolv/libromfs/archive/${_libromfs_version}.tar.gz + https://github.com/WerWolv/PatternLanguage/archive/${_patternlanguage_version}.tar.gz + https://github.com/WerWolv/ImHex-Patterns/archive/${_patterns_version}.tar.gz + https://git.sr.ht/~danyspin97/xdgpp/archive/${_xdgpp_version}.tar.gz" +checksum="55159316af07042d494570d0f6f8fcfdc9bbc0d3ebd35fe7d202d0f90d116b1e + 869d94813a887329bc11b4bf1f4410a7a2b7f270176439e90b158127d5a215dd + cf2b63e4d004bd15a44f5ce2d99e8c623addc5f316bb0a2a4a3b518a5b1b4380 + 0531b60880ed1312197ecca20a9f893d0025b8d0456df4a2d5b2acccf940d0db + ba1c6a24e65bc8b3c3229e4ef6cf756998711389b0073602c12ce0ca0a4a19ee + 283545bcf4380b25d52e8a78da23f924256acad93dd5e99f38940cbb59facd8b + 45a20965180fee5d09fde386ba63d6782de949d3ea4854076d9cc1aca3553dd1" + +# does not build/run properly, is only unit tests +make_check=no +patch_args="-Np1 --directory=$build_wrksrc" +skip_extraction="xdg.hpp" +ignore_elf_files="/usr/share/imhex/plugins/builtin.hexplug" + +# cmake can't deal with clang-tools-extra stuff (sancov) +nocross=yes + +if [ "$XBPS_TARGET_WORDSIZE" = 32 ]; then + broken="uses i128" +fi + +post_extract() { + mv capstone-${_capstone_version}/* $build_wrksrc/lib/external/capstone + mv nativefiledialog-extended-${_nativefiledialog_version}/* \ + $build_wrksrc/lib/external/nativefiledialog + mv libromfs-${_libromfs_version}/* $build_wrksrc/lib/external/libromfs + mv PatternLanguage-${_patternlanguage_version}/* \ + $build_wrksrc/lib/external/pattern_language + mv xdgpp-${_xdgpp_version}/xdg.hpp \ + $build_wrksrc/lib/external/xdgpp +} + +imhex-patterns_package() { + short_desc+=" - patterns and magic files" + depends="imhex" + pkg_install() { + vmkdir usr/share/imhex + for d in constants includes magic patterns tips; do + vcopy $wrksrc/ImHex-Patterns-${_patterns_version}/$d usr/share/imhex + done + } +}