diff options
author | iTrooz | 2022-10-12 10:04:46 +0200 |
---|---|---|
committer | iTrooz | 2022-11-17 13:57:58 +0100 |
commit | f9e25f43faad0b88381892ea6fc1752a40564411 (patch) | |
tree | 0eadaf003d404cda2556e882b9275749a9e4c601 | |
parent | 0487445016907573a2d55c32637fae086c235067 (diff) | |
download | aur-f9e25f43faad0b88381892ea6fc1752a40564411.tar.gz |
Copy and adapt KokaKiwi imhex package
-rw-r--r-- | .SRCINFO | 59 | ||||
-rw-r--r-- | .gitignore | 17 | ||||
-rw-r--r-- | 0001-makepkg-Fix-compiler-check.patch | 85 | ||||
-rw-r--r-- | 0002-fix-Deduplicate-resources-directories.patch | 64 | ||||
-rw-r--r-- | PKGBUILD | 138 | ||||
-rw-r--r-- | pl-0001-Use-C-23-standard.patch | 26 | ||||
-rw-r--r-- | pl-0002-makepkg-Remove-extraneous-compiler-flags.patch | 25 |
7 files changed, 382 insertions, 32 deletions
@@ -1,23 +1,60 @@ pkgbase = imhex-git pkgdesc = A Hex Editor for Reverse Engineers, Programmers and people that value their eye sight when working at 3 AM - pkgver = 1.6.1.r20.g4328a33 + pkgver = 1.25.0.r1.g91a4f52f pkgrel = 1 - url = https://github.com/WerWolv/ImHex + url = https://imhex.werwolv.net arch = x86_64 license = GPL2 makedepends = git makedepends = cmake + makedepends = llvm + makedepends = nlohmann-json + makedepends = librsvg + makedepends = python depends = glfw - depends = glm - depends = capstone - depends = llvm-libs - depends = llvm - depends = nlohmann-json - depends = python - provides = imhex - conflicts = imhex - source = imhex-git::git+https://github.com/WerWolv/ImHex.git + depends = mbedtls + depends = libssh2 + depends = curl + depends = dbus + depends = freetype2 + depends = file + depends = hicolor-icon-theme + depends = xdg-desktop-portal + depends = fmt + depends = yara + optdepends = imhex-patterns-git: ImHex base patterns + options = !lto + options = !strip + source = imhex::git+https://github.com/WerWolv/ImHex.git + source = nativefiledialog::git+https://github.com/btzy/nativefiledialog-extended.git + source = xdgpp::git+https://git.sr.ht/~danyspin97/xdgpp + source = libromfs::git+https://github.com/WerWolv/libromfs + source = capstone::git+https://github.com/capstone-engine/capstone#branch=next + source = pattern_language::git+https://github.com/WerWolv/PatternLanguage + source = 0001-makepkg-Fix-compiler-check.patch + source = 0002-fix-Deduplicate-resources-directories.patch + source = pl-0001-Use-C-23-standard.patch + source = pl-0002-makepkg-Remove-extraneous-compiler-flags.patch sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = c13f47520affa06b3ab4687d528084ff1f7ecc2cd9600b2e43dae0513727eb5f + sha256sums = b004f268d18c03e2d225179fb52ca02877e93d81d87b4f08344f19ad4ab6fd31 + sha256sums = 2110b942bba25d6d0b0fe4f4ad2b47c9907ad329a0d064ff86bf54b83965f673 + sha256sums = 6bf93b82a254f79bdf92aefda4bcf413dcbe26b4b42444f1fd18793ee35cb402 + b2sums = SKIP + b2sums = SKIP + b2sums = SKIP + b2sums = SKIP + b2sums = SKIP + b2sums = SKIP + b2sums = 75030d92294ff36642acbae000931ee6b8f03ba6e577b66b5c70a058ca9320f521368fbe225b642df1f4138172c24d966c9ec66fd4eb7f9de24ee896e91363cf + b2sums = ad679ef4fde42ebf9adefec9c3bffb9b640e79f2917141940050e285c79b13e1c7ad58f497db01dd22e56750372545ac544fb4b5400c5d5895461f931365a50e + b2sums = 3c10abfafeb8979924efff0b5d32e543f9ca2fa3eb4216f1c84d8cb5a6ba6c8af4c5b7e3012d4f535d132fe2492c6824473ed309e8ce09d012963de033bf37b5 + b2sums = 2c26d8b28212b98b9bb202f86c5ff84ac4bd44732ee3a30bdca91b576f5a64802c454314baff53621aafa08f761871ae95102b1727ba1f5a5d300103895e07a6 pkgname = imhex-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..8201748bcf12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Modules +/capstone +/libromfs +/nativefiledialog +/pattern_language +/xdgpp +/yara + +# Package +/imhex-git +/src +/pkg +*.pkg.tar.* + +# Misc +.* +!.gitignore diff --git a/0001-makepkg-Fix-compiler-check.patch b/0001-makepkg-Fix-compiler-check.patch new file mode 100644 index 000000000000..d2c18b107ab6 --- /dev/null +++ b/0001-makepkg-Fix-compiler-check.patch @@ -0,0 +1,85 @@ +From be07c244d139a918961e199cb6bccd42aad65e23 Mon Sep 17 00:00:00 2001 +From: KokaKiwi <kokakiwi+git@kokakiwi.net> +Date: Mon, 14 Nov 2022 11:58:59 +0100 +Subject: [PATCH 1/3] makepkg: Fix compiler check + +--- + cmake/build_helpers.cmake | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake +index 511e7865..ec1b670d 100644 +--- a/cmake/build_helpers.cmake ++++ b/cmake/build_helpers.cmake +@@ -257,27 +257,27 @@ macro(createPackage) + elseif(UNIX AND NOT APPLE) + + set_target_properties(libimhex PROPERTIES SOVERSION ${IMHEX_VERSION}) +- ++ + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dist/DEBIAN/control.in ${CMAKE_BINARY_DIR}/DEBIAN/control) +- ++ + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/share/licenses/imhex) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/imhex.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/icon.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps RENAME imhex.png) + install(FILES "$<TARGET_FILE:libimhex>" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS}) + downloadImHexPatternsFiles("./share/imhex") +- ++ + # install AppStream file + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.imhex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo) +- ++ + # install symlink for the old standard name + file(CREATE_LINK net.werwolv.imhex.metainfo.xml ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml SYMBOLIC) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo) + + endif() +- ++ + if (CREATE_BUNDLE) + include(PostprocessBundle) +- ++ + set_target_properties(libimhex PROPERTIES SOVERSION ${IMHEX_VERSION}) + + set_property(TARGET main PROPERTY MACOSX_BUNDLE_INFO_PLIST ${MACOSX_BUNDLE_INFO_PLIST}) +@@ -290,7 +290,7 @@ macro(createPackage) + add_custom_target(build-time-make-resources-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/Resources") + + downloadImHexPatternsFiles("${IMHEX_BUNDLE_PATH}/Contents/MacOS") +- ++ + install(FILES ${IMHEX_ICON} DESTINATION "${IMHEX_BUNDLE_PATH}/Contents/Resources") + install(TARGETS main BUNDLE DESTINATION ".") + install(FILES $<TARGET_FILE:main> DESTINATION "${IMHEX_BUNDLE_PATH}") +@@ -407,8 +407,11 @@ function(downloadImHexPatternsFiles dest) + endfunction() + + macro(setupCompilerWarnings target) +- set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Werror") +- set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-restrict -Wno-stringop-overread -Wno-stringop-overflow") ++ set(IMHEX_C_FLAGS "") ++ ++ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ++ set(IMHEX_C_FLAGS "${IMHEX_C_FLAGS} -Wno-restrict -Wno-stringop-overread -Wno-stringop-overflow") ++ endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IMHEX_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMHEX_C_FLAGS}") +@@ -422,8 +425,8 @@ macro(setUninstallTarget) + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) +- ++ + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + endif() +-endmacro() +\ No newline at end of file ++endmacro() +-- +2.38.1 + diff --git a/0002-fix-Deduplicate-resources-directories.patch b/0002-fix-Deduplicate-resources-directories.patch new file mode 100644 index 000000000000..8e795298464a --- /dev/null +++ b/0002-fix-Deduplicate-resources-directories.patch @@ -0,0 +1,64 @@ +From 684cca4d5dc6874842e0a505617abcad0f26472d Mon Sep 17 00:00:00 2001 +From: KokaKiwi <kokakiwi+git@kokakiwi.net> +Date: Sat, 11 Jun 2022 23:08:31 +0200 +Subject: [PATCH 2/3] fix: Deduplicate resources directories + +It seems to actually happens despite xdgpp already doing that... +--- + lib/libimhex/include/hex/helpers/utils.hpp | 11 +++++++++++ + lib/libimhex/source/helpers/fs.cpp | 5 +++++ + 2 files changed, 16 insertions(+) + +diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp +index 3419043f..7d9d1e05 100644 +--- a/lib/libimhex/include/hex/helpers/utils.hpp ++++ b/lib/libimhex/include/hex/helpers/utils.hpp +@@ -199,6 +199,17 @@ namespace hex { + return result; + } + ++ template<typename T> ++ void deduplicateVector(std::vector<T> &items) { ++ auto end = items.end(); ++ ++ for (auto it = items.begin(); it != end; ++it) { ++ end = std::remove(it + 1, end, *it); ++ } ++ ++ items.erase(end, items.end()); ++ } ++ + std::vector<std::string> splitString(const std::string &string, const std::string &delimiter); + std::string combineStrings(const std::vector<std::string> &strings, const std::string &delimiter = ""); + std::string replaceStrings(std::string string, const std::string &search, const std::string &replace); +diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp +index ab6e30d5..b4fce7b1 100644 +--- a/lib/libimhex/source/helpers/fs.cpp ++++ b/lib/libimhex/source/helpers/fs.cpp +@@ -1,4 +1,5 @@ + #include <hex/helpers/fs.hpp> ++#include <hex/helpers/utils.hpp> + + #include <hex/api/content_registry.hpp> + #include <hex/helpers/fs_macos.hpp> +@@ -166,6 +167,8 @@ namespace hex::fs { + auto additionalDirs = ImHexApi::System::getAdditionalFolderPaths(); + std::copy(additionalDirs.begin(), additionalDirs.end(), std::back_inserter(paths)); + ++ hex::deduplicateVector(paths); ++ + return paths; + } + +@@ -185,6 +188,8 @@ namespace hex::fs { + for (auto &path : paths) + path = path / "imhex"; + ++ hex::deduplicateVector(paths); ++ + return paths; + #endif + } +-- +2.38.1 + @@ -1,36 +1,132 @@ -# Maintainer: Seth Buccella <sethfb at gmail dot com> -# Contributor: Alex Sarum <rum.274.4 at gmail dot com> +# Maintainer: iTrooz <itrooz+aur@itrooz.proton.me> +# Actual Maintainer: KokaKiwi <kokakiwi+aur@kokakiwi.net> +# Contributor: George Rawlinson <george@rawlinson.net.nz> + +# Old Maintainer: Seth Buccella <sethfb at gmail dot com> +# Old Contributor: Alex Sarum <rum.274.4 at gmail dot com> + +# NOTE : This PKGBUILD is a copy of https://aur.archlinux.org/packages/imhex (maintained by KokaKiwi) with trivial modifications to fetch the latest commit. pkgname=imhex-git -pkgver=1.14.0.r54.g0e40b8a8 +pkgver=1.25.0.r1.g91a4f52f pkgrel=1 -pkgdesc="A Hex Editor for Reverse Engineers, Programmers and people that value their eye sight when working at 3 AM" -arch=('x86_64') -url="https://github.com/WerWolv/ImHex" +pkgdesc='A Hex Editor for Reverse Engineers, Programmers and people that value their eye sight when working at 3 AM' +url='https://imhex.werwolv.net' license=('GPL2') -depends=('glfw' 'glm' 'capstone' 'llvm' 'nlohmann-json' 'python' 'file' 'gtk3' 'mbedtls' 'libssh2') -makedepends=('git' 'cmake' 'gcc' 'lld') -optdepends=() -provides=('imhex') -conflicts=('imhex') -source=("$pkgname::git+https://github.com/WerWolv/ImHex.git") -sha256sums=('SKIP') +arch=('x86_64') +depends=('glfw' 'mbedtls' 'libssh2' 'curl' 'dbus' + 'freetype2' 'file' 'hicolor-icon-theme' 'xdg-desktop-portal' + 'fmt' 'yara') +makedepends=('git' 'cmake' 'llvm' 'nlohmann-json' 'librsvg' 'python') +optdepends=( + 'imhex-patterns-git: ImHex base patterns' +) +source=("$pkgname::git+https://github.com/WerWolv/ImHex.git" + "nativefiledialog::git+https://github.com/btzy/nativefiledialog-extended.git" + "xdgpp::git+https://git.sr.ht/~danyspin97/xdgpp" + "libromfs::git+https://github.com/WerWolv/libromfs" + "capstone::git+https://github.com/capstone-engine/capstone#branch=next" + "pattern_language::git+https://github.com/WerWolv/PatternLanguage" + 0001-makepkg-Fix-compiler-check.patch + 0002-fix-Deduplicate-resources-directories.patch + pl-0001-Use-C-23-standard.patch + pl-0002-makepkg-Remove-extraneous-compiler-flags.patch) +sha256sums=('SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'c13f47520affa06b3ab4687d528084ff1f7ecc2cd9600b2e43dae0513727eb5f' + 'b004f268d18c03e2d225179fb52ca02877e93d81d87b4f08344f19ad4ab6fd31' + '2110b942bba25d6d0b0fe4f4ad2b47c9907ad329a0d064ff86bf54b83965f673' + '6bf93b82a254f79bdf92aefda4bcf413dcbe26b4b42444f1fd18793ee35cb402') +b2sums=('SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + '75030d92294ff36642acbae000931ee6b8f03ba6e577b66b5c70a058ca9320f521368fbe225b642df1f4138172c24d966c9ec66fd4eb7f9de24ee896e91363cf' + 'ad679ef4fde42ebf9adefec9c3bffb9b640e79f2917141940050e285c79b13e1c7ad58f497db01dd22e56750372545ac544fb4b5400c5d5895461f931365a50e' + '3c10abfafeb8979924efff0b5d32e543f9ca2fa3eb4216f1c84d8cb5a6ba6c8af4c5b7e3012d4f535d132fe2492c6824473ed309e8ce09d012963de033bf37b5' + '2c26d8b28212b98b9bb202f86c5ff84ac4bd44732ee3a30bdca91b576f5a64802c454314baff53621aafa08f761871ae95102b1727ba1f5a5d300103895e07a6') +options=(!lto !strip) pkgver() { cd "$pkgname" git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' } -build() { +prepare() { cd "$pkgname" - git submodule update --init --recursive - cmake -B build -DCMAKE_INSTALL_PREFIX=/usr - make -j -C build + + git submodule init + for name in nativefiledialog xdgpp libromfs capstone pattern_language; do + git config submodule.lib/external/$name.url "$srcdir/$name" + done + for name in fmt curl yara/yara; do + git config --remove-section submodule.lib/external/$name + done + git -c protocol.file.allow=always submodule update + + git apply \ + "$srcdir/0001-makepkg-Fix-compiler-check.patch" \ + "$srcdir/0002-fix-Deduplicate-resources-directories.patch" + + git -C lib/external/pattern_language apply \ + "$srcdir/pl-0001-Use-C-23-standard.patch" \ + "$srcdir/pl-0002-makepkg-Remove-extraneous-compiler-flags.patch" +} + +build() { + export CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override" + + cmake -B build -S "$pkgname" \ + -Wno-dev \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_INSTALL_PREFIX=/usr \ + -D CMAKE_SKIP_RPATH=ON \ + -D IMHEX_OFFLINE_BUILD=ON \ + -D IMHEX_IGNORE_BAD_CLONE=ON \ + -D IMHEX_STRIP_RELEASE=OFF \ + -D USE_SYSTEM_LLVM=ON \ + -D USE_SYSTEM_YARA=ON \ + -D USE_SYSTEM_FMT=ON \ + -D USE_SYSTEM_CURL=ON \ + -D USE_SYSTEM_NLOHMANN_JSON=ON \ + -D USE_SYSTEM_CAPSTONE=OFF \ + -D LIBPL_ENABLE_CLI=OFF + + cmake --build build } package() { - cd "$pkgname" - install -DTm755 build/lib/libimhex/libimhex.so "${pkgdir}/usr/lib/libimhex.so" - install -Dm755 build/plugins/builtin/builtin.hexplug "${pkgdir}/usr/bin/plugins/builtin.hexplug" - install -DTm755 build/imhex "${pkgdir}/usr/bin/imhex" + # Executable + install -Dm0755 build/imhex "$pkgdir/usr/bin/imhex" + + # Shared lib and plugins + install -Dm0755 -t "$pkgdir/usr/lib" build/lib/libimhex/libimhex.so + + for plugin in builtin; do + install -Dm0755 -t "$pkgdir/usr/lib/imhex/plugins" "build/plugins/$plugin.hexplug" + done + + install -dm0755 "$pkgdir/usr/share/imhex" + + # Desktop file(s) + install -Dm0644 -t "$pkgdir/usr/share/applications" "$pkgname/dist/imhex.desktop" + install -Dm0644 "$pkgname/resources/icon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/imhex.svg" + for size in 32 48 64 128 256; do + install -dm0755 "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps" + rsvg-convert -a -f png -w $size -o "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/imhex.png" \ + "$pkgname/resources/icon.svg" + done + + # License + install -Dm0644 "$pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + # Documentation + install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname" \ + "$pkgname/README.md" } diff --git a/pl-0001-Use-C-23-standard.patch b/pl-0001-Use-C-23-standard.patch new file mode 100644 index 000000000000..09ef47ed64a6 --- /dev/null +++ b/pl-0001-Use-C-23-standard.patch @@ -0,0 +1,26 @@ +From c61bb49f6dbd1adba1653a3cef242299cd34255a Mon Sep 17 00:00:00 2001 +From: KokaKiwi <kokakiwi+git@kokakiwi.net> +Date: Thu, 18 Aug 2022 00:57:02 +0200 +Subject: [PATCH 1/2] Use C++23 standard + +--- + lib/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 404f7f6..4d593ff 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -1,7 +1,7 @@ +-cmake_minimum_required(VERSION 3.16) ++cmake_minimum_required(VERSION 3.20) + project(libpl) + +-set(CMAKE_CXX_STANDARD 20) ++set(CMAKE_CXX_STANDARD 23) + + if (LIBPL_SHARED_LIBRARY) + set(LIBRARY_TYPE SHARED) +-- +2.38.1 + diff --git a/pl-0002-makepkg-Remove-extraneous-compiler-flags.patch b/pl-0002-makepkg-Remove-extraneous-compiler-flags.patch new file mode 100644 index 000000000000..7c7cf0bce3b9 --- /dev/null +++ b/pl-0002-makepkg-Remove-extraneous-compiler-flags.patch @@ -0,0 +1,25 @@ +From f05087e0d92d6312294b06f026ef8a19fac4eac2 Mon Sep 17 00:00:00 2001 +From: KokaKiwi <kokakiwi+git@kokakiwi.net> +Date: Sat, 17 Sep 2022 16:27:17 +0200 +Subject: [PATCH 2/2] makepkg: Remove extraneous compiler flags + +--- + lib/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 4d593ff..585fdb2 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -34,7 +34,7 @@ add_library(libpl ${LIBRARY_TYPE} + source/pl/lib/std/hash.cpp + ) + +-target_compile_options(libpl PRIVATE -Wall -Wextra -Werror -Wno-unknown-pragmas) ++target_compile_options(libpl PRIVATE -Wno-unknown-pragmas) + target_include_directories(libpl PUBLIC include) + target_link_libraries(libpl PUBLIC fmt::fmt intervaltree) + set_property(TARGET libpl PROPERTY POSITION_INDEPENDENT_CODE ON) +-- +2.38.1 + |