cutter, bump versin, use older FindRizin.cmake to fix detection for rz_core ... (#8713)

This commit is contained in:
Schrijvers Luc
2023-05-23 11:41:35 +02:00
committed by GitHub
parent daf55ac14f
commit 8a4451d221
3 changed files with 159 additions and 57 deletions

View File

@@ -4,16 +4,16 @@ powered by rizin.
It aims at being an advanced and customizable reverse engineering platform \
while keeping the user experience in mind. Cutter is created by reverse \
engineers for reverse engineers."
HOMEPAGE="https://github.com/radareorg/cutter"
HOMEPAGE="https://github.com/rizinorg/cutter"
COPYRIGHT="2021 xarkes, thestr4ng3r, ballessay, Hugo Teso"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="c206cc72443b989b7306cbc1ec5c85206a5feb5e7dc8621fe4f03876b9e447ab"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="7063f6671b0bbf24e87929e7f70905bcc8738dbb0b75c2ff445387a09ed532a8"
SOURCE_FILENAME="cutter-$portVersion.tar.gz"
srcGitRev_2="67f5c654523d22c7843811e5aa852a01742f6f12"
srcGitRev_2="9cc445c256975c97c82c8a1f755fa863f43bf46f"
SOURCE_URI_2="https://github.com/rizinorg/cutter-translations/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="12a06a7f977cf7c6d28e1d466cb9e421edb2d26c36e838d02292e5e45bc326c5"
CHECKSUM_SHA256_2="f1dfe48bdf6ccdcde47cd67bc84bf9975f8e28cd736330cff81bf8cad3f08be5"
SOURCE_FILENAME_2="translations-$srcGitRev_2.tar.gz"
PATCHES="cutter-$portVersion.patchset"
ADDITIONAL_FILES="cutter.rdef.in"

View File

@@ -1,52 +0,0 @@
From fccf8a95af1de0f435af340313a9e98c918fe787 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 14 May 2022 17:11:12 +0200
Subject: cutter, fix check for rizin
Upstream changed the detection for rizin, for now this works
diff --git a/cmake/FindRizin.cmake b/cmake/FindRizin.cmake
index 924e112..023bff6 100644
--- a/cmake/FindRizin.cmake
+++ b/cmake/FindRizin.cmake
@@ -15,19 +15,23 @@
# If librz was found using find_library and not pkg-config, the following variables will also be set:
# Rizin_LIBRARY_<name> - Path to library rz_<name>
-if(WIN32)
+if(HAIKU)
find_path(Rizin_INCLUDE_DIRS
NAMES rz_core.h rz_bin.h rz_util.h
HINTS
"$ENV{HOME}/bin/prefix/rizin/include/librz"
/usr/local/include/libr
- /usr/include/librz)
+ /usr/include/librz
+ /system/develop/headers/x86/librz
+ /system/develop/headers/librz)
find_path(SDB_INCLUDE_DIR
NAMES sdb.h sdbht.h sdb_version.h
HINTS
"$ENV{HOME}/bin/prefix/rizin/include/librz/sdb"
/usr/local/include/librz/sdb
- /usr/include/librz/sdb)
+ /usr/include/librz/sdb
+ /system/develop/headers/x86/librz/sdb
+ /system/develop/headers/librz/sdb)
list(APPEND Rizin_INCLUDE_DIRS ${SDB_INCLUDE_DIR})
@@ -64,7 +68,9 @@ if(WIN32)
HINTS
"$ENV{HOME}/bin/prefix/rizin/lib"
/usr/local/lib
- /usr/lib)
+ /usr/lib
+ /system/lib/x86
+ /system/lib)
list(APPEND Rizin_LIBRARIES ${Rizin_LIBRARY_${libname}})
list(APPEND Rizin_LIBRARIES_VARS "Rizin_LIBRARY_${libname}")
--
2.30.2

View File

@@ -0,0 +1,154 @@
From bbfb5f89d31518926709bf7badaabb55739f0643 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Tue, 23 May 2023 10:06:48 +0200
Subject: Fix build and detection for rizin
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 578bd5a..1792ab4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,8 +74,8 @@ if(CUTTER_USE_BUNDLED_RIZIN)
include(BundledRizin)
set(RIZIN_TARGET Rizin)
else()
- find_package(Rizin COMPONENTS Core REQUIRED)
- set(RIZIN_TARGET Rizin::Core)
+ find_package(Rizin REQUIRED)
+ set(RIZIN_TARGET Rizin::librz)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/cmake/FindRizin.cmake b/cmake/FindRizin.cmake
new file mode 100644
index 0000000..8a17b6b
--- /dev/null
+++ b/cmake/FindRizin.cmake
@@ -0,0 +1,124 @@
+# - Find Rizin (librz)
+#
+# This module provides the following imported targets, if found:
+#
+# Rizin::librz
+#
+# This will define the following variables:
+# (but don't use them if you don't know what you are doing, use Rizin::librz)
+#
+# Rizin_FOUND - True if librz has been found.
+# Rizin_INCLUDE_DIRS - librz include directory
+# Rizin_LIBRARIES - List of libraries when using librz.
+# Rizin_LIBRARY_DIRS - librz library directories
+#
+# If librz was found using find_library and not pkg-config, the following variables will also be set:
+# Rizin_LIBRARY_<name> - Path to library rz_<name>
+
+if(HAIKU)
+ find_path(Rizin_INCLUDE_DIRS
+ NAMES rz_core.h rz_bin.h rz_util.h
+ HINTS
+ "$ENV{HOME}/bin/prefix/rizin/include/librz"
+ /usr/local/include/libr
+ /usr/include/librz
+ /system/develop/headers/x86/librz
+ /system/develop/headers/librz)
+ find_path(SDB_INCLUDE_DIR
+ NAMES sdb.h sdbht.h sdb_version.h
+ HINTS
+ "$ENV{HOME}/bin/prefix/rizin/include/librz/sdb"
+ /usr/local/include/librz/sdb
+ /usr/include/librz/sdb
+ /system/develop/headers/x86/librz/sdb
+ /system/develop/headers/librz/sdb)
+
+ list(APPEND Rizin_INCLUDE_DIRS ${SDB_INCLUDE_DIR})
+
+ set(Rizin_LIBRARY_NAMES
+ core
+ config
+ cons
+ io
+ util
+ flag
+ asm
+ debug
+ hash
+ bin
+ lang
+ io
+ analysis
+ parse
+ bp
+ egg
+ reg
+ search
+ sign
+ syscall
+ socket
+ magic
+ crypto
+ type)
+
+ set(Rizin_LIBRARIES "")
+ set(Rizin_LIBRARIES_VARS "")
+ foreach(libname ${Rizin_LIBRARY_NAMES})
+ find_library(Rizin_LIBRARY_${libname}
+ rz_${libname}
+ HINTS
+ "$ENV{HOME}/bin/prefix/rizin/lib"
+ /usr/local/lib
+ /usr/lib
+ /system/lib/x86
+ /system/lib)
+
+ list(APPEND Rizin_LIBRARIES ${Rizin_LIBRARY_${libname}})
+ list(APPEND Rizin_LIBRARIES_VARS "Rizin_LIBRARY_${libname}")
+ endforeach()
+
+ set(Rizin_LIBRARY_DIRS "")
+
+ add_library(Rizin::librz UNKNOWN IMPORTED)
+ set_target_properties(Rizin::librz PROPERTIES
+ IMPORTED_LOCATION "${Rizin_LIBRARY_core}"
+ IMPORTED_LINK_INTERFACE_LIBRARIES "${Rizin_LIBRARIES}"
+ INTERFACE_LINK_DIRECTORIES "${Rizin_LIBRARY_DIRS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Rizin_INCLUDE_DIRS}")
+ set(Rizin_TARGET Rizin::librz)
+else()
+ # support installation locations used by rizin scripts like sys/user.sh and sys/install.sh
+ if(CUTTER_USE_ADDITIONAL_RIZIN_PATHS)
+ set(Rizin_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
+ list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/bin/prefix/rizin") # sys/user.sh
+ list(APPEND CMAKE_PREFIX_PATH "/usr/local") # sys/install.sh
+ endif()
+
+ find_package(PkgConfig REQUIRED)
+ if(CMAKE_VERSION VERSION_LESS "3.6")
+ pkg_search_module(Rizin REQUIRED rz_core)
+ else()
+ pkg_search_module(Rizin IMPORTED_TARGET REQUIRED rz_core)
+ endif()
+
+ # reset CMAKE_PREFIX_PATH
+ if(CUTTER_USE_ADDITIONAL_RIZIN_PATHS)
+ set(CMAKE_PREFIX_PATH ${Rizin_CMAKE_PREFIX_PATH_TEMP})
+ endif()
+
+ if((TARGET PkgConfig::Rizin) AND (NOT CMAKE_VERSION VERSION_LESS "3.11.0"))
+ set_target_properties(PkgConfig::Rizin PROPERTIES IMPORTED_GLOBAL ON)
+ add_library(Rizin::librz ALIAS PkgConfig::Rizin)
+ set(Rizin_TARGET Rizin::librz)
+ elseif(Rizin_FOUND)
+ add_library(Rizin::librz INTERFACE IMPORTED)
+ set_target_properties(Rizin::librz PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Rizin_INCLUDE_DIRS}")
+ set_target_properties(Rizin::librz PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${Rizin_LIBRARIES}")
+ set(Rizin_TARGET Rizin::librz)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Rizin REQUIRED_VARS Rizin_TARGET Rizin_LIBRARIES Rizin_INCLUDE_DIRS)
--
2.37.3