builder: improve macOS 10.5 and PPC support (#14152)

Haren S 2022-04-25 06:17:00 +01:00 committed by Jef Roosens
parent 745e75ab25
commit cde15abc0a
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 13 additions and 2 deletions

View File

@ -206,6 +206,14 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
if v.pref.os == .macos && os.exists('/opt/procursus') {
ccoptions.linker_flags << '-Wl,-rpath,/opt/procursus/lib'
}
mut user_darwin_version := 999_999_999
mut user_darwin_ppc := false
$if macos {
user_darwin_version = os.uname().release.split('.')[0].int()
if os.uname().machine == 'Power Macintosh' {
user_darwin_ppc = true
}
}
ccoptions.debug_mode = v.pref.is_debug
ccoptions.guessed_compiler = v.pref.ccompiler
if ccoptions.guessed_compiler == 'cc' && v.pref.is_prod {
@ -252,7 +260,10 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
}
if ccoptions.is_cc_gcc {
if ccoptions.debug_mode {
debug_options = ['-g', '-no-pie']
debug_options = ['-g']
if user_darwin_version > 9 {
debug_options << '-no-pie'
}
}
optimization_options = ['-O3', '-fno-strict-aliasing', '-flto']
}
@ -334,7 +345,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
}
// macOS code can include objective C TODO remove once objective C is replaced with C
if v.pref.os == .macos || v.pref.os == .ios {
if !ccoptions.is_cc_tcc {
if !ccoptions.is_cc_tcc && !user_darwin_ppc {
ccoptions.source_args << '-x objective-c'
}
}