diff --git a/editors/imhex/Makefile b/editors/imhex/Makefile index edf61e4205e6..9bb85ff7d62e 100644 --- a/editors/imhex/Makefile +++ b/editors/imhex/Makefile @@ -1,51 +1,60 @@ PORTNAME= imhex -PORTVERSION= 1.7.0 +PORTVERSION= 1.8.0 DISTVERSIONPREFIX= v -PORTREVISION= 1 CATEGORIES= editors +MASTER_SITES= https://git.sr.ht/~danyspin97/xdgpp/blob/f01f810714443d0f10c333d4d1d9c0383be41375/:xdg +DISTFILES= xdg.hpp:xdg +DIST_SUBDIR= imhex MAINTAINER= nobutaka@FreeBSD.org COMMENT= Hex editor for reverse engineers and programmers LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/LICENSE NOT_FOR_ARCHS= i386 NOT_FOR_ARCHS_REASON= __uint128_t and __int128_t are not supported +EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} \ + btzy-nativefiledialog-extended-${GH_TAG_NATIVEFILEDIALOG}_GH0${EXTRACT_SUFX} \ + fmtlib-fmt-${GH_TAG_FMT}_GH0${EXTRACT_SUFX} \ + VirusTotal-yara-${GH_TAG_YARA}_GH0${EXTRACT_SUFX} -BUILD_DEPENDS= c++10:lang/gcc10 \ - glm>0:math/glm \ +BUILD_DEPENDS= glm>0:math/glm \ nlohmann-json>0:devel/nlohmann-json LIB_DEPENDS= libcapstone.so:devel/capstone4 \ + libcurl.so:ftp/curl \ libmbedtls.so:security/mbedtls \ libfreetype.so:print/freetype2 \ libglfw.so:graphics/glfw \ - libstdc++.so:lang/gcc10 \ libtre.so:textproc/libtre USES= cmake pkgconfig python:3.8+ xorg +USE_GNOME= cairo gdkpixbuf2 gtk30 USE_XORG= x11 xcb xau xdmcp USE_GITHUB= yes + GH_ACCOUNT= WerWolv GH_PROJECT= ImHex - -CC= ${LOCALBASE}/bin/gcc10 -CXX= ${LOCALBASE}/bin/c++10 +GH_TUPLE= btzy:nativefiledialog-extended:${GH_TAG_NATIVEFILEDIALOG}:nativefiledialog \ + fmtlib:fmt:${GH_TAG_FMT}:fmt \ + VirusTotal:yara:${GH_TAG_YARA}:yara +GH_TAG_FMT= 6271406 +GH_TAG_NATIVEFILEDIALOG= 300203a +GH_TAG_YARA= 1842271 PORTDOCS= README.md OPTIONS_DEFINE= DOCS NLS NLS_USES= gettext -post-patch: - ${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" ${WRKSRC}/source/window.cpp - -post-install: - ${STRIP_CMD} ${STAGEDIR}${PREFIX}/share/imhex/plugins/builtin.hexplug - ${STRIP_CMD} ${STAGEDIR}${PREFIX}/share/imhex/plugins/example.hexplug +post-extract: + ${CP} ${DISTDIR}/${DIST_SUBDIR}/xdg.hpp ${WRKSRC}/external/xdgpp + ${CP} -R ${WRKSRC_fmt}/* ${WRKSRC}/external/fmt + ${CP} -R ${WRKSRC_nativefiledialog}/* ${WRKSRC}/external/nativefiledialog + ${CP} -R ${WRKSRC_yara}/* ${WRKSRC}/external/yara/yara post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} .include diff --git a/editors/imhex/distinfo b/editors/imhex/distinfo index 8cac4bc1b324..0bcddc3387bf 100644 --- a/editors/imhex/distinfo +++ b/editors/imhex/distinfo @@ -1,3 +1,11 @@ -TIMESTAMP = 1613820150 -SHA256 (WerWolv-ImHex-v1.7.0_GH0.tar.gz) = 891c9268dda958922698c6fdfcba34ec7b20853f3764fe9d58c4a932a6b0d3d8 -SIZE (WerWolv-ImHex-v1.7.0_GH0.tar.gz) = 1189375 +TIMESTAMP = 1621439913 +SHA256 (imhex/xdg.hpp) = 2e08ce74adb71ff9b9aa9e1c999733fccd4b00967b9cf0c0e51dbf049392a9ec +SIZE (imhex/xdg.hpp) = 7674 +SHA256 (imhex/WerWolv-ImHex-v1.8.0_GH0.tar.gz) = 8a130a8b8c7a8d699bf621ba768098b19a01866ba2ee634376f8883bd39d703a +SIZE (imhex/WerWolv-ImHex-v1.8.0_GH0.tar.gz) = 1757395 +SHA256 (imhex/btzy-nativefiledialog-extended-300203a_GH0.tar.gz) = 5db23b09fb098fa44cae663a5f2b38fc679dbf0a7acf9a8425500c9942478624 +SIZE (imhex/btzy-nativefiledialog-extended-300203a_GH0.tar.gz) = 400036 +SHA256 (imhex/fmtlib-fmt-6271406_GH0.tar.gz) = f07b01d4f092318f3da39d404f7cafbca311e7b576f09121adb1a54927826410 +SIZE (imhex/fmtlib-fmt-6271406_GH0.tar.gz) = 778679 +SHA256 (imhex/VirusTotal-yara-1842271_GH0.tar.gz) = a7148c3ddbc80746f60d56e0ecbbecc05c5f5401263ba95571aaf65dcaa75175 +SIZE (imhex/VirusTotal-yara-1842271_GH0.tar.gz) = 935600 diff --git a/editors/imhex/files/patch-cmake_build__helpers.cmake b/editors/imhex/files/patch-cmake_build__helpers.cmake index 840a38de2b6d..5ecc6be04967 100644 --- a/editors/imhex/files/patch-cmake_build__helpers.cmake +++ b/editors/imhex/files/patch-cmake_build__helpers.cmake @@ -1,46 +1,20 @@ ---- cmake/build_helpers.cmake.orig 2021-02-18 16:11:50 UTC +--- cmake/build_helpers.cmake.orig 2021-05-18 19:25:59 UTC +++ cmake/build_helpers.cmake -@@ -188,7 +188,7 @@ macro(createPackage) +@@ -49,6 +49,8 @@ macro(findLibraries) + message(FATAL_ERROR "No valid version of Python 3 was found.") endif() - if (UNIX AND NOT APPLE) -- install(TARGETS libimhex DESTINATION ${CMAKE_INSTALL_PREFIX}) -+ install(TARGETS libimhex DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") - - string(REPLACE ":" ";" EXTRA_MAGICDBS "${EXTRA_MAGICDBS}") - -@@ -199,9 +199,9 @@ macro(createPackage) - - if (NOT EXTRA_MAGICDBS STREQUAL "NOTFOUND") - if (EXTRA_MAGICDBS MATCHES ".*\\.mgc") -- install(FILES "${EXTRA_MAGICDBS}" DESTINATION magic/) -+ install(FILES "${EXTRA_MAGICDBS}" DESTINATION share/imhex/magic/) - else () -- install(FILES "${EXTRA_MAGICDBS}.mgc" DESTINATION magic/) -+ install(FILES "${EXTRA_MAGICDBS}.mgc" DESTINATION share/imhex/magic/) - endif () - endif () - endif () -@@ -215,11 +215,11 @@ macro(createPackage) - ) ++ find_package(CURL REQUIRED) ++ + string(REPLACE "." ";" PYTHON_VERSION_MAJOR_MINOR ${Python_VERSION}) + list(LENGTH PYTHON_VERSION_MAJOR_MINOR PYTHON_VERSION_COMPONENT_COUNT) +@@ -162,7 +164,7 @@ macro(createPackage) foreach (plugin IN LISTS PLUGINS) -- install(FILES "$" DESTINATION plugins/) -+ install(FILES "$" DESTINATION share/imhex/plugins/) - endforeach () - - # Install the magicdb files. -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magic_dbs.mgc DESTINATION magic/ RENAME imhex.mgc) -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magic_dbs.mgc DESTINATION share/imhex/magic/ RENAME imhex.mgc) - - if (CREATE_BUNDLE) - include(PostprocessBundle) -@@ -241,7 +241,7 @@ macro(createPackage) - if (WIN32) - install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - else () -- install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) -+ install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - endif () - endif() + add_subdirectory("plugins/${plugin}") + set_target_properties(${plugin} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins) +- install(TARGETS ${plugin} RUNTIME DESTINATION ${PLUGINS_INSTALL_LOCATION}) ++ install(TARGETS ${plugin} LIBRARY DESTINATION ${PLUGINS_INSTALL_LOCATION}) + add_dependencies(imhex ${plugin}) + endforeach() diff --git a/editors/imhex/files/patch-external_fmt_CMakeLists.txt b/editors/imhex/files/patch-external_fmt_CMakeLists.txt new file mode 100644 index 000000000000..4b48b620ac43 --- /dev/null +++ b/editors/imhex/files/patch-external_fmt_CMakeLists.txt @@ -0,0 +1,18 @@ +--- external/fmt/CMakeLists.txt.orig 2021-05-19 16:12:27 UTC ++++ external/fmt/CMakeLists.txt +@@ -195,7 +195,6 @@ else() + endif () + + add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst) +-add_library(fmt::fmt ALIAS fmt) + + if (HAVE_STRTOD_L) + target_compile_definitions(fmt PUBLIC FMT_LOCALE) +@@ -248,7 +247,6 @@ if (FMT_SAFE_DURATION_CAST) + endif() + + add_library(fmt-header-only INTERFACE) +-add_library(fmt::fmt-header-only ALIAS fmt-header-only) + + target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) + target_compile_features(fmt-header-only INTERFACE ${FMT_REQUIRED_FEATURES}) diff --git a/editors/imhex/files/patch-external_nativefiledialog_CMakeLists.txt b/editors/imhex/files/patch-external_nativefiledialog_CMakeLists.txt new file mode 100644 index 000000000000..093cfdf021d8 --- /dev/null +++ b/editors/imhex/files/patch-external_nativefiledialog_CMakeLists.txt @@ -0,0 +1,11 @@ +--- external/nativefiledialog/CMakeLists.txt.orig 2021-05-19 15:40:32 UTC ++++ external/nativefiledialog/CMakeLists.txt +@@ -23,6 +23,8 @@ message("nfd Compiler: ${nfd_COMPILER}") + + set (CMAKE_CXX_STANDARD 17) + ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") ++ + add_subdirectory(src) + + option(NFD_BUILD_TESTS "Build tests for nfd" OFF) diff --git a/editors/imhex/files/patch-plugins_builtin_source_math__evaluator.cpp b/editors/imhex/files/patch-plugins_builtin_source_math__evaluator.cpp new file mode 100644 index 000000000000..a091a604fc7c --- /dev/null +++ b/editors/imhex/files/patch-plugins_builtin_source_math__evaluator.cpp @@ -0,0 +1,10 @@ +--- plugins/builtin/source/math_evaluator.cpp.orig 2021-05-18 19:25:59 UTC ++++ plugins/builtin/source/math_evaluator.cpp +@@ -7,7 +7,6 @@ + #include + #include + #include +-#include + + namespace hex { + diff --git a/editors/imhex/files/patch-plugins_libimhex_CMakeLists.txt b/editors/imhex/files/patch-plugins_libimhex_CMakeLists.txt new file mode 100644 index 000000000000..33020c1e8737 --- /dev/null +++ b/editors/imhex/files/patch-plugins_libimhex_CMakeLists.txt @@ -0,0 +1,19 @@ +--- plugins/libimhex/CMakeLists.txt.orig 2021-05-18 19:25:59 UTC ++++ plugins/libimhex/CMakeLists.txt +@@ -12,8 +12,6 @@ set(XDGPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/.. + set(CMAKE_USE_MBEDTLS ON) + set(BUILD_CURL_EXE OFF) + set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "") +-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/curl ${CMAKE_CURRENT_BINARY_DIR}/external/curl EXCLUDE_FROM_ALL) +-set_target_properties(libcurl PROPERTIES POSITION_INDEPENDENT_CODE ON) + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + +@@ -64,5 +62,5 @@ if (APPLE) + find_library(FOUNDATION NAMES Foundation) + target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto ${FOUNDATION} nfd fmt-header-only libcurl) + else () +- target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto nfd fmt-header-only libcurl) ++ target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto nfd fmt-header-only curl) + endif () +\ No newline at end of file diff --git a/editors/imhex/files/patch-source_window.cpp b/editors/imhex/files/patch-source_window.cpp deleted file mode 100644 index 9cd3e4b6d9f2..000000000000 --- a/editors/imhex/files/patch-source_window.cpp +++ /dev/null @@ -1,11 +0,0 @@ ---- source/window.cpp.orig 2021-02-18 16:11:50 UTC -+++ source/window.cpp -@@ -595,7 +595,7 @@ namespace hex { - - void Window::initPlugins() { - try { -- auto pluginFolderPath = std::filesystem::path((SharedData::mainArgv)[0]).parent_path() / "plugins"; -+ auto pluginFolderPath = std::filesystem::path("%%PREFIX%%/share/imhex/plugins"); - PluginHandler::load(pluginFolderPath.string()); - } catch (std::runtime_error &e) { return; } - diff --git a/editors/imhex/pkg-plist b/editors/imhex/pkg-plist index fdf41146b0c4..6eb577fb95ce 100644 --- a/editors/imhex/pkg-plist +++ b/editors/imhex/pkg-plist @@ -1,5 +1,6 @@ bin/imhex lib/libimhex.so %%DATADIR%%/magic/imhex.mgc %%DATADIR%%/plugins/builtin.hexplug -%%DATADIR%%/plugins/example.hexplug +%%DATADIR%%/resources/cacert.pem +%%DATADIR%%/resources/splash.png