Commit graph

149 commits

Author SHA1 Message Date
Riccardo Schirone
1ea1d265b6 Move libuv to meson subproject wrap
* disable werror on libuv, it would fail otherwise
* ci.yml: use --werror instead of changing CFLAGS
* keep libuv optional but used by default
2021-02-12 11:08:51 +08:00
Riccardo Schirone
fe05c9710a Move xxhash to meson subproject wrap 2021-02-12 11:08:51 +08:00
Riccardo Schirone
9349b2f3ed Move libzip to meson subproject wrap
* optionally depend on lzma, bzip2 and openssl for additional zip support
* add use_sys_libzip_openssl meson option to choose if openssl should be
  used in libzip or not
* avoid optional dependencies on windows to avoid troubles
2021-02-12 11:08:51 +08:00
Riccardo Schirone
95d4564434 Move zlib to meson subproject wrap 2021-02-12 11:08:51 +08:00
Riccardo Schirone
43e4269d34 Make use_sys_* meson option features instead of boolean
* Use the features directly as argument of `dependency`.
* Remove doc/capstone.md doc file because already in PACKAGERS.md
2021-02-12 11:08:51 +08:00
Riccardo Schirone
f8291ee3c1
Switch to meson subprojects and wraps
* Remove tree-sitter/sdb git submodules and move them to meson subprojects/wraps
* Use meson subprojects/wraps to get capstone
* Remove capstone patches as they are already applied to rizinorg/capstone repository
* Use meson from master branch to create the release tarball, as all released versions so far have a bug that prevent wrap-git to be patched correctly when creating the tarball with meson dist
* Add check_meson_subproject script to do a quick check if the currently downloaded subprojects are updated
* Add subprojects_check meson option to skip the check_meson_subproject script
* Update documentation to remove references to git submodules.
2021-02-03 14:31:11 +01:00
Florian Märkl
e76c435565
Add rz_strf() Macro (#506) 2021-02-02 19:17:44 +01:00
Riccardo Schirone
7ec33c3cb4
Rename .acr to .in and remove RZ_MESON_VERSION (#499) 2021-02-01 13:33:23 +00:00
Riccardo Schirone
11ed71244c
Search for static dependencies/libraries when static_runtime is set (#473)
Do not search for static windows-specific libraries, they will be
handled by /MT.
2021-01-29 16:54:18 +08:00
Riccardo Schirone
f1f11349a1 Use 'v' prefix for version 2021-01-28 11:57:28 +01:00
Riccardo Schirone
4198091991 Remove configure.acr and use meson project version 2021-01-28 11:57:28 +01:00
Riccardo Schirone
301e5af217 Remove RZ_GITTAP 2021-01-28 11:57:28 +01:00
Riccardo Schirone
cee8d470c2 Remove Makefiles and many related scripts 2021-01-28 11:57:28 +01:00
Riccardo Schirone
018c0eaa53
Change how version is reported in -v command flag 2021-01-27 16:42:47 +08:00
Paul I
0d3cd2ff56
Update sdb submodule (#446)
* Update sdb submodule

* Update makefile
2021-01-24 21:30:07 +08:00
GustavoLCR
03d97f1e83
Meson: Escape paths on Windows (#444) 2021-01-24 00:37:24 +01:00
Riccardo Schirone
1d9ffc916f
Fix rpath on MacOS, broken by moving binaries for signing (#411) 2021-01-21 09:13:41 +01:00
Khairul Azhar Kasmiran
ca2471ae95
Update sdb submodule to latest (#349)
* Update sdb submodule to 82434290dbb535671354cdc3f96ee3e1a380587f

* Try to remove SDB_API definition

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2021-01-13 19:11:29 +08:00
Riccardo Schirone
6f41360178
MacOS improvements (#322)
* Ad-hoc sign rizin binary with debugger entitlements on MacOS
* Use re.rizin.rizin and move OSX pkg files in dist/osx
* Use dist/osx/build_osx_package.sh to create OSX pkg with meson
* Mention how to create OSX pkg in doc/PACKAGERS.md
* Remove doc/macos.md
2021-01-11 14:45:38 +01:00
Anton Kochkov
f53c0e194e Set gnu99/c99 for ACR builds too 2021-01-06 21:19:18 +08:00
Michael Scherer
80efabdf92 Add -std=c99, for older gcc ##build
While modern compilers seems to default to c99, GCC 4.8,
the version on RHEL 7 don't, despites supporting C99.
2021-01-06 21:19:18 +08:00
Anton Kochkov
e9d91af698 More Rizin renames 2021-01-05 05:21:41 -06:00
Khairul Azhar Kasmiran
ab9605acb5
Use /MT for VS2019 build (#300)
* Do not use MTd, just MT

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-01-05 17:36:12 +08:00
Riccardo Schirone
7316b71619 Simplify io_default with RzBuffer 2021-01-03 11:42:38 +01:00
Riccardo Schirone
a7fd3fa3c6 Use mu_main to reduce boilerplate in unit tests
* Disable colors on Windows because terminal looks bad otherwise
* Use environment on Windows to set PATH and make sure unit tests use
  the compiled libraries and not the installed ones
* Define ssize_t on Windows as well by using SSIZE_T

Update test_analysis_block.c

Update test_intervaltree.c

Update test_unum.c
2021-01-03 11:42:38 +01:00
yossizap
53e96239a6
Disable clang-cl -fno-common (#227)
Co-authored-by: yossizap <yossizap@users.noreply.github.com>
2020-12-20 14:42:22 +08:00
Riccardo Schirone
a0e8808994
Use async-signal-safe functions after fork in multithread program (#207)
* Do not use setenv after fork, it's not async-signal-safe
* Do not use mutexes after fork

If pipe2 is not available on a system, we try to simulate the atomic
setting of O_CLOEXEC in different ways (depending on whether O_CLOEXEC
is at least available or not). However this involves using mutexes. When
forking, only the calling thread is forked, so it is important to lock
the mutex before the fork. However, in the child between the fork and
the exec* it is recommended to use only async-signal-safe functions. mutex
operations are not async-signal-safe, so we just keep track of whether we are
in the child or not and avoid using the mutex as necessary.

* Replace pthread_atfork with rz_sys_fork
2020-12-18 19:32:06 +01:00
Riccardo Schirone
564e64be3e
Improve meson information, structure and move fortunes (#213)
* Simplify a bit meson.build
* Use meson summary and move fortunes install dir
* Use 0.55.0 meson version
* Use /CURRENTUSER to select local installation
2020-12-18 11:28:19 +01:00
Riccardo Schirone
a20dd5a338
Check if submodules are downloaded and warn user if they are not (#184) 2020-12-17 23:13:43 +01:00
Riccardo Schirone
286f930b93 Use O_CLOEXEC when creating pipes so they are closed on exec
By default, pipes file descriptors are not closed on exec. This means
they are inherited by the child process. However, this may be a problem
in particular in multi-threading programs (e.g. rz-test), because EOF is
not sent to a pipe until the last pipe file descriptor is closed.

This commit makes sure that by default pipes are created with O_CLOEXEC,
so they are closed whenever an exec syscall is executed. Usually pipe
file descriptors are duplicated to be stdin/stdout/stderr of the
children process and those dupped file descriptors won't be closed on
exec.

In case pipe2 is not available (e.g. MacOS), we do a pipe + fcntl, which
is in theory racy (see man open(2)). For this reason pipe, exec, system,
etc. are wrapped in rz_sys and they use a global mutex to make sure a
pipe is either created and set as O_CLOEXEC or not created at all before
an exec operation is done.

On very old systems, O_CLOEXEC may not be available at all. In those
cases, which should be rare, we just keep a list of file descriptors
created with rz_sys_pipe that we need to close before executing another
process.

Interaction with external libs may be tricky. We expect external libs to
create files/pipes that need to be closed on exec with the right flags
and we expect rizin code to manually close pipes file descriptors as
appropriate if the exec syscall is executed by an external library
(non-rizin code).

Make sure execl is found by acr/make
2020-12-15 10:18:50 +01:00
Riccardo Schirone
bbccf28ee0
Use RPATH when the prefix is not the standard /usr (#164)
This is to make it easier for people to install rizin without dealing
with LD_LIBRARY_PATH, while at the same time avoiding RPATH when things
are installed in the system-wide path (for most systems, at least). In
any case, people can disable this behaviour by using `-Dlocal=disabled`.
2020-12-11 00:07:39 +08:00
Riccardo Schirone
85ce44b435 Ignore unresolved symbols in object files on FreeBSD
On some platforms (e.g. FreeBSD) by default -Wl,--no-undefined is passed
to the compiler, thus when generating the util library there is an
error, because `environ` is defined only in an executable. Let's
automatically add a linker option to ignore those errors on FreeBSD.
2020-12-09 18:37:30 +01:00
Riccardo Schirone
f5bfadf181
Use meson in FreeBSD/OpenBSD CI (#138)
* Use meson in FreeBSD/OpenBSD CI
2020-12-09 08:58:05 +08:00
Anton Kochkov
041d73dce3
Change the "anal" abbreviation to "Analysis" in Code (#117) 2020-12-06 19:25:27 +01:00
Giovanni
35a9ef94c9
Code and comments cleanup (#108) 2020-12-04 18:11:51 +08:00
Riccardo Schirone
7912502149
Fix compilation when python is run through meson runpython (#111)
Multiline scripts had issues on my windows system while building
from `cmd`. I removed some "pre_sdb" scripts used to read symlinks
because there are only two and it's probably easier to just avoid
symlinks for better portability.

Also moved a bunch of inlined script to separate files in sys/.
2020-12-01 09:17:24 +01:00
Riccardo Schirone
9ce5003ca6
Create RzCmdDesc generator from YAML file ##newshell
* Create RzCmdDesc generator from YAML file

The commands tree can be entirely described in a YAML file, that is
parsed at build-time and generates cmd_descs.c/cmd_descs.h files. The
developer then just needs to provide the handler with the proper name to
make sure things work.

* Add PyYAML to CI jobs
2020-11-16 09:36:51 +01:00
Riccardo Schirone
22239a1bfc
Delete some unneded documentation (#59)
* Adjust doxygen documentation on rz_cmd
2020-10-30 16:06:38 +01:00
Riccardo Schirone
cb09988b9d
Rewrite some documentation (#49) 2020-10-26 17:12:19 +01:00
Florian Märkl
4e18226c8d
Add new Projects Implementation (#12) 2020-10-26 15:17:33 +01:00
Riccardo Schirone
7ceebc725e Mass renaming r2 to rz/rizin 2020-10-13 12:43:34 +02:00
Riccardo Schirone
502e91aff7
Rename R_ and R2_ to RZ_ (#8)
* Rename R2_ -> RZ_
* Rename R_ -> RZ_
* Rename R2R_ -> RZ_TEST_
* Rename R2R defines and types to RZ_TEST/RzTest
* Keep R_ for REIL registers
2020-10-02 16:09:13 +02:00
Anton Kochkov
881058693d
Remove GRUB and librz_fs plugins (#9) 2020-10-02 21:02:00 +08:00
Riccardo Schirone
338e6fe172 Other renames in man and small places
Remove rz link, just keep rizin

Remove r2 link from acr

Fix http test on macos
2020-10-01 17:53:29 +02:00
Riccardo Schirone
721609a17b
Rename to rizin (#2) 2020-10-01 16:13:03 +02:00
Damien Zammit
56fb85bff4
Revert "r2sdb: Install executable" (#17724)
This partially reverts commit 2a0d8fbe59
Fix meson warnings.
2020-09-29 11:22:43 +02:00
Damien Zammit
2a0d8fbe59
Install r2sdb, detect R2_HOME_SDB_FCNSIGN for r2extras custom CC ##build
* cc: Add autodetection for R2_HOME_SDB_FCNSIGN new location of custom calling conventions
* Fix r_file_exists not expanding tilde path
* r2sdb: Install executable
2020-09-24 12:26:53 +02:00
Florian Märkl
ed00e85e65
Use sdb == for generating dbs in meson (#17676) 2020-09-21 15:11:46 +02:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
Ole André Vadla Ravnås
8681963bce
Add Meson option to specify whether CLI tools should be built (#17625) ##build 2020-09-10 14:55:06 +02:00