diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-05-06 18:40:06 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-14 20:15:18 +0200 |
commit | 450a2a0f9ce2443bc06445ee018c9860d8cd5fc8 (patch) | |
tree | c124a612ef259b764855af5e33c39e0d09ad4df2 /Documentation | |
parent | 49727ffee424d8c0038ce18b91b0bf0ff33b1a4d (diff) | |
download | serenity-450a2a0f9ce2443bc06445ee018c9860d8cd5fc8.zip |
Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/BuildInstructions.md | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Documentation/BuildInstructions.md b/Documentation/BuildInstructions.md index 5fbd287624..a4be3b7d3e 100644 --- a/Documentation/BuildInstructions.md +++ b/Documentation/BuildInstructions.md @@ -5,7 +5,7 @@ Make sure you have all the dependencies installed: **Debian / Ubuntu** ```bash -sudo apt install build-essential curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs qemu-system-i386 qemu-utils +sudo apt install build-essential cmake curl libmpfr-dev libmpc-dev libgmp-dev e2fsprogs qemu-system-i386 qemu-utils ``` On Docker, install these as well: @@ -15,12 +15,12 @@ sudo apt install wget genext2fs **Fedora** ```bash -sudo dnf install curl mpfr-devel libmpc-devel gmp-devel e2fsprogs @"C Development Tools and Libraries" @Virtualization +sudo dnf install curl cmake mpfr-devel libmpc-devel gmp-devel e2fsprogs @"C Development Tools and Libraries" @Virtualization ``` **Arch Linux / Manjaro** ```bash -sudo pacman -S base-devel curl mpfr libmpc gmp e2fsprogs qemu qemu-arch-extra +sudo pacman -S base-devel cmake curl mpfr libmpc gmp e2fsprogs qemu qemu-arch-extra ``` Ensure your gcc version is >= 8 with `gcc --version`. Otherwise, install it (on Ubuntu) with: @@ -61,16 +61,22 @@ Notes: pkg_add bash gmp gcc git flock gmake sudo ``` -When building with `make`, `gmake` must be used. The `makeall.sh` script will do this automatically when building on OpenBSD. - ### Build > Before starting, make sure that you have configured your global identity for git, or the first script will fail after running for a bit. Go into the `Toolchain/` directory and run the **BuildIt.sh** script. -Once you've built the toolchain, go into the `Kernel/` directory, then run -**./makeall.sh**, and if nothing breaks too much, take it for a spin by using -**./run**. +Once you've built the toolchain, create a directory for the build to live in (for example, `Build/`), and run the CMake build: +``` +$ mkdir Build && cd Build +$ cmake .. +$ make +$ make install +``` + +This will compile all of SerenityOS and install the built files into `Root/` inside the build tree. `make install` actually pulls in the regular `make` (`make all`) automatically, so there isn't really a need to run it exlicitly. You may also want ask `make` to build things in parallel by using `-j`, optionally specifying the maximum number of jobs to run. + +Now to build a disk image, run `make image`, and if nothing breaks too much, take it for a spin by using `make run`. Note that the `anon` user is able to become `root` without password by default, as a development convenience. To prevent this, remove `anon` from the `wheel` group and he will no longer be able to run `/bin/su`. @@ -79,9 +85,9 @@ On Linux, QEMU is significantly faster if it's able to use KVM. The run script w Bare curious users may even consider sourcing suitable hardware to [install Serenity on a physical PC.](https://github.com/SerenityOS/serenity/blob/master/INSTALL.md) -Later on, when you `git pull` to get the latest changes, there's no need to rebuild the toolchain. You can simply rerun **./makeall.sh** in the `Kernel/` directory and you'll be good to **./run** again. +Later on, when you `git pull` to get the latest changes, there's no need to rebuild the toolchain. You can simply run `make install`, `make image`, `make run` again. CMake will only rebuild those parts that have been updated. -You can even re-compile only parts of the system. Imagine you changed something in the **WindowServer**. Then run `make -C ../Services/WindowServer` (from the `Kernel/` directory) followed by **./sync.sh** to update the disk image. Then you can start the system with **./run** again. +You may also want to replace `make` with `ninja` in the above (use `cmake .. -G Ninja` when configuring the build) for some additional build speed benefits. #### Ports To add a package from the ports collection to Serenity, for example curl, go into `Ports/curl/` and run **./package.sh**. The sourcecode for the package will be downloaded and the package will be built. After that, run **./sync.sh** from the `Kernel/` directory to update the disk image. The next time you start Serenity with **./run**, `curl` will be available. |