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 make O_STATIC=1 O_NERD=1 strip
mv $(BIN) $(BIN)-nerd-static mv $(BIN) $(BIN)-nerd-static
musl:
cp misc/musl/musl-static-ubuntu.sh .
./musl-static-ubuntu.sh 1
rm ./musl-static-ubuntu.sh
dist: dist:
mkdir -p nnn-$(VERSION) mkdir -p nnn-$(VERSION)
$(CP) -r $(DISTFILES) nnn-$(VERSION) $(CP) -r $(DISTFILES) nnn-$(VERSION)
@ -216,23 +221,23 @@ sign:
gpg --detach-sign --yes nnn-$(VERSION).tar.gz gpg --detach-sign --yes nnn-$(VERSION).tar.gz
rm -f 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)) $(eval ID=$(shell curl -s 'https://api.github.com/repos/jarun/nnn/releases/tags/v$(VERSION)' | jq .id))
# upload sign file # upload sign file
curl -XPOST 'https://uploads.github.com/repos/jarun/nnn/releases/$(ID)/assets?name=nnn-$(VERSION).tar.gz.sig' \ 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' \ -H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/pgp-signature' \
--upload-file nnn-$(VERSION).tar.gz.sig --upload-file nnn-$(VERSION).tar.gz.sig
tar -zcf $(BIN)-static-$(VERSION).x86_64.tar.gz $(BIN)-static
# upx compress all static binaries # upx compress all static binaries
upx -qqq $(BIN)-static upx -qqq $(BIN)-static
upx -qqq $(BIN)-icons-static upx -qqq $(BIN)-icons-static
upx -qqq $(BIN)-nerd-static upx -qqq $(BIN)-nerd-static
# upload static binary # 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' \ 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' \ -H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-static-$(VERSION).x86_64.tar.gz --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 # 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' \ 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' \ -H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-icons-static-$(VERSION).x86_64.tar.gz --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' \ 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' \ -H 'Authorization: token $(NNN_SIG_UPLOAD_TOKEN)' -H 'Content-Type: application/x-sharedlib' \
--upload-file $(BIN)-nerd-static-$(VERSION).x86_64.tar.gz --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: 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 $(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 # Dependencies: git
# #
# Usage: musl-static-ubuntu.sh [no_run]
# # optional argument - do not to execute the binary after compilation
#
# Notes: # Notes:
# - run the script within the top-level nnn directory # - run the script within the top-level nnn directory
# - installs musl & gits netbsd-curses, musl-fts libs # - 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 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" strip "$BIN"
# Run the binary with it selected if [ -z "$1" ]; then
./"$BIN" -d "$BIN" # 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 ## List of patches
| Patch (a-z) | Description | Make var | | Patch (a-z) | Description | Make var |
| --- | --- | --- | --- | | --- | --- | --- |
| gitstatus | Add git status column to the detail view. Requires [libgit2](https://github.com/libgit2/libgit2). | `O_GISTATUS` | | 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` | | namefirst | Print filenames first in the detail view. Print user/group columns when a directory contains different users/groups. | `O_NAMEFIRST` |