diff --git a/Cargo.lock b/Cargo.lock index 2defe508b808a5a10bc3fe9ea3485e64790a6b17..f1c12b16f0848da617deb6663f6acef9d9cc0bcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,7 +20,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (git+https://gitlab.redox-os.org/redox-os/termion)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -435,16 +435,6 @@ dependencies = [ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (git+https://gitlab.redox-os.org/redox-os/syscall.git?branch=relibc)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "textwrap" version = "0.10.0" @@ -589,7 +579,6 @@ source = "git+https://github.com/whitequark/rust-xdg#090afef2509d746e48d6bfa9b2e "checksum syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)" = "3391038ebc3e4ab24eb028cb0ef2f2dc4ba0cbf72ee895ed6a6fad730640b5bc" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum termion 1.5.1 (git+https://gitlab.redox-os.org/redox-os/termion)" = "<none>" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f8bfa9ff0cadcd210129ad9d2c5f145c13e9ced3d3e5d948a6213487d52444" diff --git a/Cargo.toml b/Cargo.toml index 1be1c4e6df4de6261146508203ca2b18abef90dd..2efcc5702d39be4090af4c3ab7838f4279bffa5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,5 +62,6 @@ lto = true panic = "abort" [patch.crates-io] +termion = { git = "https://gitlab.redox-os.org/redox-os/termion" } liner = { git = "https://gitlab.redox-os.org/redox-os/liner" } redox_syscall = { git = "https://gitlab.redox-os.org/redox-os/syscall.git", branch = "relibc" } diff --git a/Makefile b/Makefile index 0171649f38c0c4ab05ef9ae0b0a03f99f3de0215..1f75662b102388221f42b7d6b08d1b3637f57d47 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ prefix ?= usr/local BINARY = $(prefix)/bin/ion RELEASE = debug DEBUG ?= 0 +VENDORED = 0 -ifeq (0, $(DEBUG)) +ifeq (0,$(DEBUG)) ARGS += --release RELEASE = release endif @@ -12,16 +13,15 @@ ifeq (1,$(REDOX)) ARGS += --target x86_64-unknown-redox endif +ifneq ($(wildcard vendor.tar.xz),) + VENDORED = 1 + ARGSV += --frozen +endif + .PHONY: all clean distclean install uninstall -all: .cargo/config - if [ -f vendor.tar.xz ]; \ - then \ - tar pxf vendor.tar.xz; \ - cargo build $(ARGS) --frozen; \ - else \ - cargo build $(ARGS); \ - fi +all: extract .cargo/config + cargo build $(ARGS) $(ARGSV) clean: cargo clean @@ -30,12 +30,11 @@ distclean: rm -rf vendor vendor.tar.xz .cargo tests: - cargo test --manifest-path members/braces/Cargo.toml - cargo test --manifest-path members/builtins/Cargo.toml - cargo test --manifest-path members/lexers/Cargo.toml - cargo test --manifest-path members/ranges/Cargo.toml - cargo test + cargo test $(ARGSV) bash examples/run_examples.sh + for crate in members/*; do \ + cargo test $(ARGSV) --manifest-path $$crate/Cargo.toml; \ + done install: install -Dm0755 target/$(RELEASE)/ion $(DESTDIR)/$(BINARY) @@ -58,14 +57,17 @@ vendor.tar.xz: vendor: .cargo/config vendor.tar.xz +extract: +ifeq (1,$(VENDORED)$(wildcard vendor)) + tar pxf vendor.tar.xz +endif + update-shells: if ! grep ion /etc/shells >/dev/null; then \ echo $(BINARY) >> /etc/shells; \ else \ shell=$(shell grep ion /etc/shells); \ if [ $$shell != $(BINARY) ]; then \ - before=$$(echo $$shell | sed 's/\//\\\//g'); \ - after=$$(echo $(BINARY) | sed 's/\//\\\//g'); \ - sed -i -e "s/$$before/$$after/g" /etc/shells; \ + sed -i -e "s#$$shell#$(BINARY)#g" /etc/shells; \ fi \ fi diff --git a/src/main.rs b/src/main.rs index 43d984b848af8f9b50fbd94de138aff19356fe4e..541e1981f0286bdcf87d7e0a8c80befb30a381a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,12 +5,16 @@ extern crate smallvec; use ion_shell::{flags::NO_EXEC, Binary, JobControl, ShellBuilder, MAN_ION}; use smallvec::SmallVec; use std::{ + alloc::System, env, error::Error, io::{stdin, stdout, BufRead, BufReader, Write}, iter::FromIterator, }; +#[global_allocator] +static A: System = System; + fn main() { let stdin_is_a_tty = sys::isatty(sys::STDIN_FILENO); let mut shell = ShellBuilder::new().install_signal_handler().block_signals(); diff --git a/vendor_config b/vendor_config index a10083bc3d78b6271193d76d0e8260aa1a79741e..d6d2269958863c4a1f12d1df28baaaa710f60ae7 100644 --- a/vendor_config +++ b/vendor_config @@ -24,5 +24,10 @@ git = "https://gitlab.redox-os.org/redox-os/syscall.git" branch = "relibc" replace-with = "vendored-sources" +[source."https://gitlab.redox-os.org/redox-os/termion"] +git = "https://gitlab.redox-os.org/redox-os/termion" +branch = "master" +replace-with = "vendored-sources" + [source.vendored-sources] directory = "vendor"