From 3eecf504cf3bbda3cc17dab11dfb190e0b881ef3 Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Thu, 17 Sep 2020 16:23:01 +0700 Subject: [PATCH] Refactor file structure --- .gitmodules | 8 ++++--- .travis.yml | 6 ++--- README.md | 2 +- addons/godot_xterm/LICENSE | 22 +++++++++++++++++- addons/godot_xterm/godotxtermnative.gdnlib | 16 ------------- .../import_plugins/cast_import_plugin.gd | 16 +++++++++++++ addons/godot_xterm/{ => native}/SConstruct | 6 ++--- .../godot_xterm/{ => native}/bin/.gitignore | 0 addons/godot_xterm/{ => native}/build.sh | 13 ++++++----- .../native/godotxtermnative.gdnlib | 16 +++++++++++++ .../{Dockerfile => native/modules/.gdignore} | 0 .../{ => native/modules}/godot-cpp | 0 .../godot_xterm/{ => native/modules}/libtsm | 0 .../{ => native}/src/libgodotxtermnative.cpp | 0 .../{ => native}/src/pseudoterminal.cpp | 0 .../{ => native}/src/pseudoterminal.h | 0 .../godot_xterm/{ => native}/src/terminal.cpp | 0 .../godot_xterm/{ => native}/src/terminal.h | 0 .../pseudoterminal}/pseudoterminal.gdns | 2 +- .../pseudoterminal}/pseudoterminal_icon.svg | 0 .../pseudoterminal_icon.svg.import | 6 ++--- .../{ => nodes/terminal}/terminal.gdns | 2 +- .../{ => nodes/terminal}/terminal_icon.svg | 0 .../terminal}/terminal_icon.svg.import | 6 ++--- addons/godot_xterm/plugin.gd | 8 +++---- addons/godot_xterm/themes/default.theme | Bin 703 -> 714 bytes .../fonts/cousine}/Cousine-Bold.ttf | Bin .../fonts/cousine}/Cousine-BoldItalic.ttf | Bin .../fonts/cousine}/Cousine-Italic.ttf | Bin .../fonts/cousine}/Cousine-Regular.ttf | Bin .../fonts/cousine}/LICENSE.txt | 0 docker-compose.yml | 6 ++--- examples/terminal/Terminal.tscn | 4 ++-- 33 files changed, 89 insertions(+), 50 deletions(-) mode change 120000 => 100644 addons/godot_xterm/LICENSE delete mode 100644 addons/godot_xterm/godotxtermnative.gdnlib create mode 100644 addons/godot_xterm/import_plugins/cast_import_plugin.gd rename addons/godot_xterm/{ => native}/SConstruct (96%) rename addons/godot_xterm/{ => native}/bin/.gitignore (100%) rename addons/godot_xterm/{ => native}/build.sh (72%) create mode 100644 addons/godot_xterm/native/godotxtermnative.gdnlib rename addons/godot_xterm/{Dockerfile => native/modules/.gdignore} (100%) rename addons/godot_xterm/{ => native/modules}/godot-cpp (100%) rename addons/godot_xterm/{ => native/modules}/libtsm (100%) rename addons/godot_xterm/{ => native}/src/libgodotxtermnative.cpp (100%) rename addons/godot_xterm/{ => native}/src/pseudoterminal.cpp (100%) rename addons/godot_xterm/{ => native}/src/pseudoterminal.h (100%) rename addons/godot_xterm/{ => native}/src/terminal.cpp (100%) rename addons/godot_xterm/{ => native}/src/terminal.h (100%) rename addons/godot_xterm/{ => nodes/pseudoterminal}/pseudoterminal.gdns (59%) rename addons/godot_xterm/{ => nodes/pseudoterminal}/pseudoterminal_icon.svg (100%) rename addons/godot_xterm/{ => nodes/pseudoterminal}/pseudoterminal_icon.svg.import (64%) rename addons/godot_xterm/{ => nodes/terminal}/terminal.gdns (58%) rename addons/godot_xterm/{ => nodes/terminal}/terminal_icon.svg (100%) rename addons/godot_xterm/{ => nodes/terminal}/terminal_icon.svg.import (66%) rename addons/godot_xterm/{fonts => themes/fonts/cousine}/Cousine-Bold.ttf (100%) rename addons/godot_xterm/{fonts => themes/fonts/cousine}/Cousine-BoldItalic.ttf (100%) rename addons/godot_xterm/{fonts => themes/fonts/cousine}/Cousine-Italic.ttf (100%) rename addons/godot_xterm/{fonts => themes/fonts/cousine}/Cousine-Regular.ttf (100%) rename addons/godot_xterm/{fonts => themes/fonts/cousine}/LICENSE.txt (100%) diff --git a/.gitmodules b/.gitmodules index 87938ad..dce4514 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,8 @@ [submodule "addons/godot_xterm/godot-cpp"] - path = addons/godot_xterm/godot-cpp - url = https://github.com/lihop/godot-cpp + path = addons/godot_xterm/native/modules/godot-cpp + url = https://github.com/godotengine/godot-cpp [submodule "addons/godot_xterm/libtsm"] - path = addons/godot_xterm/libtsm + path = addons/godot_xterm/native/modules/libtsm url = https://github.com/Aetf/libtsm +[submodule "godot-cpp/"] + url = https://github.com/godotengine/godot-cpp diff --git a/.travis.yml b/.travis.yml index 722f934..6062dd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ services: jobs: include: - - name: "Build on Arch Linux" + - name: "Build native libs on Arch Linux" env: SERVICE=build-archlinux - - name: "Build on NixOS" + - name: "Build native libs on NixOS" env: SERVICE=build-nixos - - name: "Build on Ubuntu" + - name: "Build native libs on Ubuntu" env: SERVICE=build-ubuntu script: docker-compose run $SERVICE diff --git a/README.md b/README.md index 77fd191..3b73c53 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,4 @@ You are also implicitly verifying that all code is your original work, or unorig Copyright (c) 2020 Leroy Hopson (MIT License) The fonts used in this project are published under a seperate license. -See: [addons/godot_xterm/fonts/LICENSE.txt](addons/godot_xterm/fonts/LICENSE.txt). +See the various license files in the [subdirectories](addons/godot_xterm/themes/fonts/) for each font. diff --git a/addons/godot_xterm/LICENSE b/addons/godot_xterm/LICENSE deleted file mode 120000 index 7a694c9..0000000 --- a/addons/godot_xterm/LICENSE +++ /dev/null @@ -1 +0,0 @@ -LICENSE \ No newline at end of file diff --git a/addons/godot_xterm/LICENSE b/addons/godot_xterm/LICENSE new file mode 100644 index 0000000..7d0079b --- /dev/null +++ b/addons/godot_xterm/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 The GodotXterm authors (https://github.com/lihop/godot-xterm/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/addons/godot_xterm/godotxtermnative.gdnlib b/addons/godot_xterm/godotxtermnative.gdnlib deleted file mode 100644 index 2b32ce5..0000000 --- a/addons/godot_xterm/godotxtermnative.gdnlib +++ /dev/null @@ -1,16 +0,0 @@ -[general] - -singleton=false -load_once=true -symbol_prefix="godot_" -reloadable=true - -[entry] - -X11.64="res://addons/godot_xterm/bin/x11/libgodotxtermnative.so" -Server.64="res://addons/godot_xterm/bin/x11/libgodotxtermnative.so" - -[dependencies] - -X11.64=[ ] -Server.64=[ ] diff --git a/addons/godot_xterm/import_plugins/cast_import_plugin.gd b/addons/godot_xterm/import_plugins/cast_import_plugin.gd new file mode 100644 index 0000000..1eccaec --- /dev/null +++ b/addons/godot_xterm/import_plugins/cast_import_plugin.gd @@ -0,0 +1,16 @@ +extends Node + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/addons/godot_xterm/SConstruct b/addons/godot_xterm/native/SConstruct similarity index 96% rename from addons/godot_xterm/SConstruct rename to addons/godot_xterm/native/SConstruct index f25e2da..49e8462 100644 --- a/addons/godot_xterm/SConstruct +++ b/addons/godot_xterm/native/SConstruct @@ -18,10 +18,10 @@ opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bi opts.Add(PathVariable('target_name', 'The library name.', 'libgodotxtermnative', PathVariable.PathAccept)) # Local dependency paths, adapt them to your setup -godot_headers_path = "godot-cpp/godot_headers/" -cpp_bindings_path = "godot-cpp/" +godot_headers_path = "modules/godot-cpp/godot_headers/" +cpp_bindings_path = "modules/godot-cpp/" cpp_library = "libgodot-cpp" -libtsm_path = "libtsm/" +libtsm_path = "modules/libtsm/" # only support 64 at this time.. bits = 64 diff --git a/addons/godot_xterm/bin/.gitignore b/addons/godot_xterm/native/bin/.gitignore similarity index 100% rename from addons/godot_xterm/bin/.gitignore rename to addons/godot_xterm/native/bin/.gitignore diff --git a/addons/godot_xterm/build.sh b/addons/godot_xterm/native/build.sh similarity index 72% rename from addons/godot_xterm/build.sh rename to addons/godot_xterm/native/build.sh index d51ba09..2a63e96 100755 --- a/addons/godot_xterm/build.sh +++ b/addons/godot_xterm/native/build.sh @@ -1,26 +1,27 @@ #! /usr/bin/env nix-shell #! nix-shell -i bash --pure -p binutils.bintools cmake scons +set -e # Make sure we are in the addons/godot_xterm directory cd ${BASH_SOURCE%/*} # Initialize godot-cpp -if [ ! -d "godot-cpp/bin" ] +if [ ! -d "modules/godot-cpp/bin" ] then - cd godot-cpp + cd modules/godot-cpp scons platform=linux generate_bindings=yes -j12 - cd .. + cd ../.. fi # Build libtsm -if [ ! -f "libtsm/build/src/tsm/libtsm.a" ] +if [ ! -f "modules/libtsm/build/src/tsm/libtsm.a" ] then - cd libtsm + cd modules/libtsm mkdir -p build cd build cmake -DBUILD_SHARED_LIBS=n .. make - cd ../.. + cd ../../.. fi # Build godotxtermnative diff --git a/addons/godot_xterm/native/godotxtermnative.gdnlib b/addons/godot_xterm/native/godotxtermnative.gdnlib new file mode 100644 index 0000000..73b7bd4 --- /dev/null +++ b/addons/godot_xterm/native/godotxtermnative.gdnlib @@ -0,0 +1,16 @@ +[general] + +singleton=false +load_once=true +symbol_prefix="godot_" +reloadable=true + +[entry] + +X11.64="res://addons/godot_xterm/native/bin/x11/libgodotxtermnative.so" +Server.64="res://addons/godot_xterm/native/bin/x11/libgodotxtermnative.so" + +[dependencies] + +X11.64=[ ] +Server.64=[ ] diff --git a/addons/godot_xterm/Dockerfile b/addons/godot_xterm/native/modules/.gdignore similarity index 100% rename from addons/godot_xterm/Dockerfile rename to addons/godot_xterm/native/modules/.gdignore diff --git a/addons/godot_xterm/godot-cpp b/addons/godot_xterm/native/modules/godot-cpp similarity index 100% rename from addons/godot_xterm/godot-cpp rename to addons/godot_xterm/native/modules/godot-cpp diff --git a/addons/godot_xterm/libtsm b/addons/godot_xterm/native/modules/libtsm similarity index 100% rename from addons/godot_xterm/libtsm rename to addons/godot_xterm/native/modules/libtsm diff --git a/addons/godot_xterm/src/libgodotxtermnative.cpp b/addons/godot_xterm/native/src/libgodotxtermnative.cpp similarity index 100% rename from addons/godot_xterm/src/libgodotxtermnative.cpp rename to addons/godot_xterm/native/src/libgodotxtermnative.cpp diff --git a/addons/godot_xterm/src/pseudoterminal.cpp b/addons/godot_xterm/native/src/pseudoterminal.cpp similarity index 100% rename from addons/godot_xterm/src/pseudoterminal.cpp rename to addons/godot_xterm/native/src/pseudoterminal.cpp diff --git a/addons/godot_xterm/src/pseudoterminal.h b/addons/godot_xterm/native/src/pseudoterminal.h similarity index 100% rename from addons/godot_xterm/src/pseudoterminal.h rename to addons/godot_xterm/native/src/pseudoterminal.h diff --git a/addons/godot_xterm/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp similarity index 100% rename from addons/godot_xterm/src/terminal.cpp rename to addons/godot_xterm/native/src/terminal.cpp diff --git a/addons/godot_xterm/src/terminal.h b/addons/godot_xterm/native/src/terminal.h similarity index 100% rename from addons/godot_xterm/src/terminal.h rename to addons/godot_xterm/native/src/terminal.h diff --git a/addons/godot_xterm/pseudoterminal.gdns b/addons/godot_xterm/nodes/pseudoterminal/pseudoterminal.gdns similarity index 59% rename from addons/godot_xterm/pseudoterminal.gdns rename to addons/godot_xterm/nodes/pseudoterminal/pseudoterminal.gdns index 19c7ba2..a56d402 100644 --- a/addons/godot_xterm/pseudoterminal.gdns +++ b/addons/godot_xterm/nodes/pseudoterminal/pseudoterminal.gdns @@ -1,6 +1,6 @@ [gd_resource type="NativeScript" load_steps=2 format=2] -[ext_resource path="res://addons/godot_xterm/godotxtermnative.gdnlib" type="GDNativeLibrary" id=1] +[ext_resource path="res://addons/godot_xterm/native/godotxtermnative.gdnlib" type="GDNativeLibrary" id=1] [resource] resource_name = "Terminal" diff --git a/addons/godot_xterm/pseudoterminal_icon.svg b/addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg similarity index 100% rename from addons/godot_xterm/pseudoterminal_icon.svg rename to addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg diff --git a/addons/godot_xterm/pseudoterminal_icon.svg.import b/addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg.import similarity index 64% rename from addons/godot_xterm/pseudoterminal_icon.svg.import rename to addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg.import index d351d90..7634b78 100644 --- a/addons/godot_xterm/pseudoterminal_icon.svg.import +++ b/addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/pseudoterminal_icon.svg-50ba2514dae785a6b48b0da604cf3a09.stex" +path="res://.import/pseudoterminal_icon.svg-0b26aed87c28626d61aa92bd9e34d5a9.stex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/godot_xterm/pseudoterminal_icon.svg" -dest_files=[ "res://.import/pseudoterminal_icon.svg-50ba2514dae785a6b48b0da604cf3a09.stex" ] +source_file="res://addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg" +dest_files=[ "res://.import/pseudoterminal_icon.svg-0b26aed87c28626d61aa92bd9e34d5a9.stex" ] [params] diff --git a/addons/godot_xterm/terminal.gdns b/addons/godot_xterm/nodes/terminal/terminal.gdns similarity index 58% rename from addons/godot_xterm/terminal.gdns rename to addons/godot_xterm/nodes/terminal/terminal.gdns index 334e2d6..9bc5488 100644 --- a/addons/godot_xterm/terminal.gdns +++ b/addons/godot_xterm/nodes/terminal/terminal.gdns @@ -1,6 +1,6 @@ [gd_resource type="NativeScript" load_steps=2 format=2] -[ext_resource path="res://addons/godot_xterm/godotxtermnative.gdnlib" type="GDNativeLibrary" id=1] +[ext_resource path="res://addons/godot_xterm/native/godotxtermnative.gdnlib" type="GDNativeLibrary" id=1] [resource] resource_name = "Terminal" diff --git a/addons/godot_xterm/terminal_icon.svg b/addons/godot_xterm/nodes/terminal/terminal_icon.svg similarity index 100% rename from addons/godot_xterm/terminal_icon.svg rename to addons/godot_xterm/nodes/terminal/terminal_icon.svg diff --git a/addons/godot_xterm/terminal_icon.svg.import b/addons/godot_xterm/nodes/terminal/terminal_icon.svg.import similarity index 66% rename from addons/godot_xterm/terminal_icon.svg.import rename to addons/godot_xterm/nodes/terminal/terminal_icon.svg.import index d8ea732..0e96ff9 100644 --- a/addons/godot_xterm/terminal_icon.svg.import +++ b/addons/godot_xterm/nodes/terminal/terminal_icon.svg.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/terminal_icon.svg-33ee6ad8b86db2f37e5d8d61a6b1b8db.stex" +path="res://.import/terminal_icon.svg-a0706fd47bb880823b1242c224120d4f.stex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/godot_xterm/terminal_icon.svg" -dest_files=[ "res://.import/terminal_icon.svg-33ee6ad8b86db2f37e5d8d61a6b1b8db.stex" ] +source_file="res://addons/godot_xterm/nodes/terminal/terminal_icon.svg" +dest_files=[ "res://.import/terminal_icon.svg-a0706fd47bb880823b1242c224120d4f.stex" ] [params] diff --git a/addons/godot_xterm/plugin.gd b/addons/godot_xterm/plugin.gd index 48f5e24..57a118b 100644 --- a/addons/godot_xterm/plugin.gd +++ b/addons/godot_xterm/plugin.gd @@ -3,12 +3,12 @@ extends EditorPlugin func _enter_tree(): - var terminal_script = preload("res://addons/godot_xterm/terminal.gdns") - var terminal_icon = preload("res://addons/godot_xterm/terminal_icon.svg") + var terminal_script = preload("res://addons/godot_xterm/nodes/terminal/terminal.gdns") + var terminal_icon = preload("res://addons/godot_xterm/nodes/terminal/terminal_icon.svg") add_custom_type("Terminal", "Control", terminal_script, terminal_icon) - var pseudoterminal_script = preload("res://addons/godot_xterm/pseudoterminal.gdns") - var pseudoterminal_icon = preload("res://addons/godot_xterm/pseudoterminal_icon.svg") + var pseudoterminal_script = preload("res://addons/godot_xterm/nodes/pseudoterminal/pseudoterminal.gdns") + var pseudoterminal_icon = preload("res://addons/godot_xterm/nodes/pseudoterminal/pseudoterminal_icon.svg") add_custom_type("Pseudoterminal", "Node", pseudoterminal_script, pseudoterminal_icon) diff --git a/addons/godot_xterm/themes/default.theme b/addons/godot_xterm/themes/default.theme index 6f200eaae70e7dafc74bb8115eb709baa1c8efe6..14178daed9e80f4a0134a93cba73876d173be1ad 100644 GIT binary patch literal 714 zcmV;*0yX_oQ$s@n000005C8yr2mk=G0ssIgwJ-f(dIv=n09G4ZJTQ$z06*{#4D%2C z1OLFkZW!qG{S?xtza`24{U`oOBw?jnZB|1X3n7MOH75v}(HWBnx4bb7&2B+R4?+M( z08Riu#^pAA6M;{VR-jk4o!0-!B|~-=ZR3M&@&5wf4{!bt@U1jjeB-*=xEoZ*u&t98 z&z1i-{y+Fu>lyi9G4UV3ACFqHSqpxg!pfy+v7|muHEc4d@l|p!Zw)P-R%+0bPQX9d z$0-SfI%%uaI`Z^?z?X8V9+&ZoyO~7eAnr!R=M*%X$`0)V6q}JHNf`r)I2}2}y-H&V z=l{ijic5tSwH=FlP#XhAf~;YaV)^#-aHvo`FofG7!KLkJ$E8$*N5=)z9_nR?yHaE& zhm@=o!F;50I0Bo_hR%Nq2Mri3z$oyDuITEBu1j=rL={4aK(Jw{M3+VeMs!^u4qQan zZ(u^=m-r;~OlIU1K0cvhatR|IfiVz`g$q-62EvAIeA8k#n^kf<)S4v@fRm`PxhWcw zfPerJ0H6W^qvAFaK+`x3GsYpK6i^0&3Luz(h$VI#BabgU;&Cyy3{>$w_JEvc&gS>;TiO9j6A(gqAa0Ql46}Dd*tM;K(r9g2NX-u$ literal 703 zcmV;w0zmyzQ$s@n000005C8x^2mk=50ssIgwJ-f(J_qd-07e^JJwS^?06Z{H5xs^M z*#q;y1IVVad_RNq>F-GLfB(r(;*wiq2*J&SXLmXC2TUN@mX>+Zw)V{cIwcR4!}bg z$SDehN@?rVIx_V?z_)U#AGdLfyBUS!A?{Yi=QK2%%1+rok*7%+BMIqrWE1x+jiS!~ zjQ(P!|X$26EjHW-;qY!uH$x1d6 ztvu0yq;@(U100V9&wq*q3KAfYMw$a4A0E;u(;-Rl@WBA)V&RZR|AvP25r+a9(5 z5%GyX;ujIVVY4?Dm_G>d5fB&Ya0iT$jEF#>x;G6rzIidnlG`b*dE$!AfRU(i!9g`7 z0|W#h0RXT9fg-AH5+KtsPD9EefkHrm1QkFq0Z2d^F$yDzuQ4Mxb=DcE#CM_x-wWJ4 z`~F(^!4r5P!gJss1fF=4;0gi!OKDg66467&F7uK0ae(C6gVFVoKju4Ouittx(^XY%@YxB$Hnz zB8v&(qCmB7%zJI*fTpKyb1~pYR|OeFm_XRYH@t2YH#QQSRuUBJ_27@6