User:Oldman/A layman's guide/How to compile ReactOS
This guide shows you how to make your own working environment, down load the ReactOS source code and then compile it using the Reactos Build Evironment. The main section covers Windows and the subsection covers unix.
- 1 Setting up a local working environment
- 2 Compiling the source
- 3 Screenshots
- 4 Getting the source of a single branch
- 5 How to compile ReactOS - Unix subsection
- 6 Setting up a local working environment
- 7 Compiling the source
Setting up a local working environment
Next you will need to create a master folder to keep all the next folders in one place. This folder can be created in C: or D: (or any other drive partition), for example D:\ReactOS_Development or C:\ROS.
Create the following folders in your master folder:
1. \source (the name does not matter - you will download the source tree into this folder).
2. \compiled (the name does not matter - this is the output folder where the binaries are complied to and the ISO is created).
3. \RosBE (this is where you will install RosBE).
You should now have something like the following examples.
Using example No2, within D:\ReactOS_Development\ create a Compiled folder, a RosBE folder and a Source folder. Next, navigate into D:\ReactOS_Development\Source and right click within the folder, then select Git Clone, then in the next window, enter this url https://github.com/reactos/reactos.git; this will create a reactos folder and download the current source tree into it.
I have noticed this behaviour with Git; if you first copy the url, then click in the source folder, you will find that Git has put the copied url in the Url input and put the path to your source folder with the addition of reactos, in the Directory input. See   [3a] [3b]  in the Getting the source with Git section below.
For how to update your local source, see the subsection Updating a local source tree with Git.
Having downloaded the source you will now need to download and install the ReactOS Build Environment    (a link to the latest version (Windows and Unix) can be found here: https://www.reactos.org/wiki/ReactOS_Build_Environment) into D:\ReactOS_Development\RosBE.
Note: if want to have a script do most of the above work for you, then there is a script here to do just that.
Compiling the source
To continue with my example; start RosBE, and from it's command prompt:  (Note: If you did not install RosBE with the desktop shortcut option selected, then open a command prompt window and navigate to D:\ReactOS_Development\RosBE and type RosBE to start it.) and within RosBE,
1. Navigate to D:\ReactOS_Development\Compiled and type D:\ReactOS_Development\Source\reactos\configure ninja
2. Still within D:\ReactOS_Development\Compiled type ninja bootcd
3. Still within D:\ReactOS_Development\Compiled type ninja livecd
4. Still within D:\ReactOS_Development\Compiled type ninja hybridcd
or if want all three ISO images
5. Still within D:\ReactOS_Development\Compiled type ninja bootcd livecd hybridcd
Now you should find the bootcd and/or the livecd and/or hybridcd in D:\ReactOS_Development\Compiled\reactos.
If you have problems compiling after you have updated your local source tree, try typing ninja clean and then start again at step 1 above.
Getting the source with Git
The following window will then open.
 If the URL is correct (https://github.com/reactos/reactos.git) and the Directory (for the source) is correct, then the rest can be left as they are. Click on the OK button to start the download process.
Updating a local source tree with Git
Configuring and installing RosBE
In the screenshot of RosBE, you can see that the working directory as been changed from source to compiled, then configure ninja as been executed and completed. The command line now shows ninja bootcd waiting to be executed.
Getting the source of a single branch
You may decide you want to download the source of one of the branches, so this is how to do it from the command prompt using the directory structure from the previous examples.
In a terminal widow, navigate to D:\ReactOS_Development> and type the following:
git clone --single-branch --branch releases/0.4.13 https://github.com/reactos/reactos.git 0.4.13
Replace releases/0.4.13 with the branch of your choice.
git ........................................................................ Starts git.
clone ................................................................... The command that tells git to clone the Repository.
--single-branch ................................................. This tells git to only clone a single branch.
--branch ............................................................. The switch for a branch.
releases/0.4.13 ................................................. The branch path and name.
https://github.com/reactos/reactos.git ..... The URL of the Reactos git repository.
0.4.13 .................................................................. The folder to clone into.
If you omit to put a folder name after the URL, it will use the default from github, which will be reactos. You could use any name you choose, as in the following example, where mybranch is used; if the folder does not exist, then it will be created.
git clone --single-branch --branch releases/0.4.13 https://github.com/reactos/reactos.git mybranch
Selecting a branch
In your browser, go to https://github.com/reactos/reactos, which will display the page shown in the image above.
To select a branch, click on the down arrow (as shown in the above image), then choose a branch from the drop-down list; you may need to scroll down the list.
How to compile ReactOS - Unix subsection
The ReactOS Build Environment requires the following software to be installed on Unix systems:
There is a script in the unix section of Miscellaneous, which can automate the checking for and installation of the above software.
Setting up a local working environment
You will now need to download the ReactOS Build Environment (RosBE), from https://www.reactos.org/wiki/ReactOS_Build_Environment
Unpack the RosBE installation files to /home/RosBE-Unix-2.1.2 directory.
Create the following folders /home/RosBuild then /home/RosBuild/RosBE (install RosBE in this folder).
Note: The default directory for RosBE, is /usr/local/RosBE, if you prefer, you can use that.
To continue with my example; Open the folder /home/RosBE-Unix-2.1.2 and right click within , for the menu, Window - Terminal Here .
In the terminal window, run the builder script by typing ./RosBE-Builder.sh. If it reports any missing tools , you will need to install them (see list above).
Then run the script as before, and if it reports all tools OK , then you can continue.
To follow my example, type /home/RosBuild/RosBE for the install directory and then follow the instructions from the running script.
If all went well, then it will ask you about creating a shortcut, just follow the instructions.
I created the shortcut in /home then copied it onto the desktop and checked to see if it ran RosBE.
To populate your source folder, you will need to open a terminal window within the empty source folder; right click - Window - Terminal Here, then at the command prompt, type:
git clone https://github.com/reactos/reactos.git.
This will create a folder called reactos and download the main source code.
To get the revision number, right click on the reactos folder and select Window - Terminal Here, then at the command prompt, type: git describe, which will display something like this 0.4.7-dev-532-g3cd76b91b5.
The alternative to the 'Right click-Window-Terminal Here' method, is to type the full address, eg. /home/RosBuild/source.
To update the source code, right click within the reactos folder and select Window - Terminal Here, then at the command prompt type:
git pull https://github.com/reactos/reactos.git
NOTE: You must be actually in the source folder to clone and actually in the reactos folder to update the source or get the revision number.
There is also a script in the Miscellaneous unix section, that can automate the setting up of a working environment.
Compiling the source
Start RosBE and at the terminal command prompt type cd /home/RosBuild/compiled (or the directory that you want ReactOS to be built into).
Then type /home/RosBuild/source/reactos/configure.sh.
When the script finishes, type cd /home/RosBuild/compiled/reactos/
and then ninja livecd or ninja bootcd