diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea8181..3f08049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,19 +4,26 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + ## [Unreleased] + + +## [v1.2.0] - 2020-11-21 ### Added -- Support for Windows 64-bit and compiling on Windows using MSVC. +- Support for macOS 64-bit including Pseudoterminal. +- Partial support for Windows 64-bit and compiling on Windows using MSVC. Pseudoterminal not yet supported. 32-bit builds might be possible but not yet built/tested. ### Changed -- Updated build script. `./build.sh` will create a debug build of the gdnative library for the current platform. `./build.sh release-all` will create release build of the gdnative library for every supported platform. -- Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node. +- Updated build script. On Linux `./build.sh` will create a debug build of the gdnative library for the current platform. - Removed all pre-compiled binaries using BFG [Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/), thus re-writing git history. ### Fixed -- Fixed #12 where incorrect data would sometimes be written to the terminal when passing a string to the Terminal's `write()` method. +- Fixed bug where incorrect data would sometimes be written to the terminal when passing a string to the Terminal's `write()` method. +- Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node. +- Passed correct argv to the execvp call of Pseudoterminal. Previously argv[0] was not set to the program's name which caused the Pseudoterminal node not to work on macOS with the zsh shell. -## [1.0.0] - 2020-10-05 + +## [v1.0.0] - 2020-10-05 ### Added - Changelog. - Asciicast importer plugin. Enables the import of .cast ([asciicast files v2](https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v2.md)) that can be made using the [asciinema](https://asciinema.org/) terminal session recorder. See the [asciicast scene](/examples/asciicast) for example usage. @@ -27,5 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Move input handling to the Terminal node itself, rather than handling it in a seperate Control node. - The Terminal `write()` method now accepts both String and PoolByteArray. -[Unreleased]: https://github.com/lihop/godot-xterm/compare/v1.0.0...HEAD -[1.0.0]: https://github.com/lihop/godot-xterm/releases/tag/v1.0.0 + +[Unreleased]: https://github.com/lihop/godot-xterm/compare/v1.2.0...HEAD +[v1.2.0]: https://github.com/lihop/godot-xterm/compare/v1.0.0...v1.2.0 +[v1.0.0]: https://github.com/lihop/godot-xterm/releases/tag/v1.0.0 diff --git a/README.md b/README.md index c2f5901..f1bf03d 100644 --- a/README.md +++ b/README.md @@ -17,58 +17,96 @@ Terminal emulator for Godot using GDNative and [libtsm](https://github.com/Aetf/ ### Confirmed: - Linux 64-bit (primarily developed/tested on this platform) +- Linux 32-bit +- MacOS 64-bit - Windows 64-bit ### Planned/untested: -- Linux 32-bit - Windows 32-bit -- MacOS 64-bit -## Building +## Setup -**Important**: It is recommended that you build the native binaries before opening this demo project, otherwise the Godot editor will automatically modify the example scenes when it can't find the native libs, such that they won't work when the files _are_ in place. -If you prefer not to build your own binaries from source, there are some pre-compiled release binaries in the [dist] directory. -They can be copied to the correct location by: +To install, copy (or symlink) the `addons/godot_xterm` directory in this repo to the `addons` directory of your Godot project. You will then need to setup the gdnative components, by either downloading the precompiled binaries or building from source. + +**Note**: If you are running the demo project, it is recommended that you build or install the gdnative binaries before opening it, otherwise the Godot editor will disconnect some signals when it fails to find the gdnative nodes meaning that the project won't run correctly when they _are_ installed. If in doubt, use `git status` to see if any of the `.tscn` files have been changed automatically by the editor. + +### Precompiled Binaries + +Precompiled binaries can be downloaded from the GitHub releases page. Download the `bin.zip` file and extract it to the `addons/godot_xterm/native/bin` directory. This will install the gdnative libraries for all supported platforms. +After extracting the zip file, the directory should contain the following: +- `libgodot-xterm.linux.64.so` +- `libgodot-xterm.linux.32.so` +- `libgodot-xterm.osx.64.dylib` +- `libgodot-xterm.windows.64.dll` + +### Building From Source +This plugin follows the standard format of a GDNative plugin as shown in [GDNative C++ Example](https://docs.godotengine.org/en/stable/tutorials/plugins/gdnative/gdnative-cpp-example.html), including the use of the SCons build tool. +Therefore, referring to the following documentation on compiling a GDNative plugin and compiling the Godot engine itself may be useful: +- [GDNative C++ Example: Compiling the plugin](https://docs.godotengine.org/en/stable/tutorials/plugins/gdnative/gdnative-cpp-example.html#compiling-the-plugin). +- [Compiling for X11 (Linux, \*BSD)](https://docs.godotengine.org/en/stable/development/compiling/compiling_for_x11.html) +- [Compiling for macOS](https://docs.godotengine.org/en/stable/development/compiling/compiling_for_osx.html) +- [Compiling for Windows](https://docs.godotengine.org/en/stable/development/compiling/compiling_for_windows.html) + +#### Dependencies +This plugin does not have any special dependencies beyond those used to compile Godot or the GDNative C++ example. If you can compile those then you should be able to compile this plugin. When in doubt, see the documentation above. +The main dependencies are: +- [Git](https://git-scm.com/) (to clone git submodules) +- [SCons](https://scons.org/) (a software construction tool) +- A C/C++ compiler (i.e. [gcc](https://gcc.gnu.org/), [llvm](https://llvm.org/), [MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/)) + +**Note**: If you are cross-compiling, then you will likely need other dependencies than those listed below. + +##### Linux + +| Distribution | Command | +-------------------|--------------------------------------------------| +NixOS | `nix-env -iA nixpkgs.git nixpkgs.scons` | +Arch Linux | `pacman -S --needed git scons base-devel` | +Ubuntu | `sudo apt-get install git scons build-essential` | + +##### MacOS +If [Homebrew](https://brew.sh/) is installed then you should already have llvm and git. In this case you simply need to install scons with: ``` -cd addons/godot_xterm/native -cp -rf dist/* bin/ +brew install scons ``` -### All Operating Systems - -You will need at least these dependencies in order to build this plugin: -- Git (for git submodules) -- a C++ compiler (e.g. gcc) -- ar (part of GNU Binutils) -- CMake -- Python -- SCons - -### Linux - -#### NixOS -You can simply run the [build.sh] script in the `addons/godot_xterm/native` directory: +##### Windows +You will need to have Git and Microsoft Visual Studio installed with C++ tools (compiling using mingw is not yet supported). +If you have the [chocolatey](https://chocolatey.org/) package manager, you can install scons with: ``` -addons/godot_xterm/native/build.sh -``` -All dependencies will be pulled in by nix-shell and the build steps will run. - -#### Arch Linux and Ubuntu -See the [Arch Linux Dockerfile](dockerfiles/archlinux) and [Ubuntu Dockerfile](dockerfiles/ubuntu) for a list of packages that need to be installed. Once installed, run the [build.sh] script in the `addons/godot_xterm/native` directory: -``` -addons/godot_xterm/native/build.sh +choco install python3 && python -m pip install scons ``` -#### Other Linux Distributions -Will probably be similar to the above. When in doubt check the documentation in the submodule repos, the [build.sh] script, and the [SConstruct] file. +#### Steps -### Windows -Compiling on Windows for 64-bit is supported using [Visual Studio Community](https://visualstudio.microsoft.com/vs/community/) version 2019, although other versions might work. See the [Godot documentation](https://docs.godotengine.org/en/stable/development/compiling/compiling_for_windows.html) for more information on setting up the development environment. -See the [github workflow file](.github/workflows/main.yml) for the commands that can be used to build the native libraries. +The [build.sh] script in `addons/godot_xterm/native` is provided for convenience and can be used on Linux to perform the steps below using the default scons options. On NixOS it will use the `shell.nix` file in the same directory to bring in all dependencies to the build environment. -### Other Operating Systems -This plugin is not currently supported for other operating systems (i.e. MacOS). If you manage to build it on a different platform, please submit a PR for this readme. +##### 1. Clone Git Submodules +This step only needs to be performed once and will clone the git repos this plugin depends on to `addons/godot_xterm/native/external`. +``` +# In the top-level directory of this git repo... +git submodule update --init --recursive +``` + +##### 2. Build C++ Bindings +This step only needs to be performed once per platform/target/bits combination your are targeting, and possibly more if you are targeting different versions of Godot. See [GDNative C++ Example: Building the C++ bindings](https://docs.godotengine.org/en/stable/tutorials/plugins/gdnative/gdnative-cpp-example.html#building-the-c-bindings) for more info. +``` +# From the top-level directory of this git repo... +cd addons/godot_xterm/native/external/godot-cpp +scons platform= target= bits= generate_bindings=yes +``` +Where `` is one of `linux`, `osx` or `windows`, `` is one of `release` or `debug` and `` is one of `32` or `64`. +The `generate_bindings=yes` option is essential. + +##### 3. Build GodotXterm +This step needs to be performed every time the code of this plugin in `src/` or `external/libtsm` is modified. +``` +cd ../../ # If following from the directory of the previous step. +# In addons/godot_xterm/native. +scons platform= target= bits= +``` +The same options should be used as in the previous step. If the options are omitted, scons will auto-detect the platform and architecture of the current machine and `target` will default to `debug`. ## Usage @@ -76,7 +114,7 @@ This plugin is not currently supported for other operating systems (i.e. MacOS). The main node provided by this plugin. - ### [Pseudoterminal](addons/godot_xterm/nodes/pseudoterminal/README.md) - A node that can be used to connect the Terminal to a shell. Currently Linux only. + A node that can be used to connect the Terminal to a shell. Currently Linux and MacOS only. An example of how to use this node with a Terminal can be found in the [terminal scene](examples/terminal). diff --git a/addons/godot_xterm/nodes/pseudoterminal/README.md b/addons/godot_xterm/nodes/pseudoterminal/README.md index 83ce85e..08d130f 100644 --- a/addons/godot_xterm/nodes/pseudoterminal/README.md +++ b/addons/godot_xterm/nodes/pseudoterminal/README.md @@ -3,7 +3,7 @@ **Inherits:** [Node] < [Object] -Can be used with the [Terminal] node to get an actual shell. Currently only tested/working on Linux. +Can be used with the [Terminal] node to get an actual shell. Currently only tested/working on Linux and MacOS. ## Methods diff --git a/addons/godot_xterm/plugin.cfg b/addons/godot_xterm/plugin.cfg index c1354c0..32c2fd5 100644 --- a/addons/godot_xterm/plugin.cfg +++ b/addons/godot_xterm/plugin.cfg @@ -3,5 +3,5 @@ name="GodotXterm" description="" author="The GodotXterm authors" -version="1.0.0" +version="1.2.0" script="plugin.gd"