1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

OpenBSD, NetBSD, DragonFly support

This commit is contained in:
Alexander Medvednikov 2019-07-15 20:18:05 +02:00
parent ecda895003
commit 374781da1a
2 changed files with 22 additions and 2 deletions

View File

@ -29,7 +29,7 @@ fn vtmp_path() string {
}
const (
SupportedPlatforms = ['windows', 'mac', 'linux', 'freebsd']
SupportedPlatforms = ['windows', 'mac', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly']
TmpPath = vtmp_path()
)
@ -38,6 +38,9 @@ enum OS {
linux
windows
freebsd
openbsd
netbsd
dragonfly
}
enum Pass {
@ -607,7 +610,9 @@ mut args := ''
a << '-x objective-c'
}
// Without these libs compilation will fail on Linux
if (v.os == .linux || os.user_os() == 'linux' || v.os == .freebsd) && v.pref.build_mode != .build {
// || os.user_os() == 'linux'
if v.pref.build_mode != .build && (v.os == .linux || v.os == .freebsd || v.os == .openbsd ||
v.os == .netbsd || v.os == .dragonfly) {
a << '-lm -ldl -lpthread'
}
// Find clang executable
@ -894,6 +899,15 @@ fn new_v(args[]string) *V {
$if freebsd {
_os = .freebsd
}
$if openbsd {
_os = .openbsd
}
$if netbsd {
_os = .netbsd
}
$if dragonfly {
_os = .dragonfly
}
}
else {
switch target_os {
@ -901,6 +915,9 @@ fn new_v(args[]string) *V {
case 'windows': _os = .windows
case 'mac': _os = .mac
case 'freebsd': _os = .freebsd
case 'openbsd': _os = .openbsd
case 'netbsd': _os = .netbsd
case 'dragonfly': _os = .dragonfly
}
}
builtins := [

View File

@ -2617,6 +2617,9 @@ fn os_name_to_ifdef(name string) string {
case 'mac': return '__APPLE__'
case 'linux': return '__linux__'
case 'freebsd': return '__FreeBSD__'
case 'openbsd': return '__OpenBSD__'
case 'netbsd': return '__NetBSD__'
case 'dragonfly': return '__DragonFly__'
}
panic('bad os ifdef name "$name"')
return ''