Created
July 9, 2015 21:13
-
-
Save dgellow/94dc3876cb5f811dc4ae to your computer and use it in GitHub Desktop.
MASSIVELY reduce nim binary size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE=life.nim | |
BINARY=life | |
function compile { | |
nim c -d:release --passC:-ffast-math --opt:size $FILE | |
} | |
function crunch { | |
strip --strip-all \ | |
-R .note \ | |
-R .comment \ | |
-R .eh_frame \ | |
-R .eh_frame_hdr \ | |
$BINARY | |
sstrip -z $BINARY | |
} | |
function pack { | |
upx --ultra-brute $BINARY | |
} | |
compile | |
crunch | |
pack | |
ls -l $BINARY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--ultra-brute option breaks the binary