diff --git a/Building-OpenRCT2-on-Linux.md b/Building-OpenRCT2-on-Linux.md index 9ff87dc..204eded 100644 --- a/Building-OpenRCT2-on-Linux.md +++ b/Building-OpenRCT2-on-Linux.md @@ -31,7 +31,7 @@ Additionally, you can add support for Discord's Rich Presence API by cloning htt ### APT (Debian, Ubuntu) The exact package names will differ from distribution to distribution, but here's a short list of the common ones: -``` +```bash sudo apt-get install --no-install-recommends -y cmake libsdl2-dev libicu-dev \ gcc pkg-config libspeex-dev libspeexdsp-dev libcurl4-openssl-dev \ libcrypto++-dev libfontconfig1-dev libfreetype6-dev libpng-dev libssl-dev libzip-dev \ @@ -43,13 +43,13 @@ This listing should work on Debian and Ubuntu. ### pacman (Arch) Install dependencies: -``` +```bash sudo pacman -S base-devel sdl2 curl nlohmann-json speexdsp fontconfig libpng openssl libzip icu cmake ninja flac libvorbis zstd ``` ### DNF (Fedora): Run the following for dependencies, then proceed with Linux build instructions. -``` +```bash sudo dnf install gcc gcc-c++ json-devel \ openssl-devel SDL2-devel libicu-devel \ speexdsp-devel libcurl-devel \ @@ -66,7 +66,7 @@ This install requires either plain `x86` system or `amd64` with multilib enabled With regular `x86` system, you just need to configure the sources with cmake (see below) and compile. On `amd64` you first need to enable multilib and then add `abi_x86_32` to at least following libraries: -``` +```bash # cat /etc/portage/package.use/abi_x86_32 ## Please note that this library list may be incomplete due to USE flag differences dev-cpp/nlohmann_json abi_x86_32 @@ -79,8 +79,8 @@ Then you need to `emerge` required libraries and in case portage gives shows som ### openSUSE Install dependencies: -``` -sudo zypper in SDL2-devel fontconfig libzip5 libzip-devel libpng16-devel libicu-devel speexdsp-devel curl libcurl-devel nlohmann_json openssl openssl-devel glibc zlib cmake gcc gcc-c++ fontconfig-devel +```bash +sudo zypper install SDL2-devel fontconfig libzip5 libzip-devel libpng16-devel libicu-devel speexdsp-devel curl libcurl-devel nlohmann_json openssl openssl-devel glibc zlib cmake gcc gcc-c++ fontconfig-devel ``` #### Notes for Leap @@ -88,7 +88,7 @@ Some old Leap versions use an old version of gcc by default, while OpenRCT2 need ### Alpine Linux Install dependencies: -``` +```bash apk add git gcc g++ make cmake libzip-dev curl-dev nlohmann-json sdl2-dev fontconfig-dev fts-dev icu-dev speexdsp-dev ``` (Dependency fts may not be required in the future, see [#5520](https://github.com/OpenRCT2/OpenRCT2/issues/5520)) @@ -96,12 +96,12 @@ apk add git gcc g++ make cmake libzip-dev curl-dev nlohmann-json sdl2-dev fontco ### Solus Install these dependencies then build as normal: -``` +```bash sudo eopkg install sdl2-devel curl-devel libspeex-devel fontconfig-devel libpng-devel openssl-devel libzip-devel libicu-devel mesalib-devel nlohmann-json ``` ## Compiling -``` +```bash mkdir build && cd build cmake .. # Remember to set your build flags, e.g. -DCMAKE_BUILD_TYPE=RelWithDebInfo make @@ -116,7 +116,7 @@ Alternatively you can install the required resources manually so can launch open You need a functional `data` directory next to the current working directory when you start `openrct2`. An easy way to generate such a data directory is by leveraging `make install`. Type the following in the `build` directory: -``` +```bash DESTDIR=. make install ``` Alternatively you can install these assets yourself. The following needs to satisfied: @@ -130,19 +130,19 @@ Alternatively you can install these assets yourself. The following needs to sati Keep in mind you can symlink stuff and that filesystems are case sensitive! Alternatively you can specify the data directory like this: -``` +```bash ./openrct2 --openrct-data-path=../data ``` OR Just symlink the `data` directory in the current `build` directory, which is the easiest approach for development -``` +```bash ln -s ../data data ``` ### Clang Building with clang works the same way as building with GCC, you just need to change the CXX environment variable. Keep in mind, that you need to have an empty build directory as cmake will not switch compilers after it has already generated a Makefile. -``` +```bash mkdir build && cd build export CXX=$(which clang++) # OpenRCT2 is purely a C++ project, there's no need to set CC cmake .. @@ -152,7 +152,7 @@ See the optimization note above. ### Ninja You can switch from Make to Ninja, if you prefer: -``` +```bash mkdir build && cd build cmake .. -G Ninja # Any other arguments you want, for example -DCMAKE_BUILD_TYPE=RelWithDebInfo ninja # No need to specify parallel, it does that automatically @@ -166,7 +166,7 @@ DESTDIR=. ninja install Docker is a nice way of doing things when you have problems installing all the dependencies or just want to test on clean system. Docker containers are ephemeral snapshots of a specified system (described via `Dockerfile`), where you can run your commands. Let's see example from our current `build.sh`: -``` +```bash PARENT=`readlink -f ../` chmod a+rwx `pwd` chmod g+s `pwd` @@ -186,11 +186,11 @@ The `install.sh` script should largely handle that case. Said script should also Keep in mind we have no capacity to test the script thoroughly and while some caution and code review has been applied, it's possible that the script doesn't work properly or even breaks things. We welcome any patch to solve these kinds of problems. Study `CMakeLists.txt` file to see what options are there, but in most basic case you should be fine with just -``` +```makefile export OPENRCT2_CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows ``` `build.sh` is roughly just a fancy wrapper for -``` +```bash cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS .. make ```