Skip to content

Commit 306ece5

Browse files
committed
update readme
1 parent 7f3294e commit 306ece5

File tree

1 file changed

+46
-21
lines changed

1 file changed

+46
-21
lines changed

README.md

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,45 @@ Build [mruby](https://github.com/mruby/mruby) using [zig](https://ziglang.org) (
1212

1313
> Yeah, but your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.
1414
>
15-
> Jeff Goldblum
15+
> - Jeff Goldblum
1616
17-
This project builds MRuby entirely from source, only using Zig.
17+
This project builds MRuby from source, only using Zig.
1818

19-
This means we emulate MRuby's non-trivial build process entirely in Zig.
19+
This means we emulate MRuby's non-trivial Rake-based build process entirely in Zig.
2020

21-
## What doesn't work
21+
## Issues
2222

23-
- non-standard library gems that use any custom Ruby logic in their `mrbgem.rake`
24-
- preallocation of symbols (this depends on Ruby regex)
25-
- `mruby.zig` in transitive Zig dependencies (just use it globally in one package for now)
23+
- Non-standard library gems that use any Ruby logic in their `mrbgem.rake` files aren't supported
24+
- Symbol preallocation isn't supported (this depends on Ruby regex to create the C files)
25+
- Using `mruby.zig` in transitive Zig dependencies will likely cause issue (just use it globally in one package for now)
26+
- We have to fork MRuby just to add back `mrbgems/mruby-compiler/core/y.tab.c`
2627

27-
## What does work
28+
## Usage
2829

29-
Pretty much everything else.
30+
### Command line tools
3031

31-
### Command line tools and examples
32+
To install all the CLI programs:
3233

3334
```
34-
$ zig build -h
35+
zig build
36+
```
37+
```
38+
$ tree zig-out/bin/
39+
zig-out/bin/
40+
├── host-mrbc
41+
├── mirb
42+
├── mrbc
43+
├── mrbtest
44+
├── mruby
45+
└── mruby-strip
46+
```
47+
48+
See `zig build -h` for information about everything available:
49+
50+
```
51+
zig build -h
52+
```
53+
```
3554
Usage: /path/to/zig build [steps] [options]
3655
3756
Steps:
@@ -49,13 +68,10 @@ Steps:
4968
example-zig Run src/example.zig
5069
```
5170

52-
For example, to run the MRuby tests
71+
To run MRuby's tests:
5372

5473
```
55-
zig build -Doptimize=ReleaseFast
56-
57-
# or just `zig build mrbtest` directly
58-
./zig-out/bin/mrbtest
74+
zig build mrbtest
5975
```
6076
```
6177
mrbtest - Embeddable Ruby Test
@@ -74,16 +90,23 @@ Warning: 0
7490
To use `mirb`, `mruby`, etc:
7591

7692
```
77-
./zig-out/bin/mruby -v
78-
mruby 3.3.0 (2024-02-14)
79-
80-
$ ./zig-out/bin/mirb
93+
$ zig build mirb
8194
mirb - Embeddable Interactive Ruby Shell
8295
8396
> MRUBY_VERSION
8497
=> "3.3.0"
8598
```
8699

100+
### Examples
101+
102+
To run the examples:
103+
104+
```
105+
zig build example-c
106+
zig build example-rb
107+
zig build example-zig
108+
```
109+
87110
### Cross compilation
88111

89112
Linux/Mac are the only targets currently supported, but support for others shouldn't be difficult.
@@ -96,7 +119,9 @@ zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu
96119

97120
### Using in a Zig project
98121

99-
TODO: document this
122+
See the `example-zig` step in [build.zig](build.zig), and [src/example.zig](src/example.zig).
123+
124+
TODO: document creating and using custom gems
100125

101126
## Contributing
102127

0 commit comments

Comments
 (0)