Skip to content

Commit ac37f19

Browse files
committed
Merge remote-tracking branch 'github-pull/32/head' into 20250627-02x-mergedup
2 parents 8a80988 + 74fc11d commit ac37f19

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

.github/workflows/build.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- clearlinux:latest
2626
- gentoo/stage3:musl-hardened
2727
- gentoo/stage3:hardened
28+
- freebsd
2829
config:
2930
- cmake_args: "-DENABLE_API=ON -DCMAKE_C_COMPILER=gcc"
3031
- cmake_args: "-DENABLE_API=ON -DCMAKE_C_COMPILER=clang"
@@ -52,6 +53,7 @@ jobs:
5253
${{ matrix.os }}/pkg-cache/
5354
5455
- name: Build inside Docker
56+
if: "!startsWith(matrix.os, 'freebsd')"
5557
id: docker-build
5658
run: |
5759
PKG_CACHE_DIR=/pkg-cache
@@ -167,3 +169,22 @@ jobs:
167169
with:
168170
path: pkg-cache
169171
key: ${{ matrix.os }}/pkg-cache/${{ matrix.config.cmake_args }}/${{ github.sha }}
172+
173+
- name: Build inside FreeBSD VM
174+
if: startsWith(matrix.os, 'freebsd')
175+
uses: vmactions/freebsd-vm@v1
176+
with:
177+
prepare: |
178+
PACKAGES="git cmake pkgconf curl jansson libsodium libmicrohttpd argp-standalone libepoll-shim"
179+
if echo "${{ matrix.config.cmake_args }}" | grep -q "CMAKE_C_COMPILER=gcc"; then
180+
PACKAGES="$PACKAGES gcc"
181+
fi
182+
pkg install -y $PACKAGES
183+
184+
run: |
185+
git config --global --add safe.directory ${{ github.workspace }}
186+
mkdir -p build
187+
cd build
188+
cmake ${{ github.workspace }} -DCMAKE_C_FLAGS='-Wall -Werror' ${{ matrix.config.cmake_args }}
189+
make
190+
./datum_gateway --help

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,24 @@ set(ARGP_LIBS "")
7676
check_function_exists(argp_parse HAVE_ARGP_PARSE)
7777
if(NOT HAVE_ARGP_PARSE)
7878
check_library_exists(argp argp_parse "" ARGP)
79+
if(NOT ARGP AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
80+
# Workaround bug where CMake doesn't check the standard install location on FreeBSD
81+
unset(ARGP CACHE)
82+
check_library_exists(argp argp_parse "/usr/local/lib" ARGP)
83+
endif()
7984
if(ARGP)
8085
list(APPEND ARGP_LIBS "argp")
8186
endif()
8287
endif()
8388

89+
check_function_exists(epoll_wait HAVE_EPOLL_WAIT)
90+
if(HAVE_EPOLL_WAIT)
91+
set(EPOLL_SHIM_INCLUDE_DIRS "")
92+
set(EPOLL_SHIM_LIBRARIES "")
93+
else()
94+
pkg_check_modules(EPOLL_SHIM REQUIRED epoll-shim)
95+
endif()
96+
8497
cmake_pop_check_state()
8598

8699
add_custom_target(generate_git_version
@@ -102,6 +115,7 @@ add_custom_command(
102115
target_include_directories(datum_gateway
103116
PRIVATE
104117
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
118+
${EPOLL_SHIM_INCLUDE_DIRS}
105119
${CURL_INCLUDE_DIRS}
106120
${JANSSON_INCLUDE_DIRS}
107121
${SODIUM_INCLUDE_DIRS}
@@ -117,6 +131,7 @@ target_link_libraries(datum_gateway
117131
${POW_LIBS}
118132
Threads::Threads
119133
${ARGP_LIBS}
134+
${EPOLL_SHIM_LIBRARIES}
120135
${CURL_LIBRARIES} ${CURL_LDFLAGS} ${CURL_LDFLAGS_OTHER}
121136
${JANSSON_LIBRARIES} ${JANSSON_LDFLAGS} ${JANSSON_LDFLAGS_OTHER}
122137
${SODIUM_LIBRARIES} ${SODIUM_LDFLAGS} ${SODIUM_LDFLAGS_OTHER}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ For Clear Linux:
122122

123123
sudo swupd bundle-add c-basic cmake pkgconf devpkg-curl devpkg-jansson devpkg-libsodium devpkg-libmicrohttpd psmisc
124124

125+
For FreeBSD:
126+
127+
sudo pkg install cmake pkgconf curl jansson libsodium libmicrohttpd argp-standalone libepoll-shim
128+
125129
Compile DATUM by running:
126130

127131
cmake . && make

src/datum_protocol.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <sys/time.h>
6464
#include <pthread.h>
6565
#include <netinet/tcp.h>
66+
#include <netinet/in.h>
6667
#include <inttypes.h>
6768

6869
#include "datum_utils.h"

0 commit comments

Comments
 (0)