2023-04-25 22:02:02 +02:00
|
|
|
# Compiling on MacOS
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
- [Homebrew](https://brew.sh/)
|
|
|
|
- [Git](https://git-scm.com/downloads)
|
|
|
|
|
|
|
|
Install dependencies with homebrew:
|
|
|
|
|
|
|
|
```
|
2024-02-23 21:31:24 +01:00
|
|
|
brew install cmake freetype gettext gmp hiredis jpeg-turbo jsoncpp leveldb libogg libpng libvorbis luajit zstd gettext
|
2023-04-25 22:02:02 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Download
|
|
|
|
|
|
|
|
Download source (this is the URL to the latest of source repository, which might not work at all times) using Git:
|
|
|
|
|
|
|
|
```bash
|
2024-11-10 19:06:52 +01:00
|
|
|
git clone --depth 1 https://github.com/minetest/minetest.git luanti
|
|
|
|
cd luanti
|
2023-04-25 22:02:02 +02:00
|
|
|
```
|
|
|
|
|
2024-11-10 19:06:52 +01:00
|
|
|
## Building for personal usage
|
|
|
|
|
|
|
|
### Build
|
2023-04-25 22:02:02 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_FIND_FRAMEWORK=LAST \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
|
|
|
|
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE
|
|
|
|
|
|
|
|
make -j$(sysctl -n hw.logicalcpu)
|
|
|
|
make install
|
2023-12-27 11:44:54 +01:00
|
|
|
|
2024-11-10 19:06:52 +01:00
|
|
|
# Apple Silicon (M1/M2) Macs w/ MacOS >= BigSur signature for local run
|
|
|
|
codesign --force --deep -s - --entitlements ../misc/macos/entitlements/debug.entitlements macos/luanti.app
|
2023-04-25 22:02:02 +02:00
|
|
|
```
|
|
|
|
|
2024-11-10 19:06:52 +01:00
|
|
|
If you are using LuaJIT with `MAP_JIT` support use `debug_map_jit.entitlements`.
|
|
|
|
|
|
|
|
### Run
|
2023-04-25 22:02:02 +02:00
|
|
|
|
|
|
|
```
|
2024-11-10 19:06:52 +01:00
|
|
|
open ./build/macos/luanti.app
|
2023-04-25 22:02:02 +02:00
|
|
|
```
|
2024-11-10 19:06:52 +01:00
|
|
|
|
|
|
|
## Building for distribution
|
|
|
|
|
|
|
|
### Generate Xcode project
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_FIND_FRAMEWORK=LAST \
|
|
|
|
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
|
|
|
|
-DFREETYPE_LIBRARY=/path/to/lib/dir/libfreetype.a \
|
|
|
|
-DGETTEXT_INCLUDE_DIR=/path/to/include/dir \
|
|
|
|
-DGETTEXT_LIBRARY=/path/to/lib/dir/libintl.a \
|
|
|
|
-DLUA_LIBRARY=/path/to/lib/dir/libluajit-5.1.a \
|
|
|
|
-DOGG_LIBRARY=/path/to/lib/dir/libogg.a \
|
|
|
|
-DVORBIS_LIBRARY=/path/to/lib/dir/libvorbis.a \
|
|
|
|
-DVORBISFILE_LIBRARY=/path/to/lib/dir/libvorbisfile.a \
|
|
|
|
-DZSTD_LIBRARY=/path/to/lib/dir/libzstd.a \
|
|
|
|
-DGMP_LIBRARY=/path/to/lib/dir/libgmp.a \
|
|
|
|
-DJSON_LIBRARY=/path/to/lib/dir/libjsoncpp.a \
|
|
|
|
-DENABLE_LEVELDB=OFF \
|
|
|
|
-DENABLE_POSTGRESQL=OFF \
|
|
|
|
-DENABLE_REDIS=OFF \
|
|
|
|
-DJPEG_LIBRARY=/path/to/lib/dir/libjpeg.a \
|
|
|
|
-DPNG_LIBRARY=/path/to/lib/dir/libpng.a \
|
|
|
|
-DCMAKE_EXE_LINKER_FLAGS=-lbz2\
|
|
|
|
-GXcode
|
|
|
|
```
|
|
|
|
|
|
|
|
If you are using LuaJIT with `MAP_JIT` support add `-DXCODE_CODE_SIGN_ENTITLEMENTS=../misc/macos/entitlements/release_map_jit.entitlements`.
|
|
|
|
|
|
|
|
*WARNING:* You have to regenerate Xcode project if you switch commit, branch or etc.
|
|
|
|
|
|
|
|
### Build and Run
|
|
|
|
|
|
|
|
* Open generated Xcode project
|
|
|
|
* Select scheme `luanti`
|
|
|
|
* Configure signing Team etc.
|
|
|
|
* Run Build command
|
|
|
|
* Open application from `build/build/Debug/` directory or run it from Xcode
|
|
|
|
|
|
|
|
### Archive and Run
|
|
|
|
|
|
|
|
* Open generated Xcode project
|
|
|
|
* Select scheme `luanti`
|
|
|
|
* Configure signing Team etc.
|
|
|
|
* Run Build command
|
|
|
|
* Open application archive in finder, go into it, copy application and test it.
|
|
|
|
|