Find a file
2021-10-24 13:18:46 +02:00
.github/workflows workflows: Install g++10 in order to use c++20 2021-05-01 22:21:28 +02:00
abis meta: add mlibc-config.h and replace bit/features.h 2021-10-24 13:18:45 +02:00
ci ci: disable linux option on ansi only 2021-10-24 13:18:46 +02:00
libcrypt/src libcrypt: Add a dummy libcrypt to satisfy shadow 2021-01-12 21:18:33 +01:00
libdl/src Remove unused makefiles 2019-02-20 18:59:22 +01:00
libm/src Remove unused makefiles 2019-02-20 18:59:22 +01:00
libpthread/src Remove unused makefiles 2019-02-20 18:59:22 +01:00
libresolv/src meta: Build an empty libresolv to satisfy some programs 2021-01-14 20:48:51 +01:00
librt/src Remove unused makefiles 2019-02-20 18:59:22 +01:00
libutil/src Remove unused makefiles 2019-02-20 18:59:22 +01:00
options options/{posix,linux}: move poll.h to posix 2021-10-24 13:18:46 +02:00
scripts scripts: add abi-link.sh script 2020-08-29 12:31:13 +02:00
subprojects build: Add wraps for cxxshim and frigg deps. 2018-11-17 16:11:20 +01:00
sysdeps meta: add mlibc-config.h and replace bit/features.h 2021-10-24 13:18:45 +02:00
tests options/ansi: implement abort 2021-06-20 14:43:29 +02:00
.gitignore qword: Move mount to own header 2019-12-29 09:33:35 +01:00
internal-config.h.in meta: add mlibc-config.h and replace bit/features.h 2021-10-24 13:18:45 +02:00
LICENSE Update LICENSE 2020-01-22 19:13:46 +01:00
meson.build meson.build: make glibc option optional 2021-10-24 13:18:46 +02:00
meson_options.txt meson.build: make glibc option optional 2021-10-24 13:18:46 +02:00
mlibc-config.h.in meson.build: make glibc option optional 2021-10-24 13:18:46 +02:00
README.md docs: Add local development instructions 2021-05-17 22:41:37 +01:00

mlibc is a C standard library

Continuous Integration

Official Discord server: https://discord.gg/7WB6Ur3

Design of the library

Directory Purpose
options/ (More or less) OS-independent headers and code.
options/ is divided into subdirectories that can be enabled or disabled by ports.
sysdeps/ OS-specific headers and code.
sysdeps/ is divded into per-port subdirectories. Exactly one of those subdirectories is enabled in each build.
abis/ OS-specific interface headers ("ABI headers"). Those contain the constants and structs of the OS interface. For example, the numerical values of SEEK_SET or O_CREAT live here, as well as structs like struct stat. ABI headers are only allowed to contain constants, structs and unions but no function declarations or logic.
abis/ is divided into per-OS subdirectories but this division is for organizational purposes only. Ports can still mix headers from different abis/ subdirectories.

Porting mlibc to a new OS: Ports to new OSes are welcome. To port mlibc to another OS, the following changes need to be made:

  1. Add new sysdeps/ subdirectory sysdeps/some-new-os/ and a meson.build to compile it. Integreate sysdeps/some-new-os/meson.build into the toplevel meson.build.
  2. Create ABI headers in abis/some-new-os/. Add symlinks in sysdeps/some-new-os/include/abi-bits to your ABI headers. Look at existing ports to figure out the ABI headers required for the options enabled by sysdeps/some-new-os/meson.build.
  3. In sysdeps/some-new-os/, add code to implement (a subset of) the functions from options/internal/include/mlibc/sysdeps.hpp. Which subset you need depends on the options that sysdeps/some-new-os/meson.build enables.

Local Development

The mlibc test suite can be run under a Linux host. To do this, first run from the project root:

meson -Dbuild_tests=true build

This will create a build directory. Then, cd build and run the tests (showing output) with:

meson test -v