#!/bin/sh

if [ -f CMakeLists.txt ]; then
	mkdir -p build
	cd build
fi

if ! [ -f CMakeCache.txt ]; then
	cmake ..
fi

if ! [ -f Server/Cuberite ]; then
	make -j$(nproc)
fi

if ! [ -d res ]; then
	ln -s ../client-resources/ res
fi

cd Server
LD_PRELOAD=/usr/local/lib/libhydride.so ./Cuberite
#LD_PRELOAD=/usr/local/lib/libhydride.so gdb ./Cuberite
