diff --git a/CMakeLists.txt b/CMakeLists.txt index 64f41a5..8f1ae62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,15 +96,12 @@ set(sleigh_deccore_source_list ) set(sleigh_extra_source_list - "${library_root}/bfd_arch.cc" "${library_root}/callgraph.cc" - "${library_root}/codedata.cc" "${library_root}/ifacedecomp.cc" "${library_root}/ifaceterm.cc" "${library_root}/inject_sleigh.cc" "${library_root}/interface.cc" "${library_root}/libdecomp.cc" - "${library_root}/loadimage_bfd.cc" "${library_root}/loadimage_xml.cc" "${library_root}/raw_arch.cc" "${library_root}/rulecompile.cc" @@ -147,71 +144,6 @@ set(sleigh_slacomp_source_list "${library_root}/slghscan.cc" ) -# -# Locate the BFD library and its dependencies -# - -# BFD -find_path(bfd_include_path NAMES "bfd.h") -if(NOT bfd_include_path) - message(SEND_ERROR "Failed to locate the bfd header file. Try to install the binutils development package") -endif() - -find_library(bfd_library_path - NAMES - "libbfd.a" - "libbfd.so" -) - -if(NOT bfd_library_path) - message(SEND_ERROR "Failed to locate the bfd library. Try to install the binutils development package") -endif() - -add_library(thirdparty_bfd UNKNOWN IMPORTED GLOBAL) -set_target_properties(thirdparty_bfd PROPERTIES - IMPORTED_LOCATION - "${bfd_library_path}" - - INTERFACE_INCLUDE_DIRECTORIES - "${bfd_include_path}" -) - -target_link_libraries(thirdparty_bfd INTERFACE - ${CMAKE_DL_LIBS} -) - -target_compile_definitions(thirdparty_bfd INTERFACE - PACKAGE=\"sleigh\" - PACKAGE_VERSION=\"${PROJECT_VERSION}\" -) - -# ZLIB -find_package(ZLIB REQUIRED) -target_link_libraries(thirdparty_bfd INTERFACE - ZLIB::ZLIB -) - -# iberty -find_library(iberty_library_path - NAMES - "libiberty.a" - "libiberty.so" -) - -if(NOT iberty_library_path) - message(SEND_ERROR "Failed to locate the iberty library. Try to install the libiberty development package") -endif() - -add_library(thirdparty_iberty UNKNOWN IMPORTED GLOBAL) -set_target_properties(thirdparty_iberty PROPERTIES - IMPORTED_LOCATION - "${iberty_library_path}" -) - -target_link_libraries(thirdparty_bfd INTERFACE - thirdparty_iberty -) - # # sleigh settings # @@ -297,7 +229,6 @@ target_compile_definitions(decomp_opt PRIVATE target_link_libraries(decomp_opt PRIVATE sleigh_settings - $ ) if(CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -327,7 +258,6 @@ if(SLEIGH_ENABLE_TESTS) target_link_libraries(ghidra_test_dbg PRIVATE sleigh_settings - $ ) target_compile_definitions(ghidra_test_dbg PRIVATE @@ -437,7 +367,6 @@ add_library(decomp target_link_libraries(decomp PUBLIC sleigh_settings - $ ) if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/README.md b/README.md index 9157a9b..de395a9 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,6 @@ This repository provides a CMake-based build project for SLEIGH so that it can b | [Git](https://git-scm.com/) | Latest | git | N/A | | [Ninja](https://ninja-build.org/) | Latest | ninja-build | ninja | | [CMake](https://cmake.org/) | 3.21+ | cmake | cmake | -| [Binutils](https://www.gnu.org/software/binutils/) | Latest | binutils and binutils-dev | binutils | -| [Zlib](https://zlib.net/) | Latest | zlib | N/A | -| [Iberty](https://gcc.gnu.org/onlinedocs/libiberty/) | Latest | libiberty-dev | binutils | | [Doxygen](https://www.doxygen.nl/) | Latest | doxygen | doxygen | | [GraphViz](https://graphviz.org/) | Latest | graphviz | graphviz | @@ -73,66 +70,6 @@ cmake --build . cmake --build . --target package ``` -## macOS - -### Installing Git and Zlib - -The easiest way to install Git and Zlib is by installing the Xcode Command Line Developer Tools: - -```sh -xcode-select --install -``` - -### Installing Iberty - -Most of SLEIGH's remaining dependencies can be installed via the [Homebrew package manager](https://brew.sh/) on macOS. The only exception is Iberty which doesn't have a dedicated Homebrew package. Instead, we can edit the `binutils` package to include an Iberty installation. - -Firstly, we need to edit the Binutils installation script: - -```sh -brew edit binutils -``` - -The command above will open the installation script with the editor specified by `EDITOR`. We need to add the `--enable-install-libiberty` flag to the `configure` invocation: - -```ruby -system "./configure", "--disable-debug", - "--disable-dependency-tracking", - "--enable-deterministic-archives", - "--prefix=#{prefix}", - "--infodir=#{info}", - "--mandir=#{man}", - "--disable-werror", - "--enable-interwork", - "--enable-multilib", - "--enable-64-bit-bfd", - "--enable-gold", - "--enable-plugins", - "--enable-targets=all", - "--with-system-zlib", - "--disable-nls", - "--enable-install-libiberty" -``` - -Now reinstall Binutils: - -```sh -brew reinstall -s binutils -``` - -### Configuring with Binutils - -By default, the Homebrew Binutils installation won't be visible to CMake during the configure step. We can fix this by pointing the `CMAKE_PREFIX_PATH` option at the Binutils installation like so: - -```sh -cmake \ - -DSLEIGH_ENABLE_INSTALL=ON \ - -DCMAKE_INSTALL_PREFIX="" \ - -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/binutils/ \ - -G Ninja \ - .. -``` - ## License See the LICENSE file in the top directory of this repo.