mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
-compress option
This commit is contained in:
parent
ad6ab39287
commit
afb372bbdf
@ -239,6 +239,27 @@ fn (v mut V) cc() {
|
|||||||
if !v.pref.is_debug && v.out_name_c != 'v.c' && v.out_name_c != 'v_macos.c' {
|
if !v.pref.is_debug && v.out_name_c != 'v.c' && v.out_name_c != 'v_macos.c' {
|
||||||
os.rm(v.out_name_c)
|
os.rm(v.out_name_c)
|
||||||
}
|
}
|
||||||
|
if v.pref.compress {
|
||||||
|
ret := os.system('strip $v.out_name')
|
||||||
|
if ret != 0 {
|
||||||
|
println('strip failed')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ret2 := os.system('upx --lzma -qqq $v.out_name')
|
||||||
|
if ret2 != 0 {
|
||||||
|
println('upx failed')
|
||||||
|
$if mac {
|
||||||
|
println('install upx with `brew install upx`')
|
||||||
|
}
|
||||||
|
$if linux {
|
||||||
|
println('install upx\n' +
|
||||||
|
'for example, on Debian/Ubuntu run `sudo apt install upx`')
|
||||||
|
}
|
||||||
|
$if windows {
|
||||||
|
// :)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ mut:
|
|||||||
ccompiler string // the name of the used C compiler
|
ccompiler string // the name of the used C compiler
|
||||||
building_v bool
|
building_v bool
|
||||||
autofree bool
|
autofree bool
|
||||||
|
compress bool
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -848,6 +849,7 @@ fn new_v(args[]string) &V {
|
|||||||
translated: 'translated' in args
|
translated: 'translated' in args
|
||||||
is_run: 'run' in args
|
is_run: 'run' in args
|
||||||
autofree: '-autofree' in args
|
autofree: '-autofree' in args
|
||||||
|
compress: '-compress' in args
|
||||||
is_repl: is_repl
|
is_repl: is_repl
|
||||||
build_mode: build_mode
|
build_mode: build_mode
|
||||||
cflags: cflags
|
cflags: cflags
|
||||||
|
Loading…
Reference in New Issue
Block a user