Skip to content

Commit

Permalink
builder: improve macOS 10.5 and PPC support (#14152)
Browse files Browse the repository at this point in the history
  • Loading branch information
harens committed Apr 25, 2022
1 parent 563469e commit 11ee2b6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions vlib/v/builder/cc.v
Expand Up @@ -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 {
Expand Down Expand Up @@ -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']
}
Expand Down Expand Up @@ -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'
}
}
Expand Down

0 comments on commit 11ee2b6

Please sign in to comment.