├── .editorconfig ├── .gitignore ├── LICENSE.md ├── README.md ├── bash_completion.d └── godot ├── godot ├── icon.png └── releases └── .gitkeep /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | end_of_line = lf 3 | insert_final_newline = true 4 | 5 | [*.sh] 6 | indent_style = tab 7 | indent_size = 4 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .godot-engine 3 | godot-engine 4 | godot.desktop 5 | 6 | source 7 | releases/* 8 | !*.gitkeep 9 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Niklas Rosenqvist 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Godot-wrapper 2 | ============= 3 | 4 | **NOTE:** This repository is now archived. However, it probably still works, but I haven't touched the code in many years and there appears to be a much better featured alternative available, called [GodotEnv](https://github.com/chickensoft-games/GodotEnv), which I recommend you to consider instead. 5 | 6 | --- 7 | 8 | A BASH script that downloads and integrates the [Godot engine](http://www.godotengine.org/) for Ubuntu. It also enables version managing and installation of git master. The application icon belongs to the [Godot project](https://github.com/godotengine/godot). 9 | 10 | There's a one-liner copy-and-paste here below to get Godot installed: 11 | 12 | ```Shell 13 | git clone https://github.com/nsrosenqvist/godot-wrapper.git godot && cd godot && ./godot dependencies && ./godot install 14 | ``` 15 | 16 | Now you should be able to launch Godot from the application menu or the terminal. See all the features that the script provides by running `godot help`. 17 | 18 | To get you started I've included some basic examples here below. 19 | 20 | ## HowTo 21 | 22 | To install another release of Godot you can run: 23 | 24 | ```Shell 25 | godot install 1.0-rc2 26 | ``` 27 | 28 | If you want to run the bleeding edge of Godot you can install git master with: 29 | 30 | ```Shell 31 | godot install master 32 | ``` 33 | 34 | The good part is that they can all be installed at the same time! Just run the following to switch back to the stable version: 35 | 36 | ```Shell 37 | godot use 1.0-stable 38 | ``` 39 | 40 | The active version will be the one launched through the application menu as well. So it's really easy to switch environments! 41 | 42 | Run `godot releases` to view all installable versions (based upon the tags on the git repo). 43 | -------------------------------------------------------------------------------- /bash_completion.d/godot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #--------------------------------------------------------------------------# 4 | # A simple script to properly install the Godot game engine on Ubuntu and also 5 | # provide version management. 6 | # Copyright (C) 2015 Niklas Rosenqvist 7 | # 8 | # This library is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU Lesser General Public 10 | # License as published by the Free Software Foundation; either 11 | # version 2.1 of the License, or (at your option) any later version. 12 | # 13 | # This library is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public 19 | # License along with this library; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 21 | # USA 22 | #--------------------------------------------------------------------------# 23 | 24 | _godot() 25 | { 26 | local cur prev opts base 27 | local versions="" 28 | local ver 29 | 30 | COMPREPLY=() 31 | 32 | cur="${COMP_WORDS[COMP_CWORD]}" 33 | prev="${COMP_WORDS[COMP_CWORD-1]}" 34 | old="${COMP_WORDS[COMP_CWORD-2]}" 35 | opts="install uninstall use update download refresh help releases version" 36 | 37 | case "${prev}" in 38 | install) 39 | for ver in $(godot releases available "local"); do 40 | versions+="$ver " 41 | done 42 | 43 | COMPREPLY=( $(compgen -W "${versions}" -- ${cur}) ) 44 | return 0 45 | ;; 46 | uninstall|use) 47 | for ver in $(godot releases installed "local"); do 48 | versions+="$ver " 49 | done 50 | 51 | COMPREPLY=( $(compgen -W "${versions}" -- ${cur}) ) 52 | return 0 53 | ;; 54 | releases) 55 | COMPREPLY=( $(compgen -W "local installed all available" -- ${cur}) ) 56 | return 0 57 | ;; 58 | *) 59 | if [ "$prev" = "godot" ]; then 60 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) 61 | return 0 62 | else 63 | if [ "$old" = "releases" ]; then 64 | COMPREPLY=($(compgen -W "local" -- ${cur})) 65 | return 0 66 | else 67 | return 1 68 | fi 69 | fi 70 | ;; 71 | esac 72 | } 73 | 74 | complete -F _godot godot 75 | -------------------------------------------------------------------------------- /godot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #--------------------------------------------------------------------------# 4 | # A simple script to properly install the Godot game engine on Ubuntu and also 5 | # provide version management. 6 | # Copyright (C) 2015 Niklas Rosenqvist 7 | # 8 | # This library is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU Lesser General Public 10 | # License as published by the Free Software Foundation; either 11 | # version 2.1 of the License, or (at your option) any later version. 12 | # 13 | # This library is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public 19 | # License along with this library; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 21 | # USA 22 | #--------------------------------------------------------------------------# 23 | 24 | if [ -h "$0" ]; then 25 | appdir="$(dirname "$(readlink -f "$0")")" 26 | else 27 | appdir="$(cd "$(dirname "$0")" && pwd)" 28 | fi 29 | 30 | prevpwd="$(pwd)" 31 | cd "$appdir" 32 | 33 | applauncher="$appdir/godot.desktop" 34 | appscript="$appdir/$(basename "$0")" 35 | repo="https://github.com/godotengine/godot.git" 36 | json_releases="" 37 | 38 | if [ "$(uname -m)" = "x86_64" ]; then 39 | arch="x64" 40 | else 41 | arch="x86" 42 | fi 43 | 44 | function write_launcher() { 45 | echo "$1" >> $applauncher 46 | } 47 | 48 | function pad_string() { 49 | printf "%-${2}s" "$1" 50 | } 51 | 52 | function take_if_higher() { 53 | local oldval=$1 54 | local newval=$2 55 | local saveto="$3" 56 | if [ $newval -gt $oldval ]; then 57 | eval "$saveto=$2" 58 | fi 59 | } 60 | 61 | function install_dependencies() { 62 | if [[ ! -z $(which dnf) ]]; then 63 | dnf install -y scons pkgconfig libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel \ 64 | libXi-devel mesa-libGL-devel alsa-lib-devel pulseaudio-libs-devel freetype-devel openssl-devel \ 65 | libudev-devel mesa-libGLU-devel 66 | elif [[ ! -z $(which apt-get) ]]; then 67 | apt-get install -y build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev \ 68 | libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libfreetype6-dev libssl-dev libudev-dev \ 69 | libxi-dev libxrandr-dev 70 | elif [[ ! -z $(which pacman) ]]; then 71 | pacman -S scons libxcursor libxinerama libxi libxrandr mesa glu alsa-lib pulseaudio freetype2 72 | elif [[ ! -z $(which zypper) ]]; then 73 | zypper install scons pkgconfig libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel \ 74 | libXi-devel Mesa-libGL-devel alsa-devel libpulse-devel freetype-devel openssl-devel \ 75 | libudev-devel libGLU1 76 | elif [[ ! -z $(which eopkg) ]]; then 77 | eopkg install -c system.devel scons libxcursor-devel libxinerama-devel libxi-devel \ 78 | libxrandr-devel mesalib-devel libglu alsa-lib pulseaudio freetype2-devel pulseaudio-devel 79 | else 80 | echo "Error! Unsupported package management system. Find how to install the dependencies on your distribution here: https://godot.readthedocs.io/en/latest/development/compiling/compiling_for_x11.html" 81 | exit 1; 82 | fi 83 | 84 | return $? 85 | } 86 | 87 | function create_launcher() { 88 | if [ ! -f "$applauncher" ]; then 89 | touch "$applauncher" 90 | write_launcher "[Desktop Entry]" 91 | write_launcher "Name=Godot Engine" 92 | write_launcher "Comment=Multi-platform 2D and 3D game engine with a feature rich editor" 93 | write_launcher "GenericName=Libre game engine" 94 | write_launcher "Exec=bash \"$appscript\"" 95 | write_launcher "Terminal=false" 96 | write_launcher "X-MultipleArgs=false" 97 | write_launcher "Type=Application" 98 | write_launcher "Icon=$appdir/icon.png" 99 | write_launcher "Categories=Development;IDE;" 100 | write_launcher "StartupNotify=true" 101 | fi 102 | } 103 | 104 | ## Actions 105 | function helptext() { 106 | local padding=32 107 | echo -e "\nGodot - Usage: ${0##*/} [action] [optional arguments]" 108 | echo -e "Running Godot without any of the specified arguments will launch the GUI.\n" 109 | echo "Actions:" 110 | echo -e "\t$(pad_string "" $padding) Install dependencies" 111 | echo -e "\t$(pad_string " [version]" $padding) Install Godot" 112 | echo -e "\t$(pad_string " [version]" $padding) Uninstall Godot" 113 | echo -e "\t$(pad_string " " $padding) Set which version to use" 114 | echo -e "\t$(pad_string "" $padding) Update Godot to latest stable version" 115 | echo -e "\t$(pad_string "" $padding) Download or update Godot repository" 116 | echo -e "\t$(pad_string "" $padding) Bring up the help message" 117 | echo -e "\t$(pad_string " [status] [local]" $padding) Lists all releases in a detailed table. \"local\" skips updating the git repo before showing the list." 118 | echo -e "\t$(pad_string " - all [local]" $padding) Only outputs a list, and not a table." 119 | echo -e "\t$(pad_string " - installed [local]" $padding) Only outputs installed releases." 120 | echo -e "\t$(pad_string " - available [local]" $padding) Only outputs releases that haven't been installed yet." 121 | echo -e "\t$(pad_string "" $padding) Show current active release." 122 | echo -e "\t$(pad_string "[*]" $padding) Launch Godot (unmatched arguments will be passed along to the Godot binary)" 123 | return 0 124 | } 125 | 126 | function releases() { 127 | local norefresh=1 128 | local i 129 | 130 | # Check whether to skip updating the Godot repo 131 | if [ "${1,,}" != "local" ]; then 132 | if [ "${2,,}" != "local" ]; then 133 | download 134 | fi 135 | fi 136 | 137 | case "${1,,}" in 138 | # List all available versions 139 | all) 140 | for i in $(cd "$appdir/source" && git tag); do 141 | echo "$i" 142 | done 143 | echo "master" 144 | return 0 145 | ;; 146 | # List all installed version 147 | installed) 148 | installed 149 | return $? 150 | ;; 151 | # List all not yet installed versions 152 | available) 153 | for i in $(releases "all" "local"); do 154 | is_installed "$i" 155 | if [ $? -ne 0 ]; then 156 | echo "$i" 157 | fi 158 | done 159 | return 0 160 | ;; 161 | # Output a table showing detailed version information 162 | *) 163 | local maxlen=0 164 | local installed="" 165 | local active="" 166 | local versions=($(cd "$appdir/source" && git tag)) 167 | versions+=("master") 168 | 169 | for i in ${versions[@]}; do 170 | take_if_higher $maxlen ${#i} "maxlen" 171 | done 172 | 173 | maxlen=$(($maxlen+4)) 174 | echo -n "$(pad_string "Version:" $maxlen)" 175 | echo -n "$(pad_string "Installed:" 14)" 176 | echo "$(pad_string "Active:" 11)" 177 | 178 | for i in "${versions[@]}"; do 179 | # Version 180 | echo -n "$(pad_string "$i" $maxlen)" 181 | 182 | # Installed 183 | is_installed "$i" 184 | if [ $? -eq 0 ]; then 185 | installed="yes" 186 | else 187 | installed="" 188 | fi 189 | 190 | echo -n "$(pad_string "$installed" 14)" 191 | 192 | # Active 193 | is_active "$i" 194 | if [ $? -eq 0 ]; then 195 | active="yes" 196 | else 197 | active="" 198 | fi 199 | 200 | echo "$(pad_string "$active" 11)" 201 | done 202 | ;; 203 | esac 204 | 205 | return 0 206 | } 207 | 208 | function version() { 209 | if [ -h "godot-engine" ]; then 210 | local filename="$(basename "$(readlink -f "$appdir/godot-engine")")" 211 | echo "${filename#*_}" 212 | fi 213 | } 214 | 215 | function download() { 216 | if [ ! -d "$appdir/source" ]; then 217 | git clone "$repo" "$appdir/source" 218 | chmod -R 755 "$appdir" 219 | else 220 | cd "$appdir/source" && git stash save --quiet && git stash drop &>/dev/null && git pull --quiet && cd "$appdir" 221 | fi 222 | } 223 | 224 | function is_installed() { 225 | local i 226 | 227 | for i in $(installed); do 228 | if [ "$1" = "$i" ]; then 229 | return 0 230 | fi 231 | done 232 | 233 | return 1 234 | } 235 | 236 | function is_active() { 237 | if [ "$(basename "$(readlink -f "$appdir/godot-engine")")" = "godot-engine_${1}" ]; then 238 | return 0 239 | fi 240 | return 1 241 | } 242 | 243 | function installed() { 244 | local file 245 | 246 | for file in $(ls "$appdir/releases"); do 247 | local filename="$(basename "$file")" 248 | 249 | if [[ "$filename" == "godot-engine_"* ]]; then 250 | local version="${filename#*_}" 251 | echo "$version" 252 | fi 253 | done 254 | } 255 | 256 | function is_tag() { 257 | local tag 258 | 259 | if [ "$1" = "master" ] || [ "$1" = "dev" ]; then 260 | return 0 261 | fi 262 | 263 | for tag in $(cd "$appdir/source" && git tag); do 264 | if [ "$tag" = "$1" ]; then 265 | return 0 266 | fi 267 | done 268 | 269 | return 1 270 | } 271 | 272 | function get_latest_stable() { 273 | local tags=($(cd "$appdir/source" && git tag)) 274 | local latest_stable="1.0-stable" 275 | local idx 276 | 277 | for (( idx=${#tags[@]}-1 ; idx>=0 ; idx-- )) ; do 278 | if [[ $string == *"stable"* ]]; then 279 | latest_stable="${tags[idx]}" 280 | break 281 | fi 282 | done 283 | 284 | echo "$latest_stable" 285 | } 286 | 287 | function get_tag() { 288 | if [ "$1" = "dev" ] || [ "$1" = "master" ]; then 289 | echo "master" 290 | else 291 | # Check that it's a tag 292 | is_tag "$1" 293 | 294 | if [ $? -eq 0 ]; then 295 | echo "$1" 296 | fi 297 | 298 | # Return latest stable 299 | echo "$(get_latest_stable)" 300 | fi 301 | } 302 | 303 | function install() { 304 | # Make sure repo is up to date 305 | download 306 | 307 | # Get version to install 308 | local tag="$(get_tag "$1")" 309 | 310 | is_installed "$tag" 311 | if [ $? -eq 0 ]; then 312 | echo "$tag is already installed." 313 | return 1 314 | fi 315 | 316 | # Start installation 317 | echo "Installing Godot $tag..." 318 | 319 | # Build Godot 320 | cd "$appdir/source" && git checkout $1 && scons platform=x11 321 | local result=$? 322 | cd "$appdir" 323 | 324 | if [ $result -ne 0 ]; then 325 | echo "Error while building!" 326 | return 1 327 | fi 328 | 329 | mv "$appdir/source/bin/godot.x11.tools.64" "$appdir/releases/godot-engine_${tag}" 330 | chmod -R 755 "$appdir/releases" 331 | chmod +x "$appdir/releases/"* 332 | 333 | use "$tag" 334 | chmod +x "$appscript" 335 | 336 | # Launcher 337 | if [ ! -f "$applauncher" ]; then 338 | create_launcher 339 | fi 340 | if [ ! -h /usr/share/applications/godot.desktop ]; then 341 | sudo ln -s "$applauncher" /usr/share/applications/godot.desktop 342 | fi 343 | 344 | # Executable 345 | if [ ! -h /usr/local/bin/godot ]; then 346 | sudo ln -s "$appscript" /usr/local/bin/godot 347 | fi 348 | 349 | # Bash completion 350 | if [ ! -h /etc/bash_completion.d/godot ]; then 351 | sudo ln -s "$appdir/bash_completion.d/godot" /etc/bash_completion.d/godot 352 | fi 353 | 354 | chmod -R 755 "$appdir" 355 | return 0 356 | } 357 | 358 | function use() { 359 | if [ -f "$appdir/releases/godot-engine_${1}" ]; then 360 | if [ -h "godot-engine" ]; then 361 | rm godot-engine 362 | fi 363 | 364 | ln -s "$appdir/releases/godot-engine_${1}" "$appdir/godot-engine" 365 | chmod +x "$appdir/godot-engine" 366 | else 367 | echo "Error! Version $1 is not installed. Install it with \"godot install $1\"" 368 | exit 1 369 | fi 370 | 371 | return 0 372 | } 373 | 374 | function update() { 375 | if [ ! -d "$appdir/source" ]; then 376 | echo "Error! You must install Godot first" 377 | exit 1 378 | fi 379 | 380 | download 381 | latest_stable="$(get_latest_stable)" 382 | 383 | if [ ! -f "$appdir/releases/godot-engine_${latest_stable}" ]; then 384 | echo "A new stable version was found: ${latest_stable}" 385 | echo "Installing..." 386 | 387 | install "${latest_stable}" 388 | if [ $? -ne 0 ]; then 389 | return 1 390 | fi 391 | else 392 | echo "No new stable version was found (current: $(version))." 393 | echo "See all available versions by running \"godot version list\"" 394 | fi 395 | 396 | return 0 397 | } 398 | 399 | function uninstall() { 400 | local uninstall=() 401 | local in_use=1 402 | local delete_all=1 403 | local i 404 | 405 | # Select which versions to uninstall 406 | if [ "$1" = "all" ] || [ -z "$1" ]; then 407 | for i in $(installed); do 408 | uninstall+=("$i") 409 | done 410 | else 411 | is_tag "$1" 412 | if [ $? -eq 0 ]; then 413 | uninstall+=("$1") 414 | fi 415 | fi 416 | 417 | if [ -z "$(echo "${uninstall[@]}")" ]; then 418 | echo "Nothing selected to uninstall." 419 | return 0 420 | fi 421 | 422 | # Uninstall every selected version 423 | for i in ${uninstall[@]}; do 424 | if [ "$i" = "$(version)" ]; then 425 | in_use=0 426 | fi 427 | 428 | rm "$appdir/releases/godot-engine_${i}" 429 | 430 | # If it was the last version, remove the system integration 431 | if [ -z "$(installed)" ]; then 432 | rm "$appdir/godot-engine" 433 | sudo rm /usr/local/bin/godot 434 | sudo rm /usr/share/applications/godot.desktop 435 | sudo rm /etc/bash_completion.d/godot 436 | 437 | read -p "Do you want to remove the directory containing the Godot files as well? (y/n) " yn 438 | case $yn in 439 | [Yy]*) delete_all=0;; 440 | esac 441 | fi 442 | done 443 | 444 | # Delete containing dir 445 | if [ $delete_all -eq 0 ]; then 446 | rm -Rf "$appdir" 447 | # Or ... 448 | else 449 | # Set anoother version as the current one if the previous one was in use 450 | if [ -n "$(installed)" ] && [ $in_use -eq 0 ]; then 451 | for i in $(installed); do 452 | echo "Uninstalled current active version, changing to ${i}..." 453 | use "$i" 454 | break 455 | done 456 | fi 457 | fi 458 | 459 | return 0 460 | } 461 | 462 | ## Main 463 | case "${1,,}" in 464 | install) install "$2";; 465 | dependencies) install_dependencies;; 466 | uninstall) uninstall "$2";; 467 | update) update;; 468 | download|refresh) download;; 469 | use) use "$2";; 470 | releases) releases "$2" "$3";; 471 | version) version;; 472 | help) helptext;; 473 | *) $(readlink -f "$appdir/godot-engine") $*;; 474 | esac 475 | 476 | cd "$prevpwd" 477 | exit $? 478 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nsrosenqvist/godot-wrapper/c8f476e8a03bba0c9a4dd96cecd5cb901b6c0cb3/icon.png -------------------------------------------------------------------------------- /releases/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nsrosenqvist/godot-wrapper/c8f476e8a03bba0c9a4dd96cecd5cb901b6c0cb3/releases/.gitkeep --------------------------------------------------------------------------------