From 972cbe2e9a715a6fb1edde63ef0bb6324be38335 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 9 Jul 2021 11:33:51 +0300 Subject: [PATCH] serenity: add more support --- cmd/v/help/build-c.txt | 12 ++++++++++-- vlib/v/checker/checker.v | 3 +-- vlib/v/doc/doc.v | 3 +++ vlib/v/pref/os.v | 2 +- vlib/v/pref/should_compile.v | 3 +++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cmd/v/help/build-c.txt b/cmd/v/help/build-c.txt index dc75a60d06..ad9553e7f2 100644 --- a/cmd/v/help/build-c.txt +++ b/cmd/v/help/build-c.txt @@ -88,8 +88,16 @@ see also `v help build`. Change the target OS that V tries to compile for. By default, the target OS is the host system. When OS is `cross`, V will attempt to output cross-platform C code. - List of OS supported by V: `linux`, `windows`, `ios`, `mac`, `freebsd`, `openbsd`, - `netbsd`, `dragonfly`, `solaris`, `android` and `haiku`. + + Here is a list of the operating systems, supported by V: + (CI tests runs on every commit/PR for each of these): + `windows`, `linux`, `macos` + + The compiler is known to also work, and has support for these operating + systems also (although we do not test it as regularly as for the above): + `android`, `ios`, + `freebsd`, `openbsd`, `netbsd`, `dragonfly`, + `solaris`, `serenity`, `haiku` Note that V has the concept of platform files, i.e. files ending with `_platform.c.v`, and usually only the matching files are used in diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index f1582fcdf0..17519d80e6 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -21,8 +21,7 @@ const int_max = int(0x7FFFFFFF) const ( valid_comp_if_os = ['windows', 'ios', 'macos', 'mach', 'darwin', 'hpux', 'gnu', 'qnx', 'linux', 'freebsd', 'openbsd', 'netbsd', 'bsd', 'dragonfly', 'android', 'solaris', - 'haiku', - ] + 'haiku', 'serenity'] valid_comp_if_compilers = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus'] valid_comp_if_platforms = ['amd64', 'i386', 'aarch64', 'arm64', 'arm32', 'rv64', 'rv32'] valid_comp_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian'] diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index 2a58cdd3bf..6e7ccc9114 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -40,7 +40,9 @@ pub enum Platform { js // for interoperability in prefs.OS android solaris + serenity haiku + raw cross // TODO: add functionality for v doc -os cross whenever possible } @@ -58,6 +60,7 @@ pub fn platform_from_string(platform_str string) ?Platform { 'dragonfly' { return .dragonfly } 'js' { return .js } 'solaris' { return .solaris } + 'serenity' { return .serenity } 'android' { return .android } 'haiku' { return .haiku } 'nix' { return .linux } diff --git a/vlib/v/pref/os.v b/vlib/v/pref/os.v index 15e0ac2db4..26b3c7fed9 100644 --- a/vlib/v/pref/os.v +++ b/vlib/v/pref/os.v @@ -59,7 +59,7 @@ pub fn (o OS) str() string { .js { return 'JavaScript' } .android { return 'Android' } .solaris { return 'Solaris' } - .serenity { return 'serenity' } + .serenity { return 'SerenityOS' } .haiku { return 'Haiku' } .raw { return 'Raw' } .all { return 'all' } diff --git a/vlib/v/pref/should_compile.v b/vlib/v/pref/should_compile.v index b8f63b335e..d5ba148994 100644 --- a/vlib/v/pref/should_compile.v +++ b/vlib/v/pref/should_compile.v @@ -181,6 +181,9 @@ pub fn (prefs &Preferences) should_compile_c(file string) bool { if prefs.os != .solaris && file.ends_with('_solaris.c.v') { return false } + if prefs.os != .serenity && file.ends_with('_serenity.c.v') { + return false + } return true }