diff options
| author | ruki <[email protected]> | 2025-11-22 23:49:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-22 23:49:58 +0800 |
| commit | 6b615cab4b49ac08420a4bdfb411ff4308646b15 (patch) | |
| tree | f83f0abbcb73973dccc7f357785250e5ce7c430b | |
| parent | 4a3e993297b57f6c725690b26a81ecf5ad9c087e (diff) | |
add solaris platform
| -rw-r--r-- | .github/workflows/solaris.yml | 37 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | README_zh.md | 1 | ||||
| -rw-r--r-- | core/src/tbox/inc/solaris/tbox.config.h | 232 | ||||
| -rw-r--r-- | core/src/xmake/engine.c | 10 | ||||
| -rw-r--r-- | xmake/platforms/solaris/xmake.lua | 57 |
6 files changed, 337 insertions, 1 deletions
diff --git a/.github/workflows/solaris.yml b/.github/workflows/solaris.yml new file mode 100644 index 000000000..fa500ad89 --- /dev/null +++ b/.github/workflows/solaris.yml @@ -0,0 +1,37 @@ +name: Solaris + +on: + pull_request: + push: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + concurrency: + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Solaris + cancel-in-progress: true + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Tests + uses: vmactions/solaris-vm@v1 + with: + usesh: true + prepare: | + pkgutil -y -i socat git gmake bash gcc4g++ || pkgutil -y -i socat git gmake bash gcc5g++ || pkg install -y developer/gcc || true + run: | + cd $GITHUB_WORKSPACE + bash ./configure + gmake -j4 + gmake install + export XMAKE_ROOT=y + xrepo --version + xmake l os.meminfo + xmake lua -v -D tests/run.lua + @@ -187,6 +187,7 @@ $ xmake f --menu * NetBSD (i386, x86_64) * OpenBSD (i386, x86_64) * DragonflyBSD (i386, x86_64) +* Solaris (i386, x86_64) * Android (x86, x86_64, armeabi, armeabi-v7a, arm64-v8a) * iOS (armv7, armv7s, arm64, i386, x86_64) * WatchOS (armv7k, i386) diff --git a/README_zh.md b/README_zh.md index 4cd574c97..859caf791 100644 --- a/README_zh.md +++ b/README_zh.md @@ -248,6 +248,7 @@ $ xmake f --menu * NetBSD (i386, x86_64) * OpenBSD (i386, x86_64) * DragonflyBSD (i386, x86_64) +* Solaris (i386, x86_64) * Android (x86, x86_64, armeabi, armeabi-v7a, arm64-v8a) * iOS (armv7, armv7s, arm64, i386, x86_64) * WatchOS (armv7k, i386) diff --git a/core/src/tbox/inc/solaris/tbox.config.h b/core/src/tbox/inc/solaris/tbox.config.h new file mode 100644 index 000000000..a6bd8d5a4 --- /dev/null +++ b/core/src/tbox/inc/solaris/tbox.config.h @@ -0,0 +1,232 @@ +#ifndef TB_CONFIG_H +#define TB_CONFIG_H + +// version +#define TB_CONFIG_VERSION "1.7.3" +#define TB_CONFIG_VERSION_MAJOR 1 +#define TB_CONFIG_VERSION_MINOR 7 +#define TB_CONFIG_VERSION_ALTER 3 +#define TB_CONFIG_VERSION_BUILD 20230119 + +// defines +#define TB_CONFIG_OS_SOLARIS 1 +#define _GNU_SOURCE 1 +#define _REENTRANT 1 +#define TB_CONFIG_SMALL 1 +/* #undef TB_CONFIG_MICRO_ENABLE */ +/* #undef TB_CONFIG_TYPE_HAVE_WCHAR */ +#define TB_CONFIG_TYPE_HAVE_FLOAT 1 +#define TB_CONFIG_FORCE_UTF8 1 +/* #undef TB_CONFIG_API_HAVE_DEPRECATED */ +/* #undef TB_CONFIG_EXCEPTION_ENABLE */ + +// keywords +#define TB_CONFIG_KEYWORD_HAVE__thread 1 +#define TB_CONFIG_KEYWORD_HAVE_Thread_local 1 + +// features +#define TB_CONFIG_FEATURE_HAVE_ANONYMOUS_UNION 1 + +// modules +/* #undef TB_CONFIG_MODULE_HAVE_XML */ +/* #undef TB_CONFIG_MODULE_HAVE_ZIP */ +#define TB_CONFIG_MODULE_HAVE_HASH 1 +/* #undef TB_CONFIG_MODULE_HAVE_REGEX */ +/* #undef TB_CONFIG_MODULE_HAVE_OBJECT */ +#define TB_CONFIG_MODULE_HAVE_CHARSET 1 +/* #undef TB_CONFIG_MODULE_HAVE_DATABASE */ +/* #undef TB_CONFIG_MODULE_HAVE_COROUTINE */ + +// packages +/* #undef TB_CONFIG_PACKAGE_HAVE_ZLIB */ +/* #undef TB_CONFIG_PACKAGE_HAVE_MYSQL */ +/* #undef TB_CONFIG_PACKAGE_HAVE_SQLITE3 */ +/* #undef TB_CONFIG_PACKAGE_HAVE_OPENSSL */ +/* #undef TB_CONFIG_PACKAGE_HAVE_POLARSSL */ +/* #undef TB_CONFIG_PACKAGE_HAVE_MBEDTLS */ +/* #undef TB_CONFIG_PACKAGE_HAVE_PCRE2 */ +/* #undef TB_CONFIG_PACKAGE_HAVE_PCRE */ + +// libc functions +#define TB_CONFIG_LIBC_HAVE_MEMCPY 1 +#define TB_CONFIG_LIBC_HAVE_MEMSET 1 +#define TB_CONFIG_LIBC_HAVE_MEMMOVE 1 +#define TB_CONFIG_LIBC_HAVE_MEMCMP 1 +#define TB_CONFIG_LIBC_HAVE_MEMMEM 1 +#define TB_CONFIG_LIBC_HAVE_STRCAT 1 +#define TB_CONFIG_LIBC_HAVE_STRNCAT 1 +#define TB_CONFIG_LIBC_HAVE_STRCPY 1 +#define TB_CONFIG_LIBC_HAVE_STRNCPY 1 +#define TB_CONFIG_LIBC_HAVE_STRLCPY 1 +#define TB_CONFIG_LIBC_HAVE_STRLEN 1 +#define TB_CONFIG_LIBC_HAVE_STRNLEN 1 +#define TB_CONFIG_LIBC_HAVE_STRCHR 1 +#define TB_CONFIG_LIBC_HAVE_STRRCHR 1 +#define TB_CONFIG_LIBC_HAVE_STRSTR 1 +#define TB_CONFIG_LIBC_HAVE_STRCASESTR 1 +#define TB_CONFIG_LIBC_HAVE_STRCMP 1 +#define TB_CONFIG_LIBC_HAVE_STRCASECMP 1 +#define TB_CONFIG_LIBC_HAVE_STRNCMP 1 +#define TB_CONFIG_LIBC_HAVE_STRNCASECMP 1 + +#define TB_CONFIG_LIBC_HAVE_WCSCAT 1 +#define TB_CONFIG_LIBC_HAVE_WCSNCAT 1 +#define TB_CONFIG_LIBC_HAVE_WCSCPY 1 +#define TB_CONFIG_LIBC_HAVE_WCSNCPY 1 +#define TB_CONFIG_LIBC_HAVE_WCSLCPY 1 +#define TB_CONFIG_LIBC_HAVE_WCSLEN 1 +/* #undef TB_CONFIG_LIBC_HAVE_WCSNLEN */ +#define TB_CONFIG_LIBC_HAVE_WCSSTR 1 +/* #undef TB_CONFIG_LIBC_HAVE_WCSCASESTR */ +#define TB_CONFIG_LIBC_HAVE_WCSCMP 1 +#define TB_CONFIG_LIBC_HAVE_WCSCASECMP 1 +#define TB_CONFIG_LIBC_HAVE_WCSNCMP 1 +#define TB_CONFIG_LIBC_HAVE_WCSNCASECMP 1 +#define TB_CONFIG_LIBC_HAVE_WCSTOMBS 1 +#define TB_CONFIG_LIBC_HAVE_MBSTOWCS 1 + +#define TB_CONFIG_LIBC_HAVE_GMTIME 1 +#define TB_CONFIG_LIBC_HAVE_MKTIME 1 +#define TB_CONFIG_LIBC_HAVE_LOCALTIME 1 +#define TB_CONFIG_LIBC_HAVE_GETTIMEOFDAY 1 +#define TB_CONFIG_LIBC_HAVE_SIGNAL 1 +#define TB_CONFIG_LIBC_HAVE_SETJMP 1 +#define TB_CONFIG_LIBC_HAVE_SIGSETJMP 1 +#define TB_CONFIG_LIBC_HAVE_KILL 1 +#define TB_CONFIG_LIBC_HAVE_BACKTRACE 1 +#define TB_CONFIG_LIBC_HAVE_SETLOCALE 1 +#define TB_CONFIG_LIBC_HAVE_FPUTC 1 +#define TB_CONFIG_LIBC_HAVE_FGETC 1 +#define TB_CONFIG_LIBC_HAVE_UNGETC 1 +#define TB_CONFIG_LIBC_HAVE_FPUTS 1 +#define TB_CONFIG_LIBC_HAVE_FGETS 1 +#define TB_CONFIG_LIBC_HAVE_FREAD 1 +#define TB_CONFIG_LIBC_HAVE_FWRITE 1 +#define TB_CONFIG_LIBC_HAVE_SRANDOM 1 +#define TB_CONFIG_LIBC_HAVE_RANDOM 1 + +// libm functions +#define TB_CONFIG_LIBM_HAVE_SINCOS 1 +#define TB_CONFIG_LIBM_HAVE_SINCOSF 1 +#define TB_CONFIG_LIBM_HAVE_LOG2 1 +#define TB_CONFIG_LIBM_HAVE_LOG2F 1 +#define TB_CONFIG_LIBM_HAVE_SQRT 1 +#define TB_CONFIG_LIBM_HAVE_SQRTF 1 +#define TB_CONFIG_LIBM_HAVE_ACOS 1 +#define TB_CONFIG_LIBM_HAVE_ACOSF 1 +#define TB_CONFIG_LIBM_HAVE_ASIN 1 +#define TB_CONFIG_LIBM_HAVE_ASINF 1 +#define TB_CONFIG_LIBM_HAVE_POW 1 +#define TB_CONFIG_LIBM_HAVE_POWF 1 +#define TB_CONFIG_LIBM_HAVE_FMOD 1 +#define TB_CONFIG_LIBM_HAVE_FMODF 1 +#define TB_CONFIG_LIBM_HAVE_TAN 1 +#define TB_CONFIG_LIBM_HAVE_TANF 1 +#define TB_CONFIG_LIBM_HAVE_ATAN 1 +#define TB_CONFIG_LIBM_HAVE_ATANF 1 +#define TB_CONFIG_LIBM_HAVE_ATAN2 1 +#define TB_CONFIG_LIBM_HAVE_ATAN2F 1 +#define TB_CONFIG_LIBM_HAVE_COS 1 +#define TB_CONFIG_LIBM_HAVE_COSF 1 +#define TB_CONFIG_LIBM_HAVE_SIN 1 +#define TB_CONFIG_LIBM_HAVE_SINF 1 +#define TB_CONFIG_LIBM_HAVE_EXP 1 +#define TB_CONFIG_LIBM_HAVE_EXPF 1 + +// posix functions +#define TB_CONFIG_POSIX_HAVE_POLL 1 +#define TB_CONFIG_POSIX_HAVE_SELECT 1 +#define TB_CONFIG_POSIX_HAVE_PTHREAD_MUTEX_INIT 1 +#define TB_CONFIG_POSIX_HAVE_PTHREAD_CREATE 1 +#define TB_CONFIG_POSIX_HAVE_PTHREAD_SETSPECIFIC 1 +#define TB_CONFIG_POSIX_HAVE_PTHREAD_GETSPECIFIC 1 +#define TB_CONFIG_POSIX_HAVE_PTHREAD_KEY_CREATE 1 +#define TB_CONFIG_POSIX_HAVE_PTHREAD_KEY_DELETE 1 +/* #undef TB_CONFIG_POSIX_HAVE_PTHREAD_SETAFFINITY_NP */ +#define TB_CONFIG_POSIX_HAVE_SOCKET 1 +#define TB_CONFIG_POSIX_HAVE_OPENDIR 1 +#define TB_CONFIG_POSIX_HAVE_DLOPEN 1 +#define TB_CONFIG_POSIX_HAVE_OPEN 1 +/* #undef TB_CONFIG_POSIX_HAVE_STAT64 */ +#define TB_CONFIG_POSIX_HAVE_GETHOSTNAME 1 +#define TB_CONFIG_POSIX_HAVE_GETIFADDRS 1 +#define TB_CONFIG_POSIX_HAVE_SEM_INIT 1 +#define TB_CONFIG_POSIX_HAVE_GETPAGESIZE 1 +#define TB_CONFIG_POSIX_HAVE_SYSCONF 1 +#define TB_CONFIG_POSIX_HAVE_SCHED_YIELD 1 +/* #undef TB_CONFIG_POSIX_HAVE_SCHED_SETAFFINITY */ +#define TB_CONFIG_POSIX_HAVE_REGCOMP 1 +#define TB_CONFIG_POSIX_HAVE_REGEXEC 1 +#define TB_CONFIG_POSIX_HAVE_READV 1 +#define TB_CONFIG_POSIX_HAVE_WRITEV 1 +#define TB_CONFIG_POSIX_HAVE_PREADV 1 +#define TB_CONFIG_POSIX_HAVE_PWRITEV 1 +/* #undef TB_CONFIG_POSIX_HAVE_PREAD64 */ +/* #undef TB_CONFIG_POSIX_HAVE_PWRITE64 */ +#define TB_CONFIG_POSIX_HAVE_FDATASYNC 1 +/* #undef TB_CONFIG_POSIX_HAVE_COPYFILE */ +/* #undef TB_CONFIG_POSIX_HAVE_SENDFILE */ +/* #undef TB_CONFIG_POSIX_HAVE_EPOLL_CREATE */ +/* #undef TB_CONFIG_POSIX_HAVE_EPOLL_WAIT */ +#define TB_CONFIG_POSIX_HAVE_POSIX_SPAWNP 1 +#define TB_CONFIG_POSIX_HAVE_EXECVP 1 +/* #undef TB_CONFIG_POSIX_HAVE_EXECVPE */ +#define TB_CONFIG_POSIX_HAVE_FORK 1 +#define TB_CONFIG_POSIX_HAVE_VFORK 1 +#define TB_CONFIG_POSIX_HAVE_WAITPID 1 +#define TB_CONFIG_POSIX_HAVE_GETDTABLESIZE 1 +#define TB_CONFIG_POSIX_HAVE_GETRLIMIT 1 +#define TB_CONFIG_POSIX_HAVE_GETADDRINFO 1 +#define TB_CONFIG_POSIX_HAVE_GETNAMEINFO 1 +#define TB_CONFIG_POSIX_HAVE_GETHOSTBYNAME 1 +#define TB_CONFIG_POSIX_HAVE_GETHOSTBYADDR 1 +#define TB_CONFIG_POSIX_HAVE_FCNTL 1 +#define TB_CONFIG_POSIX_HAVE_PIPE 1 +#define TB_CONFIG_POSIX_HAVE_PIPE2 1 +#define TB_CONFIG_POSIX_HAVE_MKFIFO 1 +#define TB_CONFIG_POSIX_HAVE_MMAP 1 +#define TB_CONFIG_POSIX_HAVE_FUTIMENS 1 +#define TB_CONFIG_POSIX_HAVE_UTIMENSAT 1 + +// windows functions +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE_REL */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE8 */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE8_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE8_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGE8_REL */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDOR8 */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDOR8_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDOR8_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDOR8_REL */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD_REL */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD64 */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD64_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD64_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDEXCHANGEADD64_REL */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE_REL */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE64 */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE64_NF */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE64_ACQ */ +/* #undef TB_CONFIG_WINDOWS_HAVE__INTERLOCKEDCOMPAREEXCHANGE64_REL */ + +// bsd functions +#define TB_CONFIG_BSD_HAVE_FLOCK 1 + +// systemv functions +#define TB_CONFIG_SYSTEMV_HAVE_SEMGET 1 +/* #undef TB_CONFIG_SYSTEMV_HAVE_SEMTIMEDOP */ + +// valgrind functions +/* #undef TB_CONFIG_SYSTEMV_HAVE_VALGRIND_STACK_REGISTER */ + +#endif + diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index 6360bf978..d71c05c62 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -39,7 +39,7 @@ #include <mach-o/dyld.h> #include <signal.h> #elif defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_ANDROID) || \ - defined(TB_CONFIG_OS_HAIKU) + defined(TB_CONFIG_OS_HAIKU) || defined(TB_CONFIG_OS_SOLARIS) #include <unistd.h> #include <signal.h> #endif @@ -48,6 +48,10 @@ #include <sys/sysctl.h> #include <signal.h> #endif +#ifdef TB_CONFIG_OS_SOLARIS +#include <sys/types.h> +#include <signal.h> +#endif #ifdef TB_CONFIG_OS_HAIKU #include <image.h> #endif @@ -79,6 +83,8 @@ #else #define XM_PROC_SELF_FILE "/proc/curproc/file" #endif +#elif defined(TB_CONFIG_OS_SOLARIS) +#define XM_PROC_SELF_FILE "/proc/self/path/a.out" #endif // hook lua memory allocator @@ -1079,6 +1085,8 @@ static tb_void_t xm_engine_init_host(xm_engine_t *engine) { syshost = "linux"; #elif defined(TB_CONFIG_OS_BSD) syshost = "bsd"; +#elif defined(TB_CONFIG_OS_SOLARIS) + syshost = "solaris"; #elif defined(TB_CONFIG_OS_IOS) syshost = "ios"; #elif defined(TB_CONFIG_OS_ANDROID) diff --git a/xmake/platforms/solaris/xmake.lua b/xmake/platforms/solaris/xmake.lua new file mode 100644 index 000000000..5abdde4fb --- /dev/null +++ b/xmake/platforms/solaris/xmake.lua @@ -0,0 +1,57 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, Xmake Open Source Community. +-- +-- @author ruki +-- @file xmake.lua +-- + +platform("solaris") + set_os("solaris") + set_hosts("solaris") + set_archs("i386", "x86_64") + + set_formats("static", "lib$(name).a") + set_formats("object", "$(name).o") + set_formats("shared", "lib$(name).so") + set_formats("symbol", "$(name).sym") + + set_installdir("/usr/local") + + set_toolchains("envs", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "go", "rust", "gfortran", "zig") + + set_menu { + config = + { + {category = "Cuda SDK Configuration" } + , {nil, "cuda", "kv", "auto", "The Cuda SDK Directory" } + , {nil, "cuda_sdkver", "kv", "auto", "The Cuda SDK Version" } + , {category = "Qt SDK Configuration" } + , {nil, "qt", "kv", "auto", "The Qt SDK Directory" } + , {nil, "qt_host", "kv", "auto", "The Qt Host SDK Directory" } + , {nil, "qt_sdkver", "kv", "auto", "The Qt SDK Version" } + } + + , global = + { + {category = "Cuda SDK Configuration" } + , {nil, "cuda", "kv", "auto", "The Cuda SDK Directory" } + , {category = "Qt SDK Configuration" } + , {nil, "qt", "kv", "auto", "The Qt SDK Directory" } + , {nil, "qt_host", "kv", "auto", "The Qt Host SDK Directory" } + } + } + + |
