aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-04-30 22:18:08 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-04-30 22:18:08 +0200
commitd00bfe9410cfcaeb247ba68a88144defb5184ac9 (patch)
tree58e4a07e9d7ebad3215122449dc43193078c5ded
parent5214323d82cc09b15c25e348707f2639977ea763 (diff)
Allow to tune installation directories
The location of intrinsic bindings and samples could not be tuned but was fixed to be ${CMAKE_INSTALL_FULL_LIBDIR}/afb and ${CMAKE_INSTALL_FULL_DATADIR}/af-binder These default locations are not bad but it is important to be able to tune that location. Bug-AGL: SPEC-2367 Change-Id: I4d4f9e9490d61e3278ef35ac42f2143a752a7c37 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--CMakeLists.txt6
-rw-r--r--bindings/intrinsics/CMakeLists.txt2
-rw-r--r--bindings/samples/CMakeLists.txt2
-rw-r--r--bindings/tutorials/CMakeLists.txt2
-rw-r--r--coverage/bin/Makefile4
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/afb-args.c16
7 files changed, 18 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebda48f0..3962da28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,8 @@ set(AFS_SUPERVISION_SOCKET "@urn:AGL:afs:supervision:socket" CACHE STRING "Inter
set(AFS_SUPERVISOR_PORT 1619 CACHE STRING "Port of service for the supervisor")
set(AFS_SUPERVISOR_TOKEN HELLO CACHE STRING "Secret token for the supervisor")
set(UNITDIR_SYSTEM ${CMAKE_INSTALL_LIBDIR}/systemd/system CACHE STRING "Path to systemd system unit files")
+set(INTRINSIC_BINDING_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/afb CACHE STRING "Path to install intrinsic bindings")
+set(SAMPLE_INSTALL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/af-binder CACHE STRING "Path to install samples")
###########################################################################
@@ -156,8 +158,6 @@ ADD_SUBDIRECTORY(src/devtools)
IF(ONLY_DEVTOOLS)
MESSAGE(WARNING "Only DEVTOOLS are compiled, not the binder!")
ELSE()
- SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb)
- SET(install_datadir ${CMAKE_INSTALL_FULL_DATADIR}/af-binder)
###########################################################################
# activates the monitoring by default
@@ -166,7 +166,7 @@ ELSE()
INSTALL(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/test/monitoring
DESTINATION
- ${binding_install_dir}
+ ${INTRINSIC_BINDING_DIR}
)
endif()
diff --git a/bindings/intrinsics/CMakeLists.txt b/bindings/intrinsics/CMakeLists.txt
index ee981217..b7668ce8 100644
--- a/bindings/intrinsics/CMakeLists.txt
+++ b/bindings/intrinsics/CMakeLists.txt
@@ -29,5 +29,5 @@ SET_TARGET_PROPERTIES(afb-dbus-binding PROPERTIES
)
TARGET_LINK_LIBRARIES(afb-dbus-binding ${json-c_LDFLAGS} ${libsystemd_LDFLAGS})
INSTALL(TARGETS afb-dbus-binding
- LIBRARY DESTINATION ${binding_install_dir})
+ LIBRARY DESTINATION ${INTRINSIC_BINDING_DIR})
diff --git a/bindings/samples/CMakeLists.txt b/bindings/samples/CMakeLists.txt
index 51442684..c2dae240 100644
--- a/bindings/samples/CMakeLists.txt
+++ b/bindings/samples/CMakeLists.txt
@@ -21,7 +21,7 @@ macro(sample name source)
set_target_properties(${name} PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map")
# target_link_libraries(${name} ${link_libraries})
target_link_libraries(${name} ${json-c_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT})
- install(TARGETS ${name} LIBRARY DESTINATION ${install_datadir}/bindings/samples)
+ install(TARGETS ${name} LIBRARY DESTINATION ${SAMPLE_INSTALL_DIR}/bindings/samples)
endmacro(sample)
sample(authLogin AuthLogin.c)
diff --git a/bindings/tutorials/CMakeLists.txt b/bindings/tutorials/CMakeLists.txt
index e071d7a9..a3c87c55 100644
--- a/bindings/tutorials/CMakeLists.txt
+++ b/bindings/tutorials/CMakeLists.txt
@@ -24,7 +24,7 @@ MACRO(tuto num ext)
LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
)
TARGET_LINK_LIBRARIES(tuto-${num} ${json-c_LDFLAGS})
- install(TARGETS tuto-${num} LIBRARY DESTINATION ${install_datadir}/bindings/tutorials)
+ install(TARGETS tuto-${num} LIBRARY DESTINATION ${SAMPLE_INSTALL_DIR}/bindings/tutorials)
ENDMACRO(tuto)
diff --git a/coverage/bin/Makefile b/coverage/bin/Makefile
index b0914c7d..28c09cca 100644
--- a/coverage/bin/Makefile
+++ b/coverage/bin/Makefile
@@ -75,7 +75,7 @@ defs = -DAGL_DEVEL=1 \
-DWITH_DBUS_TRANSPARENCY=0 \
-DWITH_SUPERVISION=0 \
-DWITH_DYNAMIC_BINDING=1 \
- -DBINDING_INSTALL_DIR=\"$(shell pwd)/fake\"
+ -DINTRINSIC_BINDING_DIR=\"$(shell pwd)/fake\"
afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
afb_lib_obj = $(patsubst $(srcdir)/%.c,%.o,$(afb_lib_src))
@@ -93,7 +93,7 @@ tst_flags = $(cflags) \
-I$(srcdir) \
$(shell pkg-config --cflags --libs check)
-tst_defs = '-DAFB_VERSION="cov"' '-DBINDING_INSTALL_DIR="fake"'
+tst_defs = '-DAFB_VERSION="cov"' '-DINTRINSIC_BINDING_DIR="fake"'
tst_flags = $(cflags) \
-I$(srcdir) \
$(shell pkg-config --cflags --libs check)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71cd1ff2..3b444a0b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -20,7 +20,7 @@ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR "Require at least gcc-4.9")
endif(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
-ADD_DEFINITIONS(-DBINDING_INSTALL_DIR="${binding_install_dir}")
+ADD_DEFINITIONS(-DINTRINSIC_BINDING_DIR="${INTRINSIC_BINDING_DIR}")
# Always add INFER_EXTENSION (more details in afb-hreq.c)
ADD_DEFINITIONS(-DINFER_EXTENSION)
diff --git a/src/afb-args.c b/src/afb-args.c
index af3cfcab..ed14a731 100644
--- a/src/afb-args.c
+++ b/src/afb-args.c
@@ -38,9 +38,6 @@
#define _d2s_(x) #x
#define d2s(x) _d2s_(x)
-#if !defined(BINDING_INSTALL_DIR)
-#error "you should define BINDING_INSTALL_DIR"
-#endif
#if !defined(AFB_VERSION)
#error "you should define AFB_VERSION"
#endif
@@ -176,7 +173,12 @@ static struct option_desc optdefs[] = {
{SET_ROOT_DIR, 1, "rootdir", "Root Directory of the application [default: workdir] relative to workdir"},
#if WITH_DYNAMIC_BINDING
- {ADD_LDPATH, 1, "ldpaths", "Load bindings from dir1:dir2:... [default = " BINDING_INSTALL_DIR "]"},
+
+ {ADD_LDPATH, 1, "ldpaths", "Load bindings from dir1:dir2:..."
+#if defined(INTRINSIC_BINDING_DIR)
+ "[default = " INTRINSIC_BINDING_DIR "]"
+#endif
+ },
{ADD_BINDING, 1, "binding", "Load the binding of path"},
{ADD_WEAK_LDPATH, 1, "weak-ldpaths","Same as --ldpaths but ignore errors"},
{SET_NO_LDPATH, 0, "no-ldpaths", "Discard default ldpaths loading"},
@@ -232,7 +234,7 @@ static struct option_desc optdefs[] = {
};
#if defined(WITH_MONITORING_OPTION)
-static const char MONITORING_ALIAS[] = "/monitoring:"BINDING_INSTALL_DIR"/monitoring";
+static const char MONITORING_ALIAS[] = "/monitoring:"INTRINSIC_BINDING_DIR"/monitoring";
#endif
static const struct {
@@ -995,9 +997,9 @@ static void fulfill_config(struct json_object *config)
if (config_has_bool(config, SET_RANDOM_TOKEN))
config_del(config, SET_TOKEN);
-#if WITH_DYNAMIC_BINDING
+#if WITH_DYNAMIC_BINDING && defined(INTRINSIC_BINDING_DIR)
if (!config_has(config, ADD_LDPATH) && !config_has(config, ADD_WEAK_LDPATH) && !config_has_bool(config, SET_NO_LDPATH))
- config_add_str(config, ADD_LDPATH, BINDING_INSTALL_DIR);
+ config_add_str(config, ADD_LDPATH, INTRINSIC_BINDING_DIR);
#endif
#if defined(WITH_MONITORING_OPTION)