Files @ r24244:556df3f1e087
Branch filter:

Location: cpp/openttd-patchpack/source/os/debian/openttd-wrapper

Patric Stout
Add: introduce CMake for project management

CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.

Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.

This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.

Addtiionally, this heavily improves our detection of libraries, etc.
#!/bin/sh
# This is a wrapper script that checks openttd's exit status and
# displays its stderr output

# Get a file to capture stderr to. Use the deprecated -t option, so this
# works on the old mktemp from the mktemp package (which has been
# replaced by the version from the coreutils package).
TMPFILE=`mktemp -t openttd.errout.XXXXXXXXX`

if [ ! -w "$TMPFILE" ]; then
	xmessage "Could not create temporary file for error messages. Not starting OpenTTD."
	exit 1;
fi

# Capture stderr
openttd "$@" 2> "$TMPFILE"
ERRCODE=$?
if [ "$ERRCODE" -ne 0 ]; then
	CODEMSG="OpenTTD returned with error code $ERRCODE."
	if [ -s "$TMPFILE" ]; then
		MESSAGE="$CODEMSG The following error messages were produced:\n\n"
		printf "$MESSAGE" | cat - "$TMPFILE" | fold -s | xmessage -file -
	else
		xmessage "$CODEMSG No error messages were produced."
	fi
fi

rm -f "$TMPFILE"