haiku support (part 2)

pull/2963/head
Enrico Lefass 2019-12-03 09:26:47 +01:00 committed by Alexander Medvednikov
parent f806e0f9e5
commit 6d28a80bf8
3 changed files with 11 additions and 2 deletions

View File

@ -263,8 +263,8 @@ fn (v mut V) cc() {
a << libs a << libs
// Without these libs compilation will fail on Linux // Without these libs compilation will fail on Linux
// || os.user_os() == 'linux' // || os.user_os() == 'linux'
if !v.pref.is_bare && v.pref.build_mode != .build_module && (v.os == .linux || v.os == .freebsd || v.os == .openbsd || if !v.pref.is_bare && v.pref.build_mode != .build_module && v.os in [ .linux, .freebsd,
v.os == .netbsd || v.os == .dragonfly || v.os == .solaris) { .openbsd, .netbsd, .dragonfly, .solaris, .haiku ] {
a << '-lm -lpthread ' a << '-lm -lpthread '
// -ldl is a Linux only thing. BSDs have it in libc. // -ldl is a Linux only thing. BSDs have it in libc.
if v.os == .linux { if v.os == .linux {

View File

@ -966,6 +966,9 @@ pub fn new_v(args[]string) &V {
$if solaris { $if solaris {
_os = .solaris _os = .solaris
} }
$if haiku {
_os = .haiku
}
} }
else { else {
_os = os_from_string(target_os) _os = os_from_string(target_os)
@ -1149,6 +1152,7 @@ pub fn os_from_string(os string) OS {
// notice that `-os msvc` became `-cc msvc` // notice that `-os msvc` became `-cc msvc`
verror('use the flag `-cc msvc` to build using msvc') verror('use the flag `-cc msvc` to build using msvc')
} }
'haiku' { return .haiku }
} }
println('bad os $os') // todo panic? println('bad os $os') // todo panic?
return .linux return .linux

View File

@ -697,6 +697,9 @@ pub fn user_os() string {
$if solaris { $if solaris {
return 'solaris' return 'solaris'
} }
$if haiku {
return 'haiku'
}
return 'unknown' return 'unknown'
} }
@ -796,6 +799,8 @@ pub fn executable() string {
} }
$if solaris { $if solaris {
} }
$if haiku {
}
$if netbsd { $if netbsd {
mut result := calloc(MAX_PATH) mut result := calloc(MAX_PATH)
count := int(C.readlink('/proc/curproc/exe', result, MAX_PATH )) count := int(C.readlink('/proc/curproc/exe', result, MAX_PATH ))