builder: use .dylib for -shared builds in macOS

pull/5114/head
pancake 2020-05-29 04:52:19 +02:00 committed by GitHub
parent 104c278216
commit b3f2c629c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -44,6 +44,7 @@ fn gen_gitignore(name string) string {
'main',
'$name',
'*.so',
'*.dylib',
'*.dll'
].join('\n')
}

View File

@ -147,8 +147,12 @@ fn (mut v Builder) cc() {
if v.pref.is_shared {
linker_flags << '-shared'
a << '-fPIC' // -Wl,-z,defs'
$if macos {
v.pref.out_name += '.dylib'
} $else {
v.pref.out_name += '.so'
}
}
if v.pref.is_bare {
a << '-fno-stack-protector'
a << '-ffreestanding'