]> Sergey Matveev's repositories - nnn.git/commitdiff
Add Makefile target to compile nnn with musl libc
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 2 Jun 2021 23:03:17 +0000 (04:33 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 2 Jun 2021 23:04:44 +0000 (04:34 +0530)
Makefile
misc/musl/musl-static-ubuntu.sh
patches/README.md

index fe9ef383116d386e0b99d6b9126e758fcdb3ba46..c2517fd72d70fa6853a02b608f616d92cd831779 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
index f8351aa2132d6215a549bb48d1432dbbd6af8a04..6e0f63d86fce1cdc9f134a5d01c4913df950d469 100755 (executable)
@@ -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
index 316e4c80101634c48587d3cdfd71493ec15e3b00..67e85fecd51f10c5dc10d7dfb23a12740b73985a 100644 (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` |