From a3480b8b71ccd53d674f1d711d1387ca55a18776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pi=C3=B1a=20Colada?= Date: Tue, 11 May 2021 00:01:04 +0530 Subject: [PATCH] Updated Developer guides (markdown) --- Developer-guides.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Developer-guides.md b/Developer-guides.md index 8111254..d853ea7 100644 --- a/Developer-guides.md +++ b/Developer-guides.md @@ -168,6 +168,46 @@ Install the packages `libncurses-devel` and `libreadline-devel` and compile `nnn Install plugins and use the program option `-x`. +## Compile with musl libc + +In this example we will compile `nnn` with [netbsd-curses](https://github.com/sabotage-linux/netbsd-curses) and [musl libc](https://www.musl-libc.org/) on Ubuntu 20.04. + +#### Install musl + + sudo apt install musl musl-dev musl-tools + +#### Get netbsd-curses + + git clone https://github.com/sabotage-linux/netbsd-curses --depth=1 + cd netbsd-curses + +#### Compile the shared and static libraries + + make CC=musl-gcc CFLAGS="-O3 -Wall -fPIC" -j4 all + sudo cp libcurses/libcurses.so libterminfo/libterminfo.so + make clean + make CC=musl-gcc make CFLAGS=-O3 LDFLAGS=-static all-static + sudo cp libcurses/libcurses.a libterminfo/libterminfo.a + +#### Compile `nnn` + + # Dynamic + musl-gcc -O3 -DNORL -I/path_to/netbsd-curses/libcurses -o nnn src/nnn.c -Wl,-Bsymbolic-functions -L/opt/netbsd-curses -lcurses -lterminfo + + # Dynamic custom + musl-gcc -O3 -DNORL -DNOLOCALE -DNOMOUSE -DNOBATCH -DNOFIFO -DTOURBIN_QSORT -DNOSSN -DNOUG -DNOX11 -march=corei7 -I/path_to/netbsd-curses/libcurses -o nnn src/nnn.c -Wl,-Bsymbolic-functions -L/opt/netbsd-curses -lcurses -lterminfo + + # Note: For static compilation append `--static` to the above commands + + # Strip the binary + strip nnn + +#### Results + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 18754 vaio 20 0 2076 1692 976 S 0.0 0.0 0:00.01 ./nnn -dn + 18952 vaio 20 0 1236 840 356 S 0.0 0.0 0:00.01 ./nnn-static -dn + ## Cross-compile for Android This section applies to Linux as host, Android on arm64 target and an xterm-256color terminal.