File: build

package info (click to toggle)
openrct2 0.4.3%2Bds-1
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm
  • size: 67,880 kB
  • sloc: cpp: 549,527; ansic: 1,322; sh: 441; python: 269; xml: 180; php: 34; makefile: 19
file content (42 lines) | stat: -rwxr-xr-x 1,592 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash

set -e

# Ensure we are in root directory
if [[ $(uname) == "Darwin" ]]; then
    basedir="$(perl -MCwd=abs_path -le 'print abs_path readlink(shift);' `dirname $0`/..)"
else
    basedir="$(readlink -f `dirname $0`/..)"
fi
cd $basedir

if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
    # Patch version.h
    if [[ -n "$OPENRCT2_BUILD" ]]; then
        echo -e "\033[0;36mPatching version.h...\033[0m"
        fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
        productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"
        fileversion=${fileversion//./,}
        # FILEVERSION in the resource file can only take up to 4 digits in the version string, so we remove the surplus of version numbers
        fileversion=$(echo $fileversion | cut -f1-4 -d",")
        echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h"
        echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h"
        cat "resources/version.h"
    fi

    # Build everything
    echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m"
    vstool msbuild openrct2.proj -t:build -p:Breakpad=true

    # Create openrct2.exe and openrct2.com with correct subsystem
    cp bin/openrct2.exe bin/openrct2.com
    vstool editbin //subsystem:console bin/openrct2.com
    vstool editbin //subsystem:windows bin/openrct2.exe
else
    echo -e "\033[0;36mBuilding OpenRCT2...\033[0m"
    mkdir -p bin && cd bin
    export DESTDIR=install
    cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"

    ninja -k0 all install
fi