Skip to content

Commit 471d155

Browse files
committed
build: add support for OpenBSD to depends
1 parent 75ae39e commit 471d155

File tree

10 files changed

+89
-0
lines changed

10 files changed

+89
-0
lines changed

Diff for: depends/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))
7777
build_os:=$(findstring linux,$(full_build_os))
7878
build_os+=$(findstring darwin,$(full_build_os))
7979
build_os+=$(findstring freebsd,$(full_build_os))
80+
build_os+=$(findstring openbsd,$(full_build_os))
8081
build_os:=$(strip $(build_os))
8182
ifeq ($(build_os),)
8283
build_os=$(full_build_os)
@@ -88,6 +89,7 @@ full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host))
8889
host_os:=$(findstring linux,$(full_host_os))
8990
host_os+=$(findstring darwin,$(full_host_os))
9091
host_os+=$(findstring freebsd,$(full_host_os))
92+
host_os+=$(findstring openbsd,$(full_host_os))
9193
host_os+=$(findstring mingw32,$(full_host_os))
9294

9395
ifeq (android,$(findstring android,$(full_host_os)))

Diff for: depends/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ For linux S390X cross compilation:
8484

8585
sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu
8686

87+
### Install the required dependencies: OpenBSD
88+
89+
pkg_add bash gtar
90+
8791
### Dependency Options
8892

8993
The following can be set when running make: `make FOO=bar`

Diff for: depends/builders/openbsd.mk

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build_openbsd_CC = clang
2+
build_openbsd_CXX = clang++
3+
4+
build_openbsd_SHA256SUM = sha256
5+
build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
6+
7+
build_openbsd_TAR = gtar

Diff for: depends/hosts/openbsd.mk

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
openbsd_CFLAGS=-pipe
2+
openbsd_CFLAGS_CXXFLAGS=$(openbsd_CFLAGS)
3+
4+
openbsd_CFLAGS_release_CFLAGS=-O2
5+
openbsd_CFLAGS_release_CXXFLAGS=$(openbsd_release_CFLAGS)
6+
7+
openbsd_CFLAGS_debug_CFLAGS=-O1
8+
openbsd_CFLAGS_debug_CXXFLAGS=$(openbsd_debug_CFLAGS)
9+
10+
ifeq (86,$(findstring 86,$(build_arch)))
11+
i686_openbsd_CC=clang -m32
12+
i686_openbsd_CXX=clang++ -m32
13+
i686_openbsd_AR=ar
14+
i686_openbsd_RANLIB=ranlib
15+
i686_openbsd_NM=nm
16+
i686_openbsd_STRIP=strip
17+
18+
x86_64_openbsd_CC=clang -m64
19+
x86_64_openbsd_CXX=clang++ -m64
20+
x86_64_openbsd_AR=ar
21+
x86_64_openbsd_RANLIB=ranlib
22+
x86_64_openbsd_NM=nm
23+
x86_64_openbsd_STRIP=strip
24+
else
25+
i686_openbsd_CC=$(default_host_CC) -m32
26+
i686_openbsd_CXX=$(default_host_CXX) -m32
27+
x86_64_openbsd_CC=$(default_host_CC) -m64
28+
x86_64_openbsd_CXX=$(default_host_CXX) -m64
29+
endif
30+
31+
openbsd_cmake_system=OpenBSD

Diff for: depends/packages/bdb.mk

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --ena
1111
$(package)_config_opts_mingw32=--enable-mingw
1212
$(package)_config_opts_linux=--with-pic
1313
$(package)_config_opts_freebsd=--with-pic
14+
$(package)_config_opts_openbsd=--with-pic
1415
$(package)_config_opts_android=--with-pic
1516
$(package)_cflags+=-Wno-error=implicit-function-declaration
1617
$(package)_cxxflags+=-std=c++17

Diff for: depends/packages/boost.mk

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$(su
44
$(package)_file_name=boost_$($(package)_version).tar.bz2
55
$(package)_sha256_hash=d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee
66
$(package)_dependencies=native_b2
7+
$(package)_patches=fix_openbsd_test_lib.patch
78

89
define $(package)_set_vars
910
$(package)_config_opts_release=variant=release
@@ -26,11 +27,13 @@ $(package)_config_libraries=test
2627
$(package)_cxxflags+=-std=c++17
2728
$(package)_cxxflags_linux=-fPIC
2829
$(package)_cxxflags_freebsd=-fPIC
30+
$(package)_cxxflags_openbsd=-fPIC
2931
$(package)_cxxflags_android=-fPIC
3032
$(package)_cxxflags_x86_64=-fcf-protection=full
3133
endef
3234

3335
define $(package)_preprocess_cmds
36+
patch -p1 < $($(package)_patch_dir)/fix_openbsd_test_lib.patch && \
3437
echo "using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : <cflags>\"$($(package)_cflags)\" <cxxflags>\"$($(package)_cxxflags)\" <compileflags>\"$($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$($(package)_ar)\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
3538
endef
3639

Diff for: depends/packages/libevent.mk

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ define $(package)_set_vars
1313
$(package)_config_opts_release=--disable-debug-mode
1414
$(package)_config_opts_linux=--with-pic
1515
$(package)_config_opts_freebsd=--with-pic
16+
$(package)_config_opts_openbsd=--with-pic
1617
$(package)_config_opts_android=--with-pic
1718
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
1819
endef

Diff for: depends/packages/sqlite.mk

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ define $(package)_set_vars
88
$(package)_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking
99
$(package)_config_opts_linux=--with-pic
1010
$(package)_config_opts_freebsd=--with-pic
11+
$(package)_config_opts_openbsd=--with-pic
1112
endef
1213

1314
define $(package)_preprocess_cmds

Diff for: depends/packages/zeromq.mk

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ define $(package)_set_vars
1313
$(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking
1414
$(package)_config_opts_linux=--with-pic
1515
$(package)_config_opts_freebsd=--with-pic
16+
$(package)_config_opts_openbsd=--with-pic
1617
$(package)_config_opts_android=--with-pic
1718
$(package)_cxxflags+=-std=c++17
1819
endef

Diff for: depends/patches/boost/fix_openbsd_test_lib.patch

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
commit 684f067dde3b798877655cdda4eab8d7c26b2510
2+
Author: George Koehler <[email protected]>
3+
Date: Thu Oct 3 20:06:38 2019 -0400
4+
5+
OpenBSD is missing SI_ASYNCIO and SI_MESGQ
6+
7+
Check if SI_ASYNCIO and SI_MESGQ are defined as macros. This allows
8+
to run tests on OpenBSD 6.5, where the macros are missing.
9+
10+
This is identical to patch-boost_test_impl_execution_monitor_ipp in
11+
OpenBSD Ports, except that I added a comment.
12+
13+
Can be removed when we use Boost 1.72.x or later.
14+
15+
diff --git a/boost/test/impl/execution_monitor.ipp b/boost/test/impl/execution_monitor.ipp
16+
index ccc44972..77a01e21 100644
17+
--- a/boost/test/impl/execution_monitor.ipp
18+
+++ b/boost/test/impl/execution_monitor.ipp
19+
@@ -391,14 +391,19 @@ system_signal_exception::report() const
20+
report_error( execution_exception::system_error,
21+
"signal: the expiration of a timer set by timer_settimer()" );
22+
break;
23+
+// OpenBSD was missing SI_ASYNCIO and SI_MESGQ
24+
+#ifdef SI_ASYNCIO
25+
case SI_ASYNCIO:
26+
report_error( execution_exception::system_error,
27+
"signal: generated by the completion of an asynchronous I/O request" );
28+
break;
29+
+#endif
30+
+#ifdef SI_MESGQ
31+
case SI_MESGQ:
32+
report_error( execution_exception::system_error,
33+
"signal: generated by the the arrival of a message on an empty message queue" );
34+
break;
35+
+#endif
36+
default:
37+
break;
38+
}

0 commit comments

Comments
 (0)