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"]
path = addons/godot_xterm/native/external/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).
## [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
### Added

View file

@ -17,38 +17,34 @@ Terminal emulator for Godot using GDNative and [libtsm](https://github.com/Aetf/
### All Operating Systems
**Important**: The main dependencies of this project are included as git submodules.
You can install them in this repo after cloning with:
```
git submodule update --init --recursive
```
In addition to these, you will need some other dependencies including:
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
### Operating System Specific
### Linux
#### 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
./build.sh
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 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
bash ./build.sh
addons/godot_xterm/native/build.sh
```
Make sure you use `bash` to run the script as the default interpreter is set to nix-shell.
#### Other
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.
#### 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.
### 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

View file

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

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:
context: .
dockerfile: ./dockerfiles/archlinux
command: bash /src/addons/godot_xterm/native/build.sh
command: /src/addons/godot_xterm/native/build.sh
build-nixos:
build:
context: .
@ -14,4 +14,4 @@ services:
build:
context: .
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
RUN pacman -Sy --needed --noconfirm base-devel cmake scons
RUN pacman -Sy --needed --noconfirm \
base-devel \
cmake \
git \
scons
COPY . /src

View file

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