mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-13 15:20:07 +02:00
155 lines
4.4 KiB
Plaintext
155 lines
4.4 KiB
Plaintext
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
|
|
|