rizinorg / rizin

UNIX-like reverse engineering framework and command-line toolset.
https://rizin.re
GNU Lesser General Public License v3.0
2.72k stars 363 forks source link

Make a Meson Wrap for Rizin library #3454

Open XVilka opened 1 year ago

XVilka commented 1 year ago

See https://mesonbuild.com/Adding-new-projects-to-wrapdb.html

Essentially, it boils down to preparing a wrap file for 0.6.0 release, since Rizin already uses Meson build system. Lets target it for the next release, it will allow other Meson projects easily use the Rizin library.

saurabhmj11 commented 1 year ago

To make a Meson wrap for Rizin library, you can follow these steps:

Create a new directory for your wrap project:

mkdir rizin-wrap
cd rizin-wrap

Create a meson.build file in the directory:

project('rizin', 'c')

version = '0.0.1'

library('rizin', sources: [], dependencies: [])

wrap = meson.get_compiler('c').find_library('rizin', dirs: ['/path/to/rizin/lib'])
if not wrap.found()
  error('Rizin library not found')
endif

dependencies = [wrap]

Note: Replace /path/to/rizin/lib with the actual path to the Rizin library directory.

Create a wrap file for the project:

[wrap-git]
directory=rizin-wrap
url=https://github.com/<your-username>/rizin-wrap.git

[wrap-file]
directory=.
source_dir=.

Note: Replace with your GitHub username.

Save and close the rizin.wrap file.

Commit and push the changes to your Git repository:

git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/<your-username>/rizin-wrap.git
git push -u origin master

Note: Replace with your GitHub username.

Test the wrap by creating a new Meson project and using the rizin wrap:

meson my-project --wrap rizin
cd my-project
meson compile

This should compile your project with the Rizin library linked. If there are any issues, you can check the Meson logs for more information.

I hope this helps you create a Meson wrap for the Rizin library!

XVilka commented 1 year ago

Even if I apply the PR, one issue still remains:

lz4| Project name: lz4
lz4| Project version: 1.9.4
lz4| C compiler for the host machine: cc (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.202)")
lz4| C linker for the host machine: cc ld64 820.1
lz4| Program GetLz4LibraryVersion.py found: YES (/opt/homebrew/opt/python@3.11/bin/python3.11 /Users/anton.kochkov/Rizin/wrapdb/subprojects/lz4-1.9.4/contrib/meson/meson/GetLz4LibraryVersion.py)
lz4| Message: Project version is now: 1.9.4
lz4| Compiler for C supports arguments -Wcast-qual: YES
lz4| Compiler for C supports arguments -Wcast-align: YES
lz4| Compiler for C supports arguments -Wshadow: YES
lz4| Compiler for C supports arguments -Wswitch-enum: YES
lz4| Compiler for C supports arguments -Wdeclaration-after-statement: YES
lz4| Compiler for C supports arguments -Wstrict-prototypes: YES
lz4| Compiler for C supports arguments -Wundef: YES
lz4| Compiler for C supports arguments -Wpointer-arith: YES
lz4| Compiler for C supports arguments -Wstrict-aliasing=1: YES
lz4| Compiler for C supports arguments -DLZ4_DEBUG=1: YES
lz4| Build targets in project: 11
lz4| Subproject lz4 finished.

subprojects/rizin/meson.build:542:21: ERROR: Requested variable "lz4_dep" not found.

A full log can be found at /Users/user/Rizin/wrapdb/builddir/meson-logs/meson-log.txt
ret2libc commented 1 year ago

Do you have a PR for this?