From 326d5a4faeb2c0e16252f42ae0f2d7d906246f09 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 26 May 2021 23:48:22 +0530 Subject: [PATCH] Update musl compilation script --- misc/musl/musl-static-ubuntu.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/misc/musl/musl-static-ubuntu.sh b/misc/musl/musl-static-ubuntu.sh index 2ee3e1ed..f8351aa2 100755 --- a/misc/musl/musl-static-ubuntu.sh +++ b/misc/musl/musl-static-ubuntu.sh @@ -1,15 +1,16 @@ #!/usr/bin/env sh -# Statically compile nnn with netbsd-curses and musl libc on Ubuntu +# Statically compile nnn with netbsd-curses, musl-fts and musl libc on Ubuntu # # netbsd-curses: https://github.com/sabotage-linux/netbsd-curses +# musl-fts: https://github.com/void-linux/musl-fts # musl libc: https://www.musl-libc.org/ # # Dependencies: git # # Notes: # - run the script within the top-level nnn directory -# - installs musl and downloads netbsd-curses library +# - installs musl & gits netbsd-curses, musl-fts libs # # Tested on Ubuntu 20.04 x86_64 # Author: Arun Prakash Jana @@ -41,10 +42,20 @@ fi make CC=musl-gcc CFLAGS=-O3 LDFLAGS=-static all-static -j$(($(nproc)+1)) cp -v libcurses/libcurses.a libterminfo/libterminfo.a libs/ +# Get musl-fts library +cd .. +[ ! -d "./musl-fts" ] && git clone https://github.com/void-linux/musl-fts --depth=1 + +# Compile the static musl-fts library +cd musl-fts +./bootstrap.sh +./configure +make CC=musl-gcc CFLAGS=-O3 LDFLAGS=-static -j$(($(nproc)+1)) + # Compile nnn cd .. [ -e "./netbsd-curses" ] || rm "$BIN" -musl-gcc -O3 -DNORL -DNOMOUSE -std=c11 -Wall -Wextra -Wshadow -I./netbsd-curses/libcurses -o "$BIN" src/nnn.c -Wl,-Bsymbolic-functions -L./netbsd-curses/libs -lcurses -lterminfo -static +musl-gcc -O3 -DNORL -DNOMOUSE -std=c11 -Wall -Wextra -Wshadow -I./netbsd-curses/libcurses -I./musl-fts -o "$BIN" src/nnn.c -Wl,-Bsymbolic-functions -lpthread -L./netbsd-curses/libs -lcurses -lterminfo -static -L./musl-fts/.libs -lfts strip "$BIN" # Run the binary with it selected