- Libraries:
Userland/Libraries/{LibC, LibGUI...}
- Games:
Userland/Games/{Snake, Solitaire...}
- Applications:
Userland/Applications/{Calculator, Calendar...}
SerenityOS is built using CMake and Ninja.
-
Target: output files of the build process (executables, libraries).
-
Use Ninja with CMake:
cmake -G Ninja
(generates abuild.ninja
file) -
Build target:
ninja <target>
-
Build default:
ninja
("default" target is built. In CMake, default="all" for all the targets in the project) -
List targets:
ninja -t targets
-
Installation:
ninja install
The install target is generated in cmake byinstall(...)
command. -
Targets specific to SerenityOS:
$ ninja image # Generate image to run
$ ninja run # Run image on qemu
The following CMake functions are defined in: Meta/CMake/utils.cmake
serenity_component(...)
serenity_app(...)
serenity_lib(...)
- Kernel-level implementations in
Kernel/Syscalls/*.cpp
- User-level functions to call in
Userland/Libraries/LibCore/System.cpp
- Notion inspired by OpenBSD.
- Specifies a set of promises, each allowing certain syscalls:
- stdio: Basic I/O (read, write, close...)
- rpath: Read filesystem access (open, stat, getcwd...)
- unix: Unix domain sockets (socket, bind, listen...)
- Actual
main()
entry point defined inUserland/Libraries/LibMain/Main.cpp
. - Does some initialization, and calls
serenity_main()
. serenity_main()
returns anErrorOr<ResultType, ErrorType>
(defined inAK/Error.h
and without ErrorType inAK/Forward.h
).
- The following two system calls are placed at beginning of
serenity_main()
for security purposes (to sandbox apps).- pledge(): Limit system calls a process can make.
- unveil(): Allow access only to specific files and directories.
- Defined in
AK/Try.h
- Executes the passed expression (function) that returns an
ErrorOr
. - On error,
serenity_main()
returns with the error inErrorOr
. - On success, the
ErrorOr
value is assigned to a variable. - Implemented using a compound statement (valid in GNU C), that evaluates to its last subexpression.