Skip to content

Commit 67eb1a4

Browse files
macOS releases now adjust the Yara-X library location. #132
1 parent 0b99259 commit 67eb1a4

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ pkg_check_modules(YARAX IMPORTED_TARGET yara_x_capi)
3232
if (YARAX_FOUND)
3333
set(YARAX PkgConfig::YARAX )
3434
message(STATUS "Found yarax: ${YARAX}")
35+
# Sometimes macOS doesn't include /usr/local/include.
36+
include_directories(${YARAX_INCLUDE_DIRS})
37+
3538
else()
3639
message(STATUS "Yarax not found. Will build without it.")
3740
endif()
@@ -162,7 +165,7 @@ qt_add_executable(maskromtool
162165
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
163166
target_link_libraries(maskromtool PRIVATE Qt6::Widgets
164167
Qt6::Charts Qt6::PrintSupport
165-
libgoodasm ${READLINE} ${YARAX_LIBRARIES})
168+
libgoodasm ${READLINE} ${YARAX_LINK_LIBRARIES})
166169

167170

168171
set_target_properties(maskromtool PROPERTIES
@@ -182,7 +185,7 @@ if(WIN32)
182185
)
183186
target_link_libraries(maskromtoolcli PRIVATE Qt6::Widgets
184187
Qt6::Charts Qt6::PrintSupport
185-
libgoodasm ${READLINE} ${YARAX_LIBRARIES} )
188+
libgoodasm ${READLINE} ${YARAX_LINK_LIBRARIES} )
186189
qt_finalize_executable(maskromtoolcli)
187190
install(TARGETS maskromtoolcli DESTINATION bin)
188191
endif()
@@ -200,7 +203,7 @@ add_executable(gatorom
200203
gatomain.cpp
201204
)
202205
target_link_libraries(gatorom Qt6::Core
203-
Qt6::PrintSupport libgoodasm ${READLINE} ${YARAX_LIBRARIES})
206+
Qt6::PrintSupport libgoodasm ${READLINE} ${YARAX_LINK_LIBRARIES})
204207

205208
install(TARGETS gatorom
206209
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Building the tool is easiest from the CLI. In Debian Bullseye (11.x),
129129
```
130130
% sudo apt install make gcc g++ cmake git qt6-base-dev libqt6charts6-dev \
131131
qt6-translations-l10n linguist-qt6 qt6-l10n-tools qt6-tools-\* qt6-image-formats-plugins \
132-
libreadline-dev qt6-declarative-dev
132+
libreadline-dev qt6-declarative-dev pkgconfig
133133
% git clone https://github.com/travisgoodspeed/maskromtool/
134134
...
135135
% cd maskromtool
@@ -156,7 +156,7 @@ On macOS, you might need to run 'xattr -dr com.apple.quarantine *` if
156156
you get warnings about the signature not being recognized.
157157

158158

159-
To install on macOS, first install XCode, [Homebrew](https://brew.sh),
159+
To build on macOS, first install XCode, [Homebrew](https://brew.sh),
160160
and [Qt for Open Source](https://www.qt.io/download-qt-installer-oss),
161161
which sadly requires an account. After that, you can open
162162
`CMakeLists.txt` in QT Creator or use the release script to build.
@@ -172,7 +172,7 @@ You can also build it without the official Qt installer or App,
172172
through Homebrew alone. This is roughly like what we'd do in Linux.
173173

174174
```
175-
% brew install cmake emacs qt
175+
% brew install cmake emacs qt pkgconfig
176176
% git submodule init
177177
% git submodule update --remote
178178
...
@@ -181,6 +181,27 @@ through Homebrew alone. This is roughly like what we'd do in Linux.
181181
% make -j 8 && sudo make install
182182
```
183183

184+
## Optional Libraries
185+
186+
### YaraX
187+
188+
[Yara-X](https://github.com/VirusTotal/yara-x) is a pattern matching
189+
library that's popular in the malware research world. MaskRomTool and
190+
GatoROM support it as an optional library, for solving unkown layouts.
191+
Yara-X is automatically included when PkgConfig is available and its C
192+
API [has been
193+
installed](https://virustotal.github.io/yara-x/docs/api/c/c-/).
194+
195+
```
196+
% git clone https://github.com/VirusTotal/yara-x
197+
...
198+
% cd yara-x
199+
% cargo install cargo-c
200+
...
201+
% cargo cinstall -p yara-x-capi --release
202+
... (If error here, make your user own /usr/local/lib and include.)
203+
```
204+
184205
## GUI Usage
185206

186207
First use File/Open ROM to open a ROM image as a photograph. Try to

buildrelease-macos.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ set -e
1111
## These paths are hardcoded to prevent Homebrew for gunking things
1212
## up. Be sure to install *everything* in that version of Qt, or
1313
## you'll be missing important libraries like QtCharts.
14-
export QTDIR=~/Qt/6.9.2/macos/bin
15-
export CMAKE=~/Qt/6.9.2/macos/bin/qt-cmake
16-
export DEPLOYQT=~/Qt/6.9.2/macos/bin/macdeployqt
14+
export QTDIR=~/Qt/6.10.0/macos/bin
15+
export CMAKE=~/Qt/6.10.0/macos/bin/qt-cmake
16+
export DEPLOYQT=~/Qt/6.10.0/macos/bin/macdeployqt
1717

1818

1919

@@ -34,8 +34,9 @@ cp -rf build/maskromtool.app build/gatorom build/extern/goodasm/goodasm release/
3434
# Set the rpath so that the CLI tools run.
3535
(cd release && install_name_tool -add_rpath @executable_path/maskromtool.app/Contents/Frameworks goodasm )
3636
(cd release && install_name_tool -add_rpath @executable_path/maskromtool.app/Contents/Frameworks gatorom )
37+
(cd release && install_name_tool -change /usr/local/lib/libyara_x_capi.1.dylib @executable_path/maskromtool.app/Contents/Frameworks/libyara_x_capi.1.dylib gatorom )
3738
# Hardcoding the executable is bad, but the Homebrew version will break the build.
38-
$DEPLOYQT release/maskromtool.app -dmg -sign-for-notarization="Developer ID Application: Travis Goodspeed"
39+
$DEPLOYQT release/maskromtool.app -dmg -sign-for-notarization="Apple Distribution: Travis Goodspeed (F56DQ35SUJ)"
3940
# Verify the signature
4041
codesign --verify --verbose release/maskromtool.app
4142

0 commit comments

Comments
 (0)