]> Untitled Git - godot.git/blob - script.sh
4ccff458ac78cb5ecca27d91ea5b8358816d4cf6
[godot.git] / script.sh
1 #!/bin/bash
2
3 # gets a Godot release, fetches export templates, 
4 # and builds a project with its native export options
5
6 PWD=`pwd`
7 DIR_DOWNLOAD=$PWD/download
8 DIR_TEMPLATES=$DIR_DOWNLOAD/templates
9 DIR_DEBUG=$PWD/debug
10 DIR_RELEASE=$PWD/release
11 DIR_PROJECT=$PWD/project
12
13 GODOT_VERSION=4.4-stable
14 GODOT_ZIP=Godot_v${GODOT_VERSION}_linux.x86_64.zip
15 GODOT_EXE=Godot_v${GODOT_VERSION}_linux.x86_64
16 GODOT_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_ZIP
17
18 GODOT_EXPORT_TEMPLATES=Godot_v${GODOT_VERSION}_export_templates.tpz
19 GODOT_TEMPLATE_URI=https://github.com/godotengine/godot/releases/download/$GODOT_VERSION/$GODOT_EXPORT_TEMPLATES
20
21 GODOT=$DIR_DOWNLOAD/$GODOT_EXE
22
23 # get Godot
24 [[ -d $DIR_DOWNLOAD ]] || mkpath -p $DIR_DOWNLOAD 
25 [[ -f $DIR_DOWNLOAD/$GODOT_ZIP ]] || wget -P $DIR_DOWNLOAD $GODOT_URI
26 [[ -f $DIR_DOWNLOAD/$GODOT_EXE ]] || unzip $DIR_DOWNLOAD/$GODOT_ZIP -d $DIR_DOWNLOAD
27
28 echo Godot version - $($GODOT --headless --version)
29
30 # get export templates
31 [[ -f $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES ]] || wget -P $DIR_DOWNLOAD $GODOT_TEMPLATE_URI
32 [[ -d $DIR_TEMPLATES ]] || unzip -d $DIR_DOWNLOAD $DIR_DOWNLOAD/$GODOT_EXPORT_TEMPLATES
33
34 GODOT_TEMPLATE_VERSION=$(cat $DIR_TEMPLATES/version.txt)
35 LOCAL_TEMPLATES=$HOME/.local/share/godot/export_templates/$GODOT_TEMPLATE_VERSION
36 if [[ ! -d $LOCAL_TEMPLATES ]]
37 then
38     mkdir -p $LOCAL_TEMPLATES
39     cp $DIR_TEMPLATES/* $LOCAL_TEMPLATES
40     # TODO: leaves extra stuff
41 fi
42
43 echo Godot export template version - $GODOT_TEMPLATE_VERSION
44 echo Local templates - $LOCAL_TEMPLATES
45
46 # execute project build
47 PLATFORM=macOS
48 [[ -d $DIR_RELEASE/$PLATFORM ]] || mkdir -p $DIR_RELEASE/$PLATFORM
49 [[ -d $DIR_DEBUG/$PLATFORM ]] || mkdir -p $DIR_DEBUG/$PLATFORM
50
51 echo Starting project build
52 $GODOT --headless --export-debug --path $DIR_PROJECT $PLATFORM $DIR_DEBUG/$PLATFORM/wolf-seeking-sheep.dmg