Add Makefile target to compile nnn with musl libc

This commit is contained in:
Arun Prakash Jana 2021-06-03 04:33:17 +05:30
parent 88e9171266
commit 29ef232301
No known key found for this signature in database
GPG Key ID: A75979F35C080412
3 changed files with 21 additions and 6 deletions

View File

@ -205,6 +205,11 @@ static:
make O_STATIC=1 O_NERD=1 strip
mv $(BIN) $(BIN)-nerd-static
musl:
cp misc/musl/musl-static-ubuntu.sh .
./musl-static-ubuntu.sh 1
rm ./musl-static-ubuntu.sh
dist:
mkdir -p nnn-$(VERSION)
$(CP) -r $(DISTFILES) nnn-$(VERSION)
@ -216,23 +221,23 @@ sign:
gpg --detach-sign --yes nnn-$(VERSION).tar.gz
rm -f nnn-$(VERSION).tar.gz
upload-local: sign static
upload-local: sign static musl-static
$(eval ID=$(shell curl -s 'https://api.github.com/repos/jarun/nnn/releases/tags/v$(VERSION)' | jq .id))
# upload sign file
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=nnn-$(VERSION).tar.gz.sig' \
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/pgp-signature' \
--upload-file nnn-$(VERSION).tar.gz.sig
tar -zcf $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-static
# upx compress all static binaries
upx -qqq $(BIN)-static
upx -qqq $(BIN)-icons-static
upx -qqq $(BIN)-nerd-static
# upload static binary
tar -zcf $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-static
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-static-$(VERSION).x86_64.tar.gz' \
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-static-$(VERSION).x86_64.tar.gz
tar -zcf $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static
# upload icons-in-terminal compiled static binary
tar -zcf $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-icons-static-$(VERSION).x86_64.tar.gz' \
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-icons-static-$(VERSION).x86_64.tar.gz
@ -241,6 +246,11 @@ upload-local: sign static
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-nerd-static-$(VERSION).x86_64.tar.gz' \
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz
# upload musl static binary
tar -zcf $(BIN)-musl-static-$(VERSION).x86_64.tar.gz $(BIN)-musl-static
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=$(BIN)-musl-static-$(VERSION).x86_64.tar.gz' \
-H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-musl-static-$(VERSION).x86_64.tar.gz
clean:
$(RM) -f $(BIN) nnn-$(VERSION).tar.gz *.sig $(BIN)-static $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-icons-static $(BIN)-icons-static-$(VERSION).x86_64.tar.gz $(BIN)-nerd-static $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz

View File

@ -8,6 +8,9 @@
#
# Dependencies: git
#
# Usage: musl-static-ubuntu.sh [no_run]
# # optional argument - do not to execute the binary after compilation
#
# Notes:
# - run the script within the top-level nnn directory
# - installs musl & gits netbsd-curses, musl-fts libs
@ -58,5 +61,7 @@ cd ..
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
./"$BIN" -d "$BIN"
if [ -z "$1" ]; then
# Run the binary with it selected
./"$BIN" -d "$BIN"
fi

View File

@ -6,7 +6,7 @@ The patches will be adapted on each release when necessary (v4.1 onwards). Each
## List of patches
| Patch (a-z) | Description | Make var |
| --- | --- | --- | --- |
| --- | --- | --- |
| gitstatus | Add git status column to the detail view. Requires [libgit2](https://github.com/libgit2/libgit2). | `O_GISTATUS` |
| namefirst | Print filenames first in the detail view. Print user/group columns when a directory contains different users/groups. | `O_NAMEFIRST` |