theft icon indicating copy to clipboard operation
theft copied to clipboard

build: add Meson buildsystem

Open notxvilka opened this issue 9 months ago • 1 comments

Decided to address https://github.com/silentbicycle/theft/issues/60 since the Makefile is very simple and easy to "translate".

This is how the process looks like:

theft on  meson                                                                                                                                                                                            19:55:32
$ meson setup build
The Meson build system
Version: 1.7.0
Source dir: /Users/xvilka/rizin/theft
Build dir: /Users/xvilka/rizin/theft/build
Build type: native build
Project name: theft
Project version: 0.4.6
C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the host machine: cc ld64 1115.7.3
Host machine cpu family: aarch64
Host machine cpu: aarch64
Library m found: YES
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.4.3
Build targets in project: 3

Found ninja-1.12.1 at /opt/homebrew/bin/ninja
theft on  meson                                                                                                                                                                                            19:55:37

$ meson compile -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /opt/homebrew/bin/ninja -C /Users/xvilka/rizin/theft/build
ninja: Entering directory `/Users/xvilka/rizin/theft/build'
[26/26] Linking target test_theft
theft on  meson                                                                                                                                                                                            19:55:42

$ meson test -C build
ninja: Entering directory `/Users/xvilka/rizin/theft/build'
ninja: no work to do.
1/1 theft tests        OK             24.76s

Ok:                 1
Expected Fail:      0
Fail:               0
Unexpected Pass:    0
Skipped:            0
Timeout:            0

Full log written to /Users/xvilka/rizin/theft/build/meson-logs/testlog.txt

Tried also with Muon and it builds just fine: https://github.com/rizinorg/rizin/actions/runs/13818011053/job/38656707916

This change also allows using Theft as Meson dependency. Just create subprojects/theft.wrap with following contents:

[wrap-git]
url = https://github.com/notxvilka/theft.git
revision = meson
depth = 1

(repository path and revision could be changed if this get merged) and then add a dependency in any Meson project:

theft_proj = subproject('theft', default_options: [])
theft_dep = theft_proj.get_variable('theft_dep')

notxvilka avatar Mar 12 '25 15:03 notxvilka

Your PR is targeting the wrong branch. See CONTRIBUTING.md.

I don't use meson, so I probably wouldn't maintain any build configuration for it, but it could go in a contrib/ directory I suppose.

More importantly, see the comment here about the general status of this project.

silentbicycle avatar Mar 12 '25 21:03 silentbicycle