From 6d28a80bf873c546f623bb90037c7ee4f2d70f42 Mon Sep 17 00:00:00 2001 From: Enrico Lefass Date: Tue, 3 Dec 2019 09:26:47 +0100 Subject: [PATCH] haiku support (part 2) --- vlib/compiler/cc.v | 4 ++-- vlib/compiler/main.v | 4 ++++ vlib/os/os.v | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/vlib/compiler/cc.v b/vlib/compiler/cc.v index 19fbe2ba3b..8095a92428 100644 --- a/vlib/compiler/cc.v +++ b/vlib/compiler/cc.v @@ -263,8 +263,8 @@ fn (v mut V) cc() { a << libs // Without these libs compilation will fail on 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 || - v.os == .netbsd || v.os == .dragonfly || v.os == .solaris) { + if !v.pref.is_bare && v.pref.build_mode != .build_module && v.os in [ .linux, .freebsd, + .openbsd, .netbsd, .dragonfly, .solaris, .haiku ] { a << '-lm -lpthread ' // -ldl is a Linux only thing. BSDs have it in libc. if v.os == .linux { diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 58e4623928..a9daccce7f 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -966,6 +966,9 @@ pub fn new_v(args[]string) &V { $if solaris { _os = .solaris } + $if haiku { + _os = .haiku + } } else { _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` verror('use the flag `-cc msvc` to build using msvc') } + 'haiku' { return .haiku } } println('bad os $os') // todo panic? return .linux diff --git a/vlib/os/os.v b/vlib/os/os.v index 5206967719..d136330480 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -697,6 +697,9 @@ pub fn user_os() string { $if solaris { return 'solaris' } + $if haiku { + return 'haiku' + } return 'unknown' } @@ -796,6 +799,8 @@ pub fn executable() string { } $if solaris { } + $if haiku { + } $if netbsd { mut result := calloc(MAX_PATH) count := int(C.readlink('/proc/curproc/exe', result, MAX_PATH ))