From ce3e71cb8e57ca9dbaaa3a7e80da9335fe592e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kr=C3=BCger?= <45282134+UweKrueger@users.noreply.github.com> Date: Tue, 1 Jun 2021 21:28:30 +0200 Subject: [PATCH] OpenBSD: support Boehm-GC, X11 and Sqlite (#10300) --- vlib/builtin/builtin_d_gcboehm.v | 10 +++++++++- vlib/builtin/builtin_nix.c.v | 2 +- vlib/clipboard/x11/clipboard.c.v | 10 ++++++++-- vlib/sqlite/sqlite.v | 24 +++++++++++++----------- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/vlib/builtin/builtin_d_gcboehm.v b/vlib/builtin/builtin_d_gcboehm.v index f6a6bc88b7..397d9b7811 100644 --- a/vlib/builtin/builtin_d_gcboehm.v +++ b/vlib/builtin/builtin_d_gcboehm.v @@ -8,18 +8,26 @@ $if static_boehm ? { #flag $first_existing("/opt/homebrew/lib/libgc.a", "/usr/local/lib/libgc.a") } $else $if linux { #flag -l:libgc.a + } $else $if openbsd { + #flag -I/usr/local/include + #flag /usr/local/lib/libgc.a + #flag -lpthread } $else { #flag -lgc } } $else { $if macos { #pkgconfig bdw-gc + } $else $if openbsd || freebsd { + #flag -I/usr/local/include + #flag -L/usr/local/lib } $if windows { #flag -I@VEXEROOT/thirdparty/libgc/include #flag -L@VEXEROOT/thirdparty/libgc + } $else { + #flag -lgc } - #flag -lgc } $if gcboehm_leak ? { diff --git a/vlib/builtin/builtin_nix.c.v b/vlib/builtin/builtin_nix.c.v index ba44219ac0..1d1cf0d02b 100644 --- a/vlib/builtin/builtin_nix.c.v +++ b/vlib/builtin/builtin_nix.c.v @@ -85,7 +85,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool { $if no_backtrace ? { return false } $else { - $if !freestanding { + $if linux && !freestanding { $if tinyc { C.tcc_backtrace(c'Backtrace') return false diff --git a/vlib/clipboard/x11/clipboard.c.v b/vlib/clipboard/x11/clipboard.c.v index f8d0c8874b..d5a4656a7f 100644 --- a/vlib/clipboard/x11/clipboard.c.v +++ b/vlib/clipboard/x11/clipboard.c.v @@ -6,9 +6,15 @@ import time import sync import math +$if freebsd { + #flag -I/usr/local/include + #flag -L/usr/local/lib +} $else $if openbsd { + #flag -I/usr/X11R6/include + #flag -L/usr/X11R6/lib +} #flag -lX11 -#flag freebsd -I/usr/local/include -#flag freebsd -L/usr/local/lib -lX11 + #include # Please install a package with the X11 development headers, for example: `apt-get install libx11-dev` // X11 [typedef] diff --git a/vlib/sqlite/sqlite.v b/vlib/sqlite/sqlite.v index 05d9b82f48..a915b988b3 100644 --- a/vlib/sqlite/sqlite.v +++ b/vlib/sqlite/sqlite.v @@ -1,17 +1,19 @@ module sqlite -#flag darwin -lsqlite3 -#flag linux -lsqlite3 -#flag solaris -lsqlite3 -#flag freebsd -I/usr/local/include -#flag freebsd -Wl -L/usr/local/lib -lsqlite3 -#flag windows -I@VEXEROOT/thirdparty/sqlite -#flag windows -L@VEXEROOT/thirdparty/sqlite -#flag windows @VEXEROOT/thirdparty/sqlite/sqlite3.o -// #flag linux -I @VEXEROOT/thirdparty/sqlite -// #flag @VEXEROOT/thirdparty/sqlite/sqlite.c +$if freebsd || openbsd { + #flag -I/usr/local/include + #flag -L/usr/local/lib +} +$if windows { + #flag windows -I@VEXEROOT/thirdparty/sqlite + #flag windows -L@VEXEROOT/thirdparty/sqlite + #flag windows @VEXEROOT/thirdparty/sqlite/sqlite3.o +} $else { + #flag -lsqlite3 +} + #include "sqlite3.h" -// + struct C.sqlite3 { }