Browse Source

Add target norl to drop libreadline

master
Arun Prakash Jana 6 years ago
parent
commit
a8388ab60b
No known key found for this signature in database GPG Key ID: A75979F35C080412
3 changed files with 18 additions and 4 deletions
  1. +7
    -3
      Makefile
  2. +1
    -1
      README.md
  3. +10
    -0
      src/nnn.c

+ 7
- 3
Makefile View File

@@ -22,7 +22,7 @@ CFLAGS += -Wall -Wextra -Wno-unused-parameter
CFLAGS += $(CFLAGS_OPTIMIZATION) CFLAGS += $(CFLAGS_OPTIMIZATION)
CFLAGS += $(CFLAGS_CURSES) CFLAGS += $(CFLAGS_CURSES)


LDLIBS += -lreadline $(LDLIBS_CURSES)
LDLIBS += $(LDLIBS_CURSES)


DISTFILES = src nnn.1 Makefile README.md LICENSE DISTFILES = src nnn.1 Makefile README.md LICENSE
SRC = src/nnn.c SRC = src/nnn.c
@@ -33,10 +33,14 @@ all: $(BIN)
$(SRC): src/nnn.h $(SRC): src/nnn.h


$(BIN): $(SRC) $(BIN): $(SRC)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) -lreadline


debug: $(SRC) debug: $(SRC)
$(CC) -DDBGMODE -g $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
$(CC) -DDBGMODE -g $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS) -lreadline

norl: $(SRC)
$(CC) -DNORL $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(BIN) $^ $(LDLIBS)
$(STRIP) $(BIN)


install: all install: all
$(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin


+ 1
- 1
README.md View File

@@ -135,7 +135,7 @@ Intrigued? Find out [HOW](https://github.com/jarun/nnn/wiki/performance-factors)


#### Library dependencies #### Library dependencies


`nnn` needs a curses library with wide character support (like ncursesw), libreadline and standard libc.
`nnn` needs a curses library with wide character support (like ncursesw), libreadline and standard libc. It's possible to drop libreadline using the Makefile target `norl`.


#### Utility dependencies #### Utility dependencies




+ 10
- 0
src/nnn.c View File

@@ -79,8 +79,10 @@
#include <locale.h> #include <locale.h>
#include <pwd.h> #include <pwd.h>
#include <stdio.h> #include <stdio.h>
#ifndef NORL
#include <readline/history.h> #include <readline/history.h>
#include <readline/readline.h> #include <readline/readline.h>
#endif
#include <regex.h> #include <regex.h>
#include <signal.h> #include <signal.h>
#include <stdarg.h> #include <stdarg.h>
@@ -3879,11 +3881,14 @@ nochange:
} }
break; break;
default: /* SEL_RUNCMD */ default: /* SEL_RUNCMD */
#ifndef NORL
if (cfg.picker) { if (cfg.picker) {
/* readline prompt breaks the interface, use stock */ /* readline prompt breaks the interface, use stock */
#endif
tmp = xreadline(NULL, "> "); tmp = xreadline(NULL, "> ");
if (tmp[0]) if (tmp[0])
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT); spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
#ifndef NORL
} else { } else {
exitcurses(); exitcurses();


@@ -3909,6 +3914,7 @@ nochange:
free(tmp); free(tmp);
} }
} }
#endif
} }


/* Continue in navigate-as-you-type mode, if enabled */ /* Continue in navigate-as-you-type mode, if enabled */
@@ -4243,6 +4249,7 @@ int main(int argc, char *argv[])
crc8init(); crc8init();
#endif #endif


#ifndef NORL
/* Bind TAB to cycling */ /* Bind TAB to cycling */
rl_variable_bind("completion-ignore-case", "on"); rl_variable_bind("completion-ignore-case", "on");
#ifdef __linux__ #ifdef __linux__
@@ -4251,6 +4258,7 @@ int main(int argc, char *argv[])
rl_bind_key('\t', rl_complete); rl_bind_key('\t', rl_complete);
#endif #endif
read_history(NULL); read_history(NULL);
#endif


#ifdef DBGMODE #ifdef DBGMODE
enabledbg(); enabledbg();
@@ -4261,7 +4269,9 @@ int main(int argc, char *argv[])
browse(ipath); browse(ipath);
exitcurses(); exitcurses();


#ifndef NORL
write_history(NULL); write_history(NULL);
#endif


if (cfg.pickraw) { if (cfg.pickraw) {
if (copybufpos) { if (copybufpos) {


Loading…
Cancel
Save