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

View File

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