aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-04-13 15:06:33 -0500
committerJesse Luehrs <doy@tozt.net>2013-04-13 15:06:33 -0500
commit97c2f6b5560f4d8ca91ab72f9e0032b02a948081 (patch)
treecdcd8edfafa0f0ed7c675543b8e216ba4fd73131
parent7628b3c1c0dbf5143547183fd0f00cbf32dfdeb6 (diff)
downloadrust-term-97c2f6b5560f4d8ca91ab72f9e0032b02a948081.tar.gz
rust-term-97c2f6b5560f4d8ca91ab72f9e0032b02a948081.zip
split out the terminfo stuff to a pluggable backend
-rw-r--r--Makefile13
-rw-r--r--README3
-rw-r--r--src/info/builtin.rs0
-rw-r--r--src/info/curses.rs (renamed from src/info.rs)0
-rw-r--r--src/term.rs10
5 files changed, 22 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index bf455f4..3d68652 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,14 @@
RUSTC = rustc
MAIN_SOURCE = src/term.rs
-OTHER_SOURCES = src/hexes.rs src/ios.rs src/info.rs src/util.rs src/trie.rs
+OTHER_SOURCES = src/hexes.rs src/ios.rs src/util.rs src/trie.rs
+ifdef CURSES
+OTHER_SOURCES += src/info/curses.rs
+CFG = --cfg curses
+else
+OTHER_SOURCES += src/info/builtin.rs
+CFG =
+endif
TESTS = bin/termios bin/termios2 bin/termios3 bin/rl bin/password bin/attrs bin/tput
all: build tests
@@ -9,7 +16,7 @@ all: build tests
build: tmp/built
check: build
- $(RUSTC) -L tmp --test $(MAIN_SOURCE) -o TEST
+ $(RUSTC) $(CFG) -L tmp --test $(MAIN_SOURCE) -o TEST
./TEST
@rm -f TEST
@@ -21,7 +28,7 @@ bin/%: test/%.rs tmp/built
tmp/built: $(MAIN_SOURCE) $(OTHER_SOURCES) tmp/libtermios_wrapper.a tmp/libio_helper.a
@mkdir -p lib
- $(RUSTC) --out-dir lib -L tmp $(MAIN_SOURCE) && touch tmp/built
+ $(RUSTC) $(CFG) --out-dir lib -L tmp $(MAIN_SOURCE) && touch tmp/built
clibs: tmp/libtermios_wrapper.a tmp/libio_helper.a
diff --git a/README b/README
index 98f5a82..aff70d5 100644
--- a/README
+++ b/README
@@ -1,3 +1,6 @@
This library implements low-level bindings for terminfo and termios, and also
provides a more convenient interface (called 'hexes') on top of that. See
http://doy.github.com/rust-term/ for documentation.
+
+If you want to link against the curses terminfo library (instead of the more
+limited built-in one), you should set "CURSES=1" in the make invocation.
diff --git a/src/info/builtin.rs b/src/info/builtin.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/info/builtin.rs
diff --git a/src/info.rs b/src/info/curses.rs
index 72c0f51..72c0f51 100644
--- a/src/info.rs
+++ b/src/info/curses.rs
diff --git a/src/term.rs b/src/term.rs
index 0daa5ca..3ae11e0 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -6,7 +6,15 @@
#[crate_type = "lib"];
pub mod hexes;
-pub mod info;
pub mod ios;
+
+#[cfg(curses)]
+#[path = "info/curses.rs"]
+pub mod info;
+
+#[cfg(not(curses))]
+#[path = "info/builtin.rs"]
+pub mod info;
+
mod trie;
mod util;