Skip to content

Commit 032d310

Browse files
committed
[.dockerignore] Init ; [*] Fix Linux build (tested on Alpine & Debian with Docker) ; [acquire/tests/test_string_extras.h] Remove hack that tried to fix debian ; [acquire/tests/test_extract.h] Fix malformed macro that gcc on debian picked up ; [cmake/FindLibBSD.cmake] Add more hints so that it's found on debian ; [debian.Dockerfile] Add libbsd-dev dependency
1 parent 0453696 commit 032d310

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

acquire/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ else ()
281281
target_compile_definitions(
282282
"${LIBRARY_NAME}_impl" PUBLIC HAVE_LIBBSD=1 HAVE_STRNSTR=1
283283
)
284+
message(STATUS "libbsd found")
285+
else ()
286+
message(STATUS "No libbsd found")
284287
endif (LibBSD_FOUND)
285288
endif (NOT BSD)
286289

@@ -307,6 +310,7 @@ else ()
307310
target_link_libraries("${LIBRARY_NAME}" PUBLIC "${LIBRARY_NAME}_impl")
308311
set(lib_vis "PUBLIC")
309312

313+
list(REMOVE_ITEM LIBACQUIRE_LIBRARIES "${CHECKSUM_LIBRARIES}" "${EXTRACT_LIB}" "lib${EXTRACT_LIB}")
310314
foreach (_lib ${LIBACQUIRE_LIBRARIES})
311315
target_link_libraries_once("${LIBRARY_NAME}" "${lib_vis}" "${_lib}")
312316
endforeach (_lib ${LIBACQUIRE_LIBRARIES})

acquire/tests/test_extract.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <acquire_libarchive.h>
2525
#else
2626
#error \
27-
"ARCHIVE_LIB must be defined to the backend name (e.g. miniz or libarchive)
28-
or USE_MINIZ or USE_LIBARCHIVE must be defined"
27+
"ARCHIVE_LIB must be defined to the backend name (e.g. miniz or libarchive)" \
28+
"or USE_MINIZ or USE_LIBARCHIVE must be defined";
2929
#endif /* ARCHIVE_LIB */
3030

3131
#include <acquire_common_defs.h>

acquire/tests/test_string_extras.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
#include "config_for_tests.h"
77

8-
#ifdef HAVE_STRNSTR
9-
#undef HAVE_STRNSTR
10-
#endif /* HAVE_STRNSTR */
11-
#ifndef STRNSTR_IMPL
12-
#define STRNSTR_IMPL
13-
#endif /* !STRNSTR_IMPL */
14-
158
#include <acquire_string_extras.h>
169

1710
static const char *buffer = "hello world";

cmake/FindLibBSD.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set(_LIBBSD_HINTS
2626
"/opt"
2727
"/usr"
2828
"/usr/local/include" # Homebrew macOS common prefix
29+
"/usr/include"
2930
)
3031

3132
# Remove empty and duplicate entries
@@ -73,17 +74,35 @@ function(_libbsd_resolve_libraries input_libs output_var)
7374

7475
# If still not found, try to sanitize common library extensions manually
7576
if (NOT _found_path)
77+
if (NOT DEFINED TARGET_ARCH)
78+
include("${CMAKE_SOURCE_DIR}/cmake/get_arch.cmake")
79+
get_arch()
80+
endif (NOT DEFINED TARGET_ARCH)
81+
string(TOLOWER TARGET_ARCH arch)
82+
7683
# try known install path hardcoded — add your known lib path:
7784
foreach (p
7885
"/usr/local/lib/lib${_libname}.dylib"
7986
"/usr/local/lib/lib${_libname}.a"
87+
"/usr/lib/${arch}-linux-gnu/libbsd.so"
88+
"/usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/libbsd.so"
89+
"/usr/lib/x86_64-linux-gnu/libbsd.so"
90+
"/usr/lib/aarch64-linux-gnu/libbsd.so"
91+
"/usr/lib/arm-linux-gnueabihf/libbsd.so"
92+
"/usr/lib/i386-linux-gnu/libbsd.so"
8093
"/usr/lib/libbsd.so")
8194
if (EXISTS "${p}" AND NOT IS_DIRECTORY "${p}")
8295
set(_found_path "${p}")
8396
endif (EXISTS "${p}" AND NOT IS_DIRECTORY "${p}")
8497
endforeach (p
8598
"/usr/local/lib/lib${_libname}.dylib"
8699
"/usr/local/lib/lib${_libname}.a"
100+
"/usr/lib/${arch}-linux-gnu/libbsd.so"
101+
"/usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/libbsd.so"
102+
"/usr/lib/x86_64-linux-gnu/libbsd.so"
103+
"/usr/lib/aarch64-linux-gnu/libbsd.so"
104+
"/usr/lib/arm-linux-gnueabihf/libbsd.so"
105+
"/usr/lib/i386-linux-gnu/libbsd.so"
87106
"/usr/lib/libbsd.so")
88107
endif ()
89108

debian.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN apt-get update -qq && \
55
cmake \
66
gcc \
77
libarchive-dev \
8+
libbsd-dev \
89
libc-dev \
910
libcurl4-openssl-dev \
1011
librhash-dev \

0 commit comments

Comments
 (0)