Skip to content

Commit 7d7d08b

Browse files
Add mojo-libc package (#32)
* Add new mojo-libc package Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Add tests * Add avatar and Mojo image * Fix github link Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Add the extra section to the recipe.yaml Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Update libc revision to the one that includes the LICENSE Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Fix recipe script Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Fix the paths in the build recipe Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Pin Max 24.6 version * Add main() function to the tests Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Fix test file Signed-off-by: Manuel Saelices <msaelices@gmail.com> * Remove test as it's broken --------- Signed-off-by: Manuel Saelices <msaelices@gmail.com> Co-authored-by: Caroline Frasca <42614552+carolinefrasca@users.noreply.github.com>
1 parent 4c0c2c6 commit 7d7d08b

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

recipes/libc/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Mojo's libc
2+
3+
`mojo-libc` is a library that provides access to the C standard library functions in Mojo.
4+
5+
## Getting Started
6+
7+
The only dependency for `libc` is Mojo.
8+
9+
You can install Mojo following the instructions from the [Modular website](https://www.modular.com/max/mojo).
10+
11+
Once you have created a Mojo project using the `magic` tool,
12+
13+
1. Add `libc` as a dependency:
14+
```toml
15+
[dependencies]
16+
libc = ">=0.1.9"
17+
```
18+
2. Run `magic install` at the root of your project, where `mojoproject.toml` is located
19+
20+
3. `libc` should now be installed as a dependency. You can import libc functions from the library, e.g:
21+
```mojo
22+
from libc import socket
23+
```
24+
25+
## Supported Functionality
26+
27+
### Basic socket connections
28+
29+
See the examples in [examples/sockets/](https://github.com/msaelices/mojo-libc/tree/main/examples/sockets) directory.
30+
31+
### Basic file system operations
32+
33+
See the examples in [examples/files/](https://github.com/msaelices/mojo-libc/tree/main/examples/files) directory.

recipes/libc/avatar.jpeg

34.5 KB
Loading

recipes/libc/image.jpeg

12.7 KB
Loading

recipes/libc/recipe.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
context:
2+
version: "0.1.9"
3+
4+
package:
5+
name: "libc"
6+
version: ${{ version }}
7+
8+
source:
9+
- git: https://github.com/msaelices/mojo-libc.git
10+
rev: 674d0fd35af4e716eb30df18cb1fe25cdddb08cf
11+
12+
build:
13+
number: 0
14+
script:
15+
- mojo package src/libc -o ${PREFIX}/lib/mojo/libc.mojopkg
16+
17+
requirements:
18+
host:
19+
- max == 24.6
20+
run:
21+
- ${{ pin_compatible('max') }}
22+
23+
about:
24+
homepage: https://github.com/msaelices/mojo-libc
25+
license: MIT
26+
license_file: LICENSE
27+
summary: Mojo's libc support
28+
repository: https://github.com/msaelices/mojo-libc
29+
30+
extra:
31+
maintainers:
32+
- msaelices
33+
- crisadamo
34+
project_name: mojo-libc

0 commit comments

Comments
 (0)