Skip to content

Commit c684ab9

Browse files
benlangmuirrokhinip
authored andcommitted
Revert "Remove libbsd dependency for Linux"
Signed-off-by: Kim Topley <[email protected]>
1 parent 89f8898 commit c684ab9

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ check_function_exists(strlcpy HAVE_STRLCPY)
197197
check_function_exists(sysconf HAVE_SYSCONF)
198198
check_function_exists(arc4random HAVE_ARC4RANDOM)
199199

200+
if(NOT HAVE_STRLCPY AND NOT HAVE_GETPROGNAME)
201+
include(FindPkgConfig)
202+
pkg_check_modules(BSD_OVERLAY libbsd-overlay)
203+
if(BSD_OVERLAY_FOUND)
204+
set(HAVE_STRLCPY 1 CACHE INTERNAL "Have function strlcpy" FORCE)
205+
set(HAVE_GETPROGNAME 1 CACHE INTERNAL "Have function getprogname" FORCE)
206+
endif()
207+
endif()
208+
200209
find_package(Threads REQUIRED)
201210

202211
check_include_files("TargetConditionals.h" HAVE_TARGETCONDITIONALS_H)

src/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Android)
204204
PRIVATE
205205
-U_GNU_SOURCE)
206206
endif()
207+
if(BSD_OVERLAY_FOUND)
208+
target_compile_options(dispatch
209+
PRIVATE
210+
${BSD_OVERLAY_CFLAGS})
211+
endif()
207212
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
208213
target_compile_options(dispatch
209214
PRIVATE
@@ -225,6 +230,9 @@ else()
225230
-fblocks
226231
-momit-leaf-frame-pointer)
227232
endif()
233+
if(BSD_OVERLAY_FOUND)
234+
target_link_libraries(dispatch PRIVATE ${BSD_OVERLAY_LDFLAGS})
235+
endif()
228236
if(LibRT_FOUND)
229237
target_link_libraries(dispatch PRIVATE RT::rt)
230238
endif()

src/internal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,8 @@ upcast(dispatch_object_t dou)
282282
#include <linux/sysctl.h>
283283
#else
284284
#include <sys/sysctl.h>
285-
#endif /* __ANDROID__ */
286-
#if !defined(__linux__)
287285
#include <sys/queue.h>
288-
#endif
286+
#endif /* __ANDROID__ */
289287
#include <sys/socket.h>
290288
#include <sys/time.h>
291289
#include <sys/mman.h>

src/shims.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "shims/generic_win_stubs.h"
3434
#endif // defined(_WIN32)
3535

36-
#if defined(_WIN32) || defined(__linux__)
36+
#if defined(_WIN32) || defined(__ANDROID__)
3737
#include "shims/generic_sys_queue.h"
3838
#endif
3939

File renamed without changes.

0 commit comments

Comments
 (0)