summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-24 22:57:21 +0800
committerruki <[email protected]>2022-10-24 22:57:21 +0800
commit7cf5b563927bc79748969d26e84d16884bbe4d73 (patch)
treeafa2eef440fb4244c00bd6e9a95c0fce4034208b
parentd8be2a1ca7bbc360a808eb921607fad74095f3cf (diff)
support openbsd
-rw-r--r--.github/workflows/openbsd.yml4
-rw-r--r--core/makefile2
-rw-r--r--core/plat/bsd/prefix.mak2
-rw-r--r--core/src/xmake/engine.c2
-rw-r--r--core/src/xmake/os/cpuinfo.c2
-rw-r--r--core/src/xmake/os/meminfo.c2
-rwxr-xr-xscripts/srcenv.profile2
7 files changed, 9 insertions, 7 deletions
diff --git a/.github/workflows/openbsd.yml b/.github/workflows/openbsd.yml
index 0ab7743ad..a064de185 100644
--- a/.github/workflows/openbsd.yml
+++ b/.github/workflows/openbsd.yml
@@ -25,9 +25,9 @@ jobs:
usesh: true
mem: 4096
copyback: false
- prepare: pkg install -y curl unzip gmake llvm gsed bash perl5
+ prepare: pkg_add curl unzip gmake llvm gsed bash perl5
run: |
- gmake -j4
+ gmake -j4 BUILD_ARCH=x86_64
gmake install
export XMAKE_ROOT=y
xrepo --version
diff --git a/core/makefile b/core/makefile
index 2104bb688..297c497e6 100644
--- a/core/makefile
+++ b/core/makefile
@@ -295,7 +295,7 @@ base_LIBPATH :=
base_LIBNAMES :=
base_LIBNAMES += $(shell if { cat detect/curses.c | $(CC) -xc - -lcurses -ltinfo -o /dev/null 2>/dev/null; }; then echo curses tinfo; fi )
base_LIBNAMES += $(shell if { cat detect/readline.c | $(CC) -xc - -lreadline -o /dev/null 2>/dev/null; }; then echo readline; fi )
-base_LIBNAMES += m dl pthread
+base_LIBNAMES += m pthread
endif
# get branch and commit
diff --git a/core/plat/bsd/prefix.mak b/core/plat/bsd/prefix.mak
index cee3a4406..e9486bdb6 100644
--- a/core/plat/bsd/prefix.mak
+++ b/core/plat/bsd/prefix.mak
@@ -91,7 +91,7 @@ CCFLAGS := $(CXXFLAGS) -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_S
# ldflags
LDFLAGS_RELEASE =
-LDFLAGS_DEBUG = -rdynamic
+LDFLAGS_DEBUG = -rdynamic -lexecinfo
LDFLAGS := $(LDFLAGS) $(AHFLAGS) $(LDFLAGS_CHECK)
LDFLAGS-L = -L
LDFLAGS-l = -l
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c
index 20b845ccb..4331fa715 100644
--- a/core/src/xmake/engine.c
+++ b/core/src/xmake/engine.c
@@ -52,7 +52,7 @@
*/
#if defined(TB_CONFIG_OS_LINUX)
# define XM_PROC_SELF_FILE "/proc/self/exe"
-#elif defined(TB_CONFIG_OS_BSD)
+#elif defined(TB_CONFIG_OS_BSD) && !defined(__OpenBSD__)
# if defined(__FreeBSD__)
# define XM_PROC_SELF_FILE "/proc/curproc/file"
# elif defined(__NetBSD__)
diff --git a/core/src/xmake/os/cpuinfo.c b/core/src/xmake/os/cpuinfo.c
index 2cbb931ce..1e7753940 100644
--- a/core/src/xmake/os/cpuinfo.c
+++ b/core/src/xmake/os/cpuinfo.c
@@ -185,7 +185,7 @@ static tb_float_t xm_os_cpuinfo_usagerate()
}
}
return usagerate;
-#elif defined(TB_CONFIG_OS_BSD)
+#elif defined(TB_CONFIG_OS_BSD) && !defined(__OpenBSD__)
# define CP_USER 0
# define CP_NICE 1
# define CP_SYS 2
diff --git a/core/src/xmake/os/meminfo.c b/core/src/xmake/os/meminfo.c
index cd9ace234..b3bb435cd 100644
--- a/core/src/xmake/os/meminfo.c
+++ b/core/src/xmake/os/meminfo.c
@@ -135,7 +135,7 @@ static tb_bool_t xm_os_meminfo_stats(tb_int_t* ptotalsize, tb_int_t* pavailsize)
*pavailsize = (tb_int_t)(statex.ullAvailPhys / (1024 * 1024));
return tb_true;
}
-#elif defined(TB_CONFIG_OS_BSD)
+#elif defined(TB_CONFIG_OS_BSD) && !defined(__OpenBSD__)
unsigned long totalsize;
size_t size = sizeof(totalsize);
if (sysctlbyname("hw.physmem", &totalsize, &size, tb_null, 0) != 0)
diff --git a/scripts/srcenv.profile b/scripts/srcenv.profile
index ead66b4f8..c673b2636 100755
--- a/scripts/srcenv.profile
+++ b/scripts/srcenv.profile
@@ -2,8 +2,10 @@
export XMAKE_PROGRAM_DIR=`pwd`/xmake
if [ -f `pwd`/core/build/xmake ]; then
alias xmake=`pwd`/core/build/xmake
+ export XMAKE_PROGRAM_FILE=`pwd`/core/build/xmake
else
alias xmake=`pwd`/core/src/demo/demo.b
+ export XMAKE_PROGRAM_FILE=`pwd`/core/src/demo/demo.b
fi
alias xrepo=`pwd`/scripts/xrepo.sh
xmake --version