Update build script

This commit is contained in:
Leroy Hopson 2020-10-13 15:20:40 +07:00 committed by Leroy Hopson
parent 46b2d2c56f
commit fd39635fc5
10 changed files with 70 additions and 43 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
addons/godot_xterm/native/external/*
addons/godot_xterm/native/bin/**/*
addons/godot_xterm/native/.sconsign*.dblite

2
.gitmodules vendored
View file

@ -4,5 +4,3 @@
[submodule "addons/godot_xterm/libtsm"] [submodule "addons/godot_xterm/libtsm"]
path = addons/godot_xterm/native/external/libtsm path = addons/godot_xterm/native/external/libtsm
url = https://github.com/Aetf/libtsm url = https://github.com/Aetf/libtsm
[submodule "godot-cpp/"]
url = https://github.com/godotengine/godot-cpp

View file

@ -5,6 +5,8 @@ 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Changed
- Updated build script (`addons/godot_xterm/native/build.sh`). Git submodules will now be initialized if they haven't already. Moved nix-shell related stuff to a seperate shell.nix file so the same build command can be used on all Linux based OSes.
## [1.0.0] - 2020-10-05 ## [1.0.0] - 2020-10-05
### Added ### Added

View file

@ -17,38 +17,34 @@ Terminal emulator for Godot using GDNative and [libtsm](https://github.com/Aetf/
### All Operating Systems ### All Operating Systems
**Important**: The main dependencies of this project are included as git submodules. You will need at least these dependencies in order to build this plugin:
You can install them in this repo after cloning with: - Git (for git submodules)
```
git submodule update --init --recursive
```
In addition to these, you will need some other dependencies including:
- a C++ compiler (e.g. gcc) - a C++ compiler (e.g. gcc)
- ar (part of GNU Binutils) - ar (part of GNU Binutils)
- CMake - CMake
- Python - Python
- SCons - SCons
### Operating System Specific ### Linux
#### NixOS #### NixOS
On NixOS you can simply run the [build.sh] script in the `addons/godot_xterm/native` directory: You can simply run the [build.sh] script in the `addons/godot_xterm/native` directory:
``` ```
cd addons/godot_xterm/native addons/godot_xterm/native/build.sh
./build.sh
``` ```
All dependencies will be pulled in by nix-shell and the build steps will run. All dependencies will be pulled in by nix-shell and the build steps will run.
#### Arch Linux and Ubuntu #### 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 from the `addons/godot_xterm/native` directory: 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:
``` ```
cd addons/godot_xterm/native addons/godot_xterm/native/build.sh
bash ./build.sh
``` ```
Make sure you use `bash` to run the script as the default interpreter is set to nix-shell.
#### Other #### Other Linux Distributions
Other operating systems 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. 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.
### Other Operating Systems
This plugin is not currently supported for other operating systems (e.g. MacOS, Windows). If you manage to build it on one of these platforms, please submit a PR for this readme.
## Usage ## Usage

View file

@ -1,28 +1,37 @@
#! /usr/bin/env nix-shell #!/bin/sh
#! nix-shell -i bash --pure -p binutils.bintools cmake scons
set -e set -e
# Make sure we are in the addons/godot_xterm directory # Get the absolute path to the directory this script is in.
cd ${BASH_SOURCE%/*} NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Initialize godot-cpp # Run script inside a nix shell if it is available.
if [ ! -d "external/godot-cpp/bin" ] if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
then cd ${NATIVE_DIR}
cd external/godot-cpp nix-shell shell.nix --pure --run "./build.sh"
scons platform=linux generate_bindings=yes -j12 exit
cd ../..
fi fi
# Build libtsm # Build libtsm.
if [ ! -f "external/libtsm/build/src/tsm/libtsm.a" ] LIBTSM_DIR=${NATIVE_DIR}/external/libtsm
then if [ ! -d "$LIBTSM_DIR" ]; then
cd external/libtsm cd ${NATIVE_DIR}
mkdir -p build git submodule update --init --recursive -- $LIBTSM_DIR
cd build
cmake -DBUILD_SHARED_LIBS=n ..
make
cd ../../..
fi fi
cd $LIBTSM_DIR
mkdir -p build
cd build
cmake -DBUILD_SHARED_LIBS=n ..
make
# Build godotxtermnative # Build godot-cpp.
GODOT_CPP_DIR=${NATIVE_DIR}/external/godot-cpp
if [ ! -d "${GODOT_CPP_DIR}" ]; then
cd ${NATIVE_DIR}
git submodule update --init --recursive -- $GODOT_CPP_DIR
fi
cd $GODOT_CPP_DIR
scons platform=linux generate_bindings=yes -j12
# Build godotxtermnative.
cd ${NATIVE_DIR}
scons platform=linux scons platform=linux

View file

@ -0,0 +1,11 @@
with (import <nixpkgs> {});
mkShell {
buildInputs = with pkgs; [
binutils.bintools
cmake
git
libxkbcommon
pkg-config
scons
];
}

View file

@ -4,7 +4,7 @@ services:
build: build:
context: . context: .
dockerfile: ./dockerfiles/archlinux dockerfile: ./dockerfiles/archlinux
command: bash /src/addons/godot_xterm/native/build.sh command: /src/addons/godot_xterm/native/build.sh
build-nixos: build-nixos:
build: build:
context: . context: .
@ -14,4 +14,4 @@ services:
build: build:
context: . context: .
dockerfile: ./dockerfiles/ubuntu dockerfile: ./dockerfiles/ubuntu
command: bash /src/addons/godot_xterm/native/build.sh command: /src/addons/godot_xterm/native/build.sh

View file

@ -1,3 +1,7 @@
FROM archlinux:20200908 FROM archlinux:20200908
RUN pacman -Sy --needed --noconfirm base-devel cmake scons RUN pacman -Sy --needed --noconfirm \
base-devel \
cmake \
git \
scons
COPY . /src COPY . /src

View file

@ -1,4 +1,8 @@
FROM ubuntu:18.04 FROM ubuntu:18.04
RUN apt-get update -y RUN apt-get update && apt-get install -y \
RUN apt-get install -y build-essential cmake python3 scons build-essential \
cmake \
git \
python3 \
scons
COPY . /src COPY . /src