1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Adjust MacOS instructions #8600

Tom Lankhorst
2019-01-18 12:03:39 +01:00
parent 97ea6b8369
commit b8985bb17f

@@ -8,41 +8,37 @@ To build natively on macOS, without using Xcode, you will need a set of librarie
## Installing libraries
We'll install the libraries OpenRCT2 depends on through a package manager using the Terminal. We will be using Homebrew in the example below, but the equivalent command for MacPorts and Fink should look pretty similar.
```
$ brew install cmake openssl jansson libpng sdl2 speexdsp libzip pkg-config icu4c
```bash
brew install cmake openssl jansson libpng sdl2 speexdsp libzip pkg-config icu4c
```
## Building OpenRCT2
Navigate to the directory OpenRCT2 is in (`cd`), then make a build directory and invoke `cmake`:
```
$ cd path/to/OpenRCT2
$ mkdir build
$ cd build
$ cmake ..
```bash
cd /path/to/repo/OpenRCT2
mkdir build && cd ./build
cmake .. -DCMAKE_INSTALL_PREFIX=./install
make -j4 install # the install step builds openrct, g2 and downloads OpenRCT2 data
```
If any libraries are missing, you will see an error message. Adjust as needed or check out the `Troubleshooting` section below.
Once all errors have been fixed we can start building:
```
$ make
```bash
make -j4 install
```
If this is your first time building, you'll have to build the `g2.dat` object file, too:
```
$ ln -s ../data
$ make g2
Now, before executing the game, link the just installed openrct2 data folder to the current directory to help `openrct2` find it. Then run the game.
```bash
ln -s ./install/share/openrct2 data
./openrct2
```
> The game will ask for the RCT2 installation path and will build object indices the first time it is started.
This will likely fail the first time, as you will need to set the path to the original game's data files in `~/Library/Application Support/OpenRCT2/config.ini`. This file will be created when running OpenRCT2 for the first time, which `make g2` does. Note that the `~/Library` folder is hidden by default.
Open the config.ini file in your favourite editor and adjust the following line to match:
After the first install, you can build the `openrct2` binaries, no install required:
```bash
make -j4
```
game_path = "/absolute/path/to/RCT2"
```
Don't forget to `make g2` again.
### Troubleshooting
@@ -52,8 +48,8 @@ Try out both solutions in problem 2
#### Problem 2: When running cmake or make, I get some other weird error involving openssl
##### Solution 1
First check if you actually built openssl for both the i386 and x86_64 architectures by running the following command, replacing the openssl version with the version you installed:
```
$ file /usr/local/Cellar/openssl/1.0.2h_1/lib/libcrypto.1.0.0.dyl
```bash
file /usr/local/Cellar/openssl/1.0.2h_1/lib/libcrypto.1.0.0.dyl
```
This should output
```
@@ -66,8 +62,8 @@ If only i386 or x86_64 are listed, then you will need to run `brew reinstall ope
##### Solution 2
If you are sure the library is built for both architectures, it is possible that the build script is using OS X's version of openssl instead of the one installed by brew.
To fix this run:
```
$ brew link --force openssl
```bash
brew link --force openssl
```
Anything that needs to build against openssl will use brew's version now.
@@ -79,10 +75,10 @@ The reason this is happening is because pkg-config (run by cmake) is not finding
To solve this we will create our own gl.pc file and tell pkg-config where to find it.
First create a pkgconfig folder in the directory where you cloned OpenRCT:
```
$ cd ..
$ mkdir pkgconfig
$ cd pkgconfig
```bash
cd ..
mkdir pkgconfig
cd pkgconfig
```
Using your favourite editor, create a file called `gl.pc` with the following content:
@@ -97,9 +93,9 @@ Libs: -Wl,-framework,OpenGL,-framework,AGL
```
Now tell pkg-config where to find this file and go back to the build directory:
```
$ export PKG_CONFIG_PATH=$(pwd):$PKG_CONFIG_PATH
$ cd ../build
```bash
export PKG_CONFIG_PATH=$(pwd):$PKG_CONFIG_PATH
cd ../build
```
You should find that cmake will now find the gl package.
@@ -108,7 +104,7 @@ You should find that cmake will now find the gl package.
It is possible that `brew` was unable to create the relevant symlinks for SDL2 due to permissions problems. To fix this, do the following.
```
```bash
sudo chown root:wheel /usr/local/bin/brew
sudo brew link sdl2
```
@@ -122,9 +118,10 @@ If this doesn't work, chances are `/usr/local/lib` isn't in your `LIBRARY_PATH`.
##### Solution
If your brew-installed ICU package cannot be found by cmake, it probably hasn't been linked to a common location. To work around this, invoke:
```
$ export CMAKE_PREFIX_PATH=/usr/local/opt/icu4c
$ cmake ..
```bash
export CMAKE_PREFIX_PATH=/usr/local/opt/icu4c
cmake ..
```
## Running OpenRCT2