summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManuel Bentele2020-10-22 12:08:34 +0200
committerManuel Bentele2020-10-22 12:08:34 +0200
commitf9872723efc831827d179c3baf5b9f6c428512c4 (patch)
tree9662cc3071362570a1f4051f0850b41fbdfff246 /src
parent[BUILD] add option to build the dnbd3-server with afl-fuzz support (diff)
downloaddnbd3-f9872723efc831827d179c3baf5b9f6c428512c4.tar.gz
dnbd3-f9872723efc831827d179c3baf5b9f6c428512c4.tar.xz
dnbd3-f9872723efc831827d179c3baf5b9f6c428512c4.zip
[BUILD] add CMake targets to build binary and source packages with CPack
This patch adds the following CMake targets - package - source to build bundeled packages. Those packages contain either all built binary artifacts or all source files for source code distribution. Both CMake targets are available in Release build configuration.
Diffstat (limited to 'src')
-rw-r--r--src/bench/CMakeLists.txt3
-rw-r--r--src/bench/main.c2
-rw-r--r--src/client/CMakeLists.txt3
-rw-r--r--src/client/client.c4
-rw-r--r--src/fuse/CMakeLists.txt3
-rw-r--r--src/fuse/main.c2
-rw-r--r--src/kernel/CMakeLists.txt2
-rw-r--r--src/kernel/dnbd3_main.c4
-rw-r--r--src/server/CMakeLists.txt5
-rw-r--r--src/server/rpc.c5
-rw-r--r--src/server/server.c9
11 files changed, 24 insertions, 18 deletions
diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt
index 57aad92..59a5ef8 100644
--- a/src/bench/CMakeLists.txt
+++ b/src/bench/CMakeLists.txt
@@ -10,4 +10,5 @@ add_executable(dnbd3-bench ${CMAKE_CURRENT_SOURCE_DIR}/connection.c
${CMAKE_CURRENT_SOURCE_DIR}/helper.c
${CMAKE_CURRENT_SOURCE_DIR}/main.c)
target_link_libraries(dnbd3-bench dnbd3-version dnbd3-shared ${CMAKE_THREAD_LIBS_INIT})
-install(TARGETS dnbd3-bench RUNTIME DESTINATION bin)
+install(TARGETS dnbd3-bench RUNTIME DESTINATION bin
+ COMPONENT bench)
diff --git a/src/bench/main.c b/src/bench/main.c
index 1a59747..d195e26 100644
--- a/src/bench/main.c
+++ b/src/bench/main.c
@@ -20,7 +20,7 @@
static void printUsage(char *argv0, int exitCode)
{
- printf( "Version: %s\n", DNBD3_BUILD_VERSION );
+ printf( "Version: %s\n", DNBD3_VERSION );
printf( "Usage: %s [--debug] --host <serverAddress(es)> --image <imageName> [--rid revision]\n", argv0 );
printf( "Or: %s [-d] -h <serverAddress(es)> -i <imageName> [-r revision]\n", argv0 );
printf( " -h --host List of space separated hosts to use\n" );
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index 4cc1212..c219740 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -11,4 +11,5 @@ add_definitions(-D_GNU_SOURCE)
add_executable(dnbd3-client ${CMAKE_CURRENT_SOURCE_DIR}/client.c)
target_link_libraries(dnbd3-client dnbd3-version dnbd3-shared)
-install(TARGETS dnbd3-client RUNTIME DESTINATION bin)
+install(TARGETS dnbd3-client RUNTIME DESTINATION bin
+ COMPONENT kernel)
diff --git a/src/client/client.c b/src/client/client.c
index 69cc00f..e433160 100644
--- a/src/client/client.c
+++ b/src/client/client.c
@@ -644,7 +644,7 @@ static int dnbd3_daemon_send(int argc, char **argv)
static void dnbd3_print_help(char *argv_0)
{
- printf( "Version: %s\n", DNBD3_BUILD_VERSION );
+ printf( "Version: %s\n", DNBD3_VERSION );
printf( "\nUsage: %s\n"
"\t-h <host> -i <image name> [-r <rid>] -d <device> [-a <KB>] || -c -d <device>\n\n", argv_0 );
printf( "Start the DNBD3 client.\n" );
@@ -666,6 +666,6 @@ static void dnbd3_print_help(char *argv_0)
void dnbd3_print_version()
{
- printf( "dnbd3-client version: %s\n", DNBD3_BUILD_VERSION );
+ printf( "dnbd3-client version: %s\n", DNBD3_VERSION );
exit( EXIT_SUCCESS );
}
diff --git a/src/fuse/CMakeLists.txt b/src/fuse/CMakeLists.txt
index 1c107ed..4944a87 100644
--- a/src/fuse/CMakeLists.txt
+++ b/src/fuse/CMakeLists.txt
@@ -11,4 +11,5 @@ add_executable(dnbd3-fuse ${CMAKE_CURRENT_SOURCE_DIR}/connection.c
${CMAKE_CURRENT_SOURCE_DIR}/main.c)
target_include_directories(dnbd3-fuse PRIVATE ${FUSE_INCLUDE_DIRS})
target_link_libraries(dnbd3-fuse dnbd3-version dnbd3-shared ${FUSE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
-install(TARGETS dnbd3-fuse RUNTIME DESTINATION bin)
+install(TARGETS dnbd3-fuse RUNTIME DESTINATION bin
+ COMPONENT fuse)
diff --git a/src/fuse/main.c b/src/fuse/main.c
index 2a851a7..8963e6d 100644
--- a/src/fuse/main.c
+++ b/src/fuse/main.c
@@ -273,7 +273,7 @@ static struct fuse_lowlevel_ops image_oper = {
static void printVersion()
{
char *arg[] = { "foo", "-V" };
- printf( "dnbd3-fuse version: %s\n", DNBD3_BUILD_VERSION );
+ printf( "dnbd3-fuse version: %s\n", DNBD3_VERSION );
printf( "Protocol version: %d\n", (int)PROTOCOL_VERSION );
struct fuse_args args = FUSE_ARGS_INIT( 2, arg );
fuse_parse_cmdline( &args, NULL, NULL, NULL );
diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt
index bf1eb3a..213098e 100644
--- a/src/kernel/CMakeLists.txt
+++ b/src/kernel/CMakeLists.txt
@@ -7,7 +7,7 @@ project(dnbd3-kernel-module)
include(Kernel)
# set C flags for a Linux kernel module
-set(KERNEL_C_FLAGS "-DDNBD3_KERNEL_MODULE -I ${PROJECT_INCLUDE_TMP_DIR}"
+set(KERNEL_C_FLAGS "-DDNBD3_KERNEL_MODULE -I ${PROJECT_INCLUDE_GEN_DIR}"
CACHE STRING "C flags to be used for building the dnbd3 kernel module")
# set C flags for the debug mode of a Linux kernel module
set(KERNEL_C_FLAGS_DEBUG "-g -DDEBUG"
diff --git a/src/kernel/dnbd3_main.c b/src/kernel/dnbd3_main.c
index 353e8d2..7056d31 100644
--- a/src/kernel/dnbd3_main.c
+++ b/src/kernel/dnbd3_main.c
@@ -49,7 +49,7 @@ static int __init dnbd3_init(void)
return -EIO;
}
- pr_info("kernel module in version %s loaded\n", DNBD3_BUILD_VERSION);
+ pr_info("kernel module in version %s loaded\n", DNBD3_VERSION);
pr_debug("machine type %s\n", DNBD3_ENDIAN_MODE);
// add MAX_NUMBER_DEVICES devices
@@ -87,7 +87,7 @@ module_exit(dnbd3_exit);
MODULE_DESCRIPTION("Distributed Network Block Device 3");
MODULE_LICENSE("GPL");
-MODULE_VERSION(DNBD3_BUILD_VERSION);
+MODULE_VERSION(DNBD3_VERSION);
module_param(max_devs, int, 0444);
MODULE_PARM_DESC(max_devs, "number of network block devices to initialize (default: 8)");
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index aa981f6..de2a550 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -54,7 +54,7 @@ add_executable(dnbd3-server ${CMAKE_CURRENT_SOURCE_DIR}/altservers.c
${CMAKE_CURRENT_SOURCE_DIR}/uplink.c
${CMAKE_CURRENT_SOURCE_DIR}/urldecode.c)
target_include_directories(dnbd3-server PRIVATE ${JANSSON_INCLUDE_DIR})
-target_link_libraries(dnbd3-server dnbd3-version dnbd3-shared ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES})
+target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES})
if(DNBD3_SERVER_FUSE)
# include Fuse headers and link with Fuse library
@@ -78,4 +78,5 @@ if(DNBD3_SERVER_DEBUG_THREADS)
target_compile_options(dnbd3-server DNBD3_SERVER_DEBUG_THREADS)
endif(DNBD3_SERVER_DEBUG_THREADS)
-install(TARGETS dnbd3-server RUNTIME DESTINATION bin)
+install(TARGETS dnbd3-server RUNTIME DESTINATION bin
+ COMPONENT server)
diff --git a/src/server/rpc.c b/src/server/rpc.c
index c8da951..f2877fa 100644
--- a/src/server/rpc.c
+++ b/src/server/rpc.c
@@ -7,6 +7,7 @@
#include "altservers.h"
#include <dnbd3/shared/sockhelper.h>
#include <dnbd3/version.h>
+#include <dnbd3/build.h>
#include "fileutil.h"
#include "picohttpparser/picohttpparser.h"
#include "urldecode.h"
@@ -311,8 +312,8 @@ static bool handleStatus(int sock, int permissions, struct field *fields, size_t
"runId", randomRunId );
}
if ( version ) {
- json_object_set_new( statisticsJson, "version", json_string( DNBD3_BUILD_VERSION ) );
- json_object_set_new( statisticsJson, "build", json_string( DNBD3_BUILD_TYPE ) );
+ json_object_set_new( statisticsJson, "version", json_string( DNBD3_VERSION ) );
+ json_object_set_new( statisticsJson, "build", json_string( DNBD3_BUILD ) );
}
if ( space ) {
uint64_t spaceTotal = 0, spaceAvail = 0;
diff --git a/src/server/server.c b/src/server/server.c
index 0ee51c4..c9a0a92 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -32,6 +32,7 @@
#include "fuse.h"
#include <dnbd3/version.h>
+#include <dnbd3/build.h>
#include <dnbd3/shared/sockhelper.h>
#include <dnbd3/shared/timing.h>
@@ -105,7 +106,7 @@ static void queueJobInternal(job_t *job);
*/
void dnbd3_printHelp(char *argv_0)
{
- printf( "Version: %s\n\n", DNBD3_BUILD_VERSION );
+ printf( "Version: %s\n\n", DNBD3_VERSION );
printf( "Usage: %s [OPTIONS]...\n", argv_0 );
printf( "Start the DNBD3 server\n" );
printf( "-c or --config Configuration directory (default /etc/dnbd3-server/)\n" );
@@ -130,7 +131,7 @@ void dnbd3_printHelp(char *argv_0)
*/
void dnbd3_printVersion()
{
- printf( "dnbd3-server version: %s\n", DNBD3_BUILD_VERSION );
+ printf( "dnbd3-server version: %s\n", DNBD3_VERSION );
exit( 0 );
}
@@ -371,8 +372,8 @@ int main(int argc, char *argv[])
}
logadd( LOG_INFO, "DNBD3 server starting...." );
logadd( LOG_INFO, "Machine type: " DNBD3_ENDIAN_MODE );
- logadd( LOG_INFO, "Build Type: %s", DNBD3_BUILD_TYPE );
- logadd( LOG_INFO, "Version: %s", DNBD3_BUILD_VERSION );
+ logadd( LOG_INFO, "Build Type: %s", DNBD3_BUILD );
+ logadd( LOG_INFO, "Version: %s", DNBD3_VERSION );
if ( altservers_load() < 0 ) {
logadd( LOG_WARNING, "Could not load alt-servers. Does the file exist in %s?", _configDir );