Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,255 @@
|
||||
From 2ae2137d724d5f3a70d5d2856cb979d389c4cbd8 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Fri, 12 Jul 2024 21:30:43 +0200
|
||||
Subject: [PATCH] src/CMakeLists.txt: don't build shared libraries when not
|
||||
enabled
|
||||
|
||||
BUILD_SHARED_LIBS is a standard CMake option [1] that specifies
|
||||
whether shared libraries should be built or not. This commit adjusts
|
||||
src/CMakeLists.txt to observe this variable to decide whether the
|
||||
shared library variant should be built or not. This allows check to
|
||||
only build a static library in environments where only a static
|
||||
library can be compiled.
|
||||
|
||||
This needs a bit of refactoring to avoid duplication:
|
||||
|
||||
- Additional source files from libcompat are directly added to the
|
||||
${SOURCES} variable as needed
|
||||
|
||||
- Additional libraries are collected into ${ADDITIONAL_LIBS} before
|
||||
being associated to the static library and shared library (if enabled)
|
||||
|
||||
[1] https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
|
||||
|
||||
Fixes:
|
||||
|
||||
__uClibc_main.c:(.text+0x12c): undefined reference to `__fini_array_end'
|
||||
/home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x130): undefined reference to `__fini_array_start'
|
||||
/home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x134): undefined reference to `__fini_array_end'
|
||||
|
||||
Upstream: https://github.com/libcheck/check/pull/355
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
src/CMakeLists.txt | 137 ++++++++++++++++++++++-----------------------
|
||||
1 file changed, 67 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 4a02dbe..e0cf32b 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -31,117 +31,106 @@ set(SOURCES
|
||||
check_run.c
|
||||
check_str.c)
|
||||
|
||||
-set(HEADERS
|
||||
- ${CONFIG_HEADER}
|
||||
- ${CMAKE_CURRENT_BINARY_DIR}/check.h
|
||||
- check.h.in
|
||||
- check_error.h
|
||||
- check_impl.h
|
||||
- check_list.h
|
||||
- check_log.h
|
||||
- check_msg.h
|
||||
- check_pack.h
|
||||
- check_print.h
|
||||
- check_str.h)
|
||||
-
|
||||
-configure_file(check.h.in check.h @ONLY)
|
||||
-
|
||||
-# To maintain compatibility with the Autotools installation
|
||||
-# we specifically create both shared and static libraries
|
||||
-# as that is what Autotools script has been doing.
|
||||
-# Normally CMake would create the system's native default library type.
|
||||
-
|
||||
-add_library(check STATIC ${SOURCES} ${HEADERS})
|
||||
-add_library(Check::check ALIAS check)
|
||||
-
|
||||
-
|
||||
-# We would like to create an OBJECT library but currently they are
|
||||
-# too unreliable and cumbersome,
|
||||
-# especially with target_link_libraries and install(EXPORT...
|
||||
-# https://stackoverflow.com/questions/38832528/transitive-target-include-directories-on-object-libraries
|
||||
-# So we instead do the work twice.
|
||||
-add_library(checkShared SHARED ${SOURCES} ${HEADERS})
|
||||
-add_library(Check::checkShared ALIAS checkShared)
|
||||
-
|
||||
# Add parts of libcompat as required
|
||||
-target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/fpclassify.c)
|
||||
-target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/fpclassify.c)
|
||||
+list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/fpclassify.c)
|
||||
|
||||
if (NOT HAVE_LIBRT)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/clock_gettime.c)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_create.c)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_delete.c)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_settime.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/clock_gettime.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_create.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_delete.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_settime.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/clock_gettime.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_create.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_delete.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/timer_settime.c)
|
||||
endif(NOT HAVE_LIBRT)
|
||||
|
||||
if(NOT HAVE_GETLINE)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/getline.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/getline.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/getline.c)
|
||||
endif(NOT HAVE_GETLINE)
|
||||
|
||||
if(NOT HAVE_GETTIMEOFDAY)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/gettimeofday.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/gettimeofday.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/gettimeofday.c)
|
||||
endif(NOT HAVE_GETTIMEOFDAY)
|
||||
|
||||
if(NOT HAVE_DECL_LOCALTIME_R)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/localtime_r.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/localtime_r.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/localtime_r.c)
|
||||
endif(NOT HAVE_DECL_LOCALTIME_R)
|
||||
|
||||
if(NOT HAVE_MALLOC)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/malloc.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/malloc.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/malloc.c)
|
||||
endif(NOT HAVE_MALLOC)
|
||||
|
||||
if(NOT HAVE_REALLOC)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/realloc.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/realloc.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/realloc.c)
|
||||
endif(NOT HAVE_REALLOC)
|
||||
|
||||
if(NOT HAVE_SNPRINTF)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/snprintf.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/snprintf.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/snprintf.c)
|
||||
endif(NOT HAVE_SNPRINTF)
|
||||
|
||||
if(NOT HAVE_DECL_STRDUP AND NOT HAVE__STRDUP)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/strdup.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/snprintf.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/strdup.c)
|
||||
endif(NOT HAVE_DECL_STRDUP AND NOT HAVE__STRDUP)
|
||||
|
||||
if(NOT HAVE_DECL_STRSIGNAL)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/strsignal.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/strsignal.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/strsignal.c)
|
||||
endif(NOT HAVE_DECL_STRSIGNAL)
|
||||
|
||||
if(NOT HAVE_DECL_ALARM)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/alarm.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/alarm.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/alarm.c)
|
||||
endif(NOT HAVE_DECL_ALARM)
|
||||
|
||||
if(NOT HAVE_PTHREAD)
|
||||
- target_sources(check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pthread_mutex.c)
|
||||
- target_sources(checkShared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pthread_mutex.c)
|
||||
+ list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../lib/pthread_mutex.c)
|
||||
endif()
|
||||
|
||||
+set(HEADERS
|
||||
+ ${CONFIG_HEADER}
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/check.h
|
||||
+ check.h.in
|
||||
+ check_error.h
|
||||
+ check_impl.h
|
||||
+ check_list.h
|
||||
+ check_log.h
|
||||
+ check_msg.h
|
||||
+ check_pack.h
|
||||
+ check_print.h
|
||||
+ check_str.h)
|
||||
+
|
||||
+configure_file(check.h.in check.h @ONLY)
|
||||
+
|
||||
+# To maintain compatibility with the Autotools installation
|
||||
+# we specifically create both shared and static libraries
|
||||
+# as that is what Autotools script has been doing.
|
||||
+# Normally CMake would create the system's native default library type.
|
||||
+
|
||||
+add_library(check STATIC ${SOURCES} ${HEADERS})
|
||||
+add_library(Check::check ALIAS check)
|
||||
+
|
||||
+# We would like to create an OBJECT library but currently they are
|
||||
+# too unreliable and cumbersome,
|
||||
+# especially with target_link_libraries and install(EXPORT...
|
||||
+# https://stackoverflow.com/questions/38832528/transitive-target-include-directories-on-object-libraries
|
||||
+# So we instead do the work twice.
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
+ add_library(checkShared SHARED ${SOURCES} ${HEADERS})
|
||||
+ add_library(Check::checkShared ALIAS checkShared)
|
||||
+endif (BUILD_SHARED_LIBS)
|
||||
+
|
||||
# Include libraries if available
|
||||
if (HAVE_LIBM)
|
||||
- target_link_libraries(check PUBLIC m)
|
||||
- target_link_libraries(checkShared PUBLIC m)
|
||||
+ list(APPEND ADDITIONAL_LIBS m)
|
||||
endif (HAVE_LIBM)
|
||||
if (HAVE_LIBRT)
|
||||
- target_link_libraries(check PUBLIC rt)
|
||||
- target_link_libraries(checkShared PUBLIC rt)
|
||||
+ list(APPEND ADDITIONAL_LIBS rt)
|
||||
endif (HAVE_LIBRT)
|
||||
if (HAVE_SUBUNIT)
|
||||
- target_link_libraries(check PUBLIC subunit)
|
||||
- target_link_libraries(checkShared PUBLIC subunit)
|
||||
+ list(APPEND ADDITIONAL_LIBS subunit)
|
||||
endif (HAVE_SUBUNIT)
|
||||
|
||||
+target_link_libraries(check PUBLIC ${ADDITIONAL_LIBS})
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
+ target_link_libraries(checkShared PUBLIC m)
|
||||
+endif (BUILD_SHARED_LIBS)
|
||||
+
|
||||
+
|
||||
if(MSVC)
|
||||
target_compile_definitions(checkShared
|
||||
PRIVATE "CK_DLL_EXP=_declspec(dllexport)"
|
||||
@@ -168,27 +157,35 @@ if (MSVC)
|
||||
# So we call it this:
|
||||
set(LIBRARY_OUTPUT_NAME "checkDynamic")
|
||||
endif (MSVC)
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
set_target_properties(checkShared PROPERTIES
|
||||
OUTPUT_NAME ${LIBRARY_OUTPUT_NAME}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
PUBLIC_HEADER "${public_headers}"
|
||||
)
|
||||
+endif (BUILD_SHARED_LIBS)
|
||||
target_include_directories(check
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
target_include_directories(checkShared
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
-)
|
||||
+ )
|
||||
+endif (BUILD_SHARED_LIBS)
|
||||
|
||||
if(NOT THIS_IS_SUBPROJECT)
|
||||
- install(TARGETS check checkShared
|
||||
+ if (BUILD_SHARED_LIBS)
|
||||
+ set(SHARED_LIBNAME checkShared)
|
||||
+ endif ()
|
||||
+
|
||||
+ install(TARGETS check ${SHARED_LIBNAME}
|
||||
EXPORT check-targets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
From c9bebf051aa7e3037ca8e0fe554e073204ffedde Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Fri, 12 Jul 2024 21:27:47 +0200
|
||||
Subject: [PATCH] src/check_run.c: fix build on noMMU platforms
|
||||
|
||||
src/check_run.c defines sig_handler() under the following conditions:
|
||||
|
||||
#if defined(HAVE_FORK) && HAVE_FORK==1
|
||||
|
||||
however, it does use sig_handler under the following conditions:
|
||||
|
||||
#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
|
||||
|
||||
which breaks when HAVE_FORK is defined, but has the value HAVE_FORK=0,
|
||||
as is the case on noMMU platforms.
|
||||
|
||||
This commit fixes this by ensuring that the build conditions are
|
||||
aligned throughout check_run.c.
|
||||
|
||||
Fixes:
|
||||
|
||||
src/check_run.c: In function 'srunner_run_tagged':
|
||||
src/check_run.c:802:38: error: 'sig_handler' undeclared (first use in this function); did you mean 'sa_handler'?
|
||||
[...]
|
||||
|
||||
Upstream: https://github.com/libcheck/check/pull/354
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
src/check_run.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/check_run.c b/src/check_run.c
|
||||
index 5f160e5..4c370b3 100644
|
||||
--- a/src/check_run.c
|
||||
+++ b/src/check_run.c
|
||||
@@ -772,12 +772,12 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname,
|
||||
const char *include_tags, const char *exclude_tags,
|
||||
enum print_output print_mode)
|
||||
{
|
||||
-#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
|
||||
+#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1
|
||||
static struct sigaction sigalarm_old_action;
|
||||
static struct sigaction sigalarm_new_action;
|
||||
static struct sigaction sigint_new_action;
|
||||
static struct sigaction sigterm_new_action;
|
||||
-#endif /* HAVE_SIGACTION && HAVE_FORK */
|
||||
+#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */
|
||||
|
||||
/* Get the selected test suite and test case from the
|
||||
environment. */
|
||||
@@ -797,7 +797,7 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname,
|
||||
eprintf("Bad print_mode argument to srunner_run_all: %d",
|
||||
__FILE__, __LINE__, print_mode);
|
||||
}
|
||||
-#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
|
||||
+#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1
|
||||
memset(&sigalarm_new_action, 0, sizeof(sigalarm_new_action));
|
||||
sigalarm_new_action.sa_handler = sig_handler;
|
||||
sigaction(SIGALRM, &sigalarm_new_action, &sigalarm_old_action);
|
||||
@@ -809,16 +809,16 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname,
|
||||
memset(&sigterm_new_action, 0, sizeof(sigterm_new_action));
|
||||
sigterm_new_action.sa_handler = sig_handler;
|
||||
sigaction(SIGTERM, &sigterm_new_action, &sigterm_old_action);
|
||||
-#endif /* HAVE_SIGACTION && HAVE_FORK */
|
||||
+#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */
|
||||
srunner_run_init(sr, print_mode);
|
||||
srunner_iterate_suites(sr, sname, tcname, include_tags, exclude_tags,
|
||||
print_mode);
|
||||
srunner_run_end(sr, print_mode);
|
||||
-#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
|
||||
+#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1
|
||||
sigaction(SIGALRM, &sigalarm_old_action, NULL);
|
||||
sigaction(SIGINT, &sigint_old_action, NULL);
|
||||
sigaction(SIGTERM, &sigterm_old_action, NULL);
|
||||
-#endif /* HAVE_SIGACTION && HAVE_FORK */
|
||||
+#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */
|
||||
}
|
||||
|
||||
void srunner_run(SRunner * sr, const char *sname, const char *tcname,
|
||||
--
|
||||
2.45.2
|
||||
|
||||
6
package/check/Config.in
Normal file
6
package/check/Config.in
Normal file
@@ -0,0 +1,6 @@
|
||||
config BR2_PACKAGE_CHECK
|
||||
bool "check"
|
||||
help
|
||||
Check is a unit testing framework for C.
|
||||
|
||||
https://libcheck.github.io/check/
|
||||
4
package/check/check.hash
Normal file
4
package/check/check.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# Locally computed
|
||||
sha256 20e7360f5774844c09fde696e5bf71d061e9f53b3d763d886d3318d8893fdda4 check-11970a7e112dfe243a2e68773f014687df2900e8.tar.gz
|
||||
# License files, locally calculated
|
||||
sha256 a9bdde5616ecdd1e980b44f360600ee8783b1f99b8cc83a2beb163a0a390e861 COPYING.LESSER
|
||||
17
package/check/check.mk
Normal file
17
package/check/check.mk
Normal file
@@ -0,0 +1,17 @@
|
||||
################################################################################
|
||||
#
|
||||
# check
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# This is the same as tag 0.15.2, but we can't use it, as to avoid conflict
|
||||
# with the released tarball that was incomplete
|
||||
CHECK_VERSION = 11970a7e112dfe243a2e68773f014687df2900e8
|
||||
CHECK_SITE = $(call github,libcheck,check,$(CHECK_VERSION))
|
||||
CHECK_INSTALL_STAGING = YES
|
||||
CHECK_DEPENDENCIES = host-pkgconf
|
||||
CHECK_LICENSE = LGPL-2.1+
|
||||
CHECK_LICENSE_FILES = COPYING.LESSER
|
||||
CHECK_CONF_OPTS = -DBUILD_TESTING=OFF -DINSTALL_CHECKMK=OFF
|
||||
|
||||
$(eval $(cmake-package))
|
||||
Reference in New Issue
Block a user