2022-06-20 03:51:19 +00:00
|
|
|
|
2023-06-24 15:50:53 +00:00
|
|
|
# Ciabatta
|
2022-06-26 04:39:15 +00:00
|
|
|
|
2023-06-24 15:54:28 +00:00
|
|
|
![Build Status](https://github.com/flysand7/ciabatta/actions/workflows/build.yml/badge.svg?event=push)
|
2023-06-24 15:52:53 +00:00
|
|
|
|
2022-08-06 11:53:50 +00:00
|
|
|
Ciabatta - An implementation of cross-platform C standard library with the
|
|
|
|
following goals:
|
|
|
|
|
|
|
|
- Providing C standard library that fully implements all C features. Some
|
|
|
|
standard libraries lack many features of C11 and C23, like threads.h or
|
|
|
|
aligned_alloc in case of msvcrt.
|
|
|
|
- Making standard library that is easy to port to other platforms, for example
|
|
|
|
an embedded platform or a custom operating system.
|
|
|
|
- Allowing applications to debug and step into standard library functions
|
|
|
|
- Reasonably fast CRT compared to MSVCRT and glibc.
|
|
|
|
- Extend the possibilities of C standard library with commonly used
|
|
|
|
functionality: implementing POSIX standard (including directories and
|
|
|
|
sockets), capability for unicode processing.
|
|
|
|
|
|
|
|
Ciabatta is not binary-compatible with other CRT libraries. That means that any
|
|
|
|
libraries that your project uses have to also be compiled with Ciabatta,
|
|
|
|
otherwise you might run into issues.
|
|
|
|
|
|
|
|
Please note that as of today ciabatta is still during development and does not
|
|
|
|
implement many of the features that need to be implemented. Using it at current
|
|
|
|
time is discouraged.
|
|
|
|
|
2023-06-24 15:50:53 +00:00
|
|
|
## Support
|
2022-08-06 11:53:50 +00:00
|
|
|
|
2023-06-24 15:50:53 +00:00
|
|
|
Operating System:
|
|
|
|
- Windows
|
2023-07-22 14:46:04 +00:00
|
|
|
- Linux
|
2022-06-20 03:51:19 +00:00
|
|
|
|
2022-08-06 11:53:50 +00:00
|
|
|
Processor Architecture:
|
|
|
|
- x86-64
|
|
|
|
|
2023-06-24 15:50:53 +00:00
|
|
|
This library is supposed to be extensible to other platforms, meaning that
|
|
|
|
you can write an OS layer for another OS and use the rest of the CRT
|
|
|
|
functionality.
|
|
|
|
|
2023-07-22 14:30:04 +00:00
|
|
|
## Building ciabatta
|
2022-08-06 11:53:50 +00:00
|
|
|
|
2023-07-22 14:46:04 +00:00
|
|
|
Before proceeding please note that ciabatta can only be compiled and used
|
|
|
|
with `clang`. It may be able to work with `gcc` with some minor adjustments
|
|
|
|
but I didn't test.
|
2023-06-24 15:50:53 +00:00
|
|
|
|
2023-07-23 09:36:23 +00:00
|
|
|
For executing the script you will need lua and some lua dependencies that
|
|
|
|
you can install with luarocks:
|
|
|
|
|
|
|
|
```
|
|
|
|
# luarocks install lua-path
|
|
|
|
# luarocks install argparse
|
|
|
|
```
|
|
|
|
|
|
|
|
### Building
|
|
|
|
|
|
|
|
On linux you can simply run `./build.lua` script. On windows you have to run
|
|
|
|
it like `lua build.lua`. Reference for command-line options:
|
|
|
|
|
|
|
|
```
|
|
|
|
Usage: build.lua [-h] [-c] [-o] [-r] [-p <platform>] [-l <library>]
|
|
|
|
[-t <test>] [--options <options>]
|
|
|
|
Options:
|
|
|
|
-h, --help Show this help message and exit.
|
|
|
|
-c, --clean Remove all the binaries before recompiling
|
|
|
|
-o, --only Do not compile ciabatta
|
|
|
|
-r, --release Compile the release version (without it will compile everything in debug mode)
|
|
|
|
-p --platform <platform> OS to compile for (linux, windows)
|
|
|
|
-l --library <library> Type of library to compile (static, shared)
|
|
|
|
-t --test <test> Compile a C file and link the library against it
|
|
|
|
--options <options> Additional options to provide to the executable
|
|
|
|
```
|
2023-07-22 14:30:04 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Grab the following files into your project's (or any other) directory:
|
|
|
|
|
|
|
|
- The `./include` folder
|
|
|
|
- The `.lib` folder
|
|
|
|
- (Windows only) The `utf8` folder
|
|
|
|
|
|
|
|
In order to compile your project with ciabatta see the following sections
|
|
|
|
|
|
|
|
### Compiling with ciabatta on windows
|
|
|
|
|
|
|
|
1. Add the following flags to your compilation command:
|
2023-07-22 14:46:04 +00:00
|
|
|
`-nostdlib -I ./include utf8.obj -mfma`
|
2023-07-22 14:30:04 +00:00
|
|
|
2. Link to the following libraries:
|
2023-07-22 14:46:04 +00:00
|
|
|
`-l ./lib/ciabatta.lib`
|
2023-07-22 14:30:04 +00:00
|
|
|
|
|
|
|
**Note:** The `include` folder refers to the folder you copied from ciabatta. Set the path to it accordingly.
|
|
|
|
|
|
|
|
### Compiling with ciabatta on linux
|
|
|
|
|
2023-07-22 14:46:04 +00:00
|
|
|
- In case of static linking:
|
2023-07-22 14:30:04 +00:00
|
|
|
1. Add the following flags to your compilation command:
|
2023-07-22 14:46:04 +00:00
|
|
|
- `-nostdlib -static -I ./include`
|
2023-07-22 14:30:04 +00:00
|
|
|
2. Link to the following libraries
|
2023-07-22 14:46:04 +00:00
|
|
|
- `./lib/ciabatta.a`
|
|
|
|
- In case of dynamic linking:
|
2023-07-22 14:30:04 +00:00
|
|
|
1. Add the following flags to your compilation command:
|
2023-07-22 14:46:04 +00:00
|
|
|
- `-nostdlib -no-pie -I ./include`
|
2023-07-22 14:30:04 +00:00
|
|
|
2. Link to the following libraries:
|
2023-07-22 14:46:04 +00:00
|
|
|
- `./lib/ciabatta.so ./lib.ctors.o ./lib.entry.o`
|
2022-06-20 03:51:19 +00:00
|
|
|
|
2023-06-24 15:50:53 +00:00
|
|
|
## Contributing
|
2022-06-20 03:51:19 +00:00
|
|
|
|
2022-08-06 11:53:50 +00:00
|
|
|
Pull requests welcome and accepted in any form.
|
2022-06-20 03:51:19 +00:00
|
|
|
|
2023-06-24 15:50:53 +00:00
|
|
|
## License
|
2022-06-20 03:51:19 +00:00
|
|
|
|
2023-07-22 14:30:04 +00:00
|
|
|
See [the license file](license)
|