summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-10-03 14:33:21 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-10-04 16:02:32 +0200
commitb5bd40e1e68b739307e20e19d2164c5b370846df (patch)
tree91d05e9d740e7e0413509ab7a563b3ce14444b62
parentd4a2c432763b033acf7c94ee7e121aca5a3a4f10 (diff)
Isolate compatibility with old cynara
The compatibility items of the old cynara librarie are separated and isolated. The option WITH_CYNARA_COMPAT activates it or not. Change-Id: Iba77c97d8df31f5f515b57411487943192451ac6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--CMakeLists.txt22
-rw-r--r--compat/CMakeLists.txt21
-rw-r--r--compat/include/CMakeLists.txt (renamed from include/CMakeLists.txt)0
-rw-r--r--compat/include/cynara/cynara-admin-types.h (renamed from include/cynara/cynara-admin-types.h)0
-rw-r--r--compat/include/cynara/cynara-admin.h (renamed from include/cynara/cynara-admin.h)0
-rw-r--r--compat/include/cynara/cynara-agent.h (renamed from include/cynara/cynara-agent.h)0
-rw-r--r--compat/include/cynara/cynara-client-async.h (renamed from include/cynara/cynara-client-async.h)0
-rw-r--r--compat/include/cynara/cynara-client-plugin.h (renamed from include/cynara/cynara-client-plugin.h)0
-rw-r--r--compat/include/cynara/cynara-client.h (renamed from include/cynara/cynara-client.h)0
-rw-r--r--compat/include/cynara/cynara-creds-commons.h (renamed from include/cynara/cynara-creds-commons.h)0
-rw-r--r--compat/include/cynara/cynara-creds-dbus.h (renamed from include/cynara/cynara-creds-dbus.h)0
-rw-r--r--compat/include/cynara/cynara-creds-gdbus.h (renamed from include/cynara/cynara-creds-gdbus.h)0
-rw-r--r--compat/include/cynara/cynara-creds-self.h (renamed from include/cynara/cynara-creds-self.h)0
-rw-r--r--compat/include/cynara/cynara-creds-socket.h (renamed from include/cynara/cynara-creds-socket.h)0
-rw-r--r--compat/include/cynara/cynara-error.h (renamed from include/cynara/cynara-error.h)0
-rw-r--r--compat/include/cynara/cynara-limits.h (renamed from include/cynara/cynara-limits.h)0
-rw-r--r--compat/include/cynara/cynara-monitor.h (renamed from include/cynara/cynara-monitor.h)0
-rw-r--r--compat/include/cynara/cynara-plugin.h (renamed from include/cynara/cynara-plugin.h)0
-rw-r--r--compat/include/cynara/cynara-policy-types.h (renamed from include/cynara/cynara-policy-types.h)0
-rw-r--r--compat/include/cynara/cynara-session.h (renamed from include/cynara/cynara-session.h)0
-rw-r--r--compat/pkgconfig/CMakeLists.txt41
-rw-r--r--compat/pkgconfig/cynara-compat.pc.in (renamed from pkgconfig/cynara-compat.pc.in)0
l---------compat/pkgconfig/link-to-cynara-compat.pc (renamed from pkgconfig/link-to-cynara-compat.pc)0
-rw-r--r--compat/src/CMakeLists.txt47
-rw-r--r--compat/src/export-cynara-compat.map (renamed from src/export-cynara-compat.map)0
-rw-r--r--compat/src/lib-compat.c (renamed from src/lib-compat.c)0
-rw-r--r--compat/src/main-test-old-cynara.c (renamed from src/main-test-old-cynara.c)0
-rw-r--r--pkgconfig/CMakeLists.txt24
-rw-r--r--src/CMakeLists.txt39
29 files changed, 122 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5879513..f96a1d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,7 +44,9 @@ set(CYNARA_SOVERSION 1.99)
add_definitions(-DCYNARA_VERSION="${CYNARA_VERSION}")
-set(SYSTEMD ON CACHE BOOL "should use systemd")
+option(WITH_SYSTEMD "should include systemd compatibility" ON)
+option(WITH_CYNARA_COMPAT "produce artifacts for compatibility with cynara" OFF)
+
set(DEFAULT_DB_DIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/cynara"
CACHE PATH "directory path of the database")
set(DEFAULT_SOCKET_DIR "${CMAKE_INSTALL_FULL_RUNSTATEDIR}/cynara"
@@ -55,7 +57,6 @@ set(DEFAULT_INIT_FILE "${DEFAULT_CONFIG_DIR}/cynara.initial")
###########################################################################
-include_directories(include)
link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
add_compile_options(-Wall -Wextra -Wconversion)
@@ -64,27 +65,22 @@ add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
add_compile_options(-Werror=maybe-uninitialized)
add_compile_options(-Werror=implicit-function-declaration)
add_compile_options(-ffunction-sections -fdata-sections)
-add_compile_options(-fPIC)
-add_compile_options(-g)
-add_compile_options(-fstack-protector -D_FORTIFY_SOURCE=2 -O2)
-add_compile_options(-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.)
-
-set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg")
-set(CMAKE_C_FLAGS_DEBUG "-g -ggdb --fstack-protector -D_FORTIFY_SOURCE=2")
-set(CMAKE_C_FLAGS_RELEASE "-g -O2")
-set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
+add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.)
###########################################################################
-if(SYSTEMD)
+if(WITH_SYSTEMD)
PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
add_subdirectory(systemd)
endif()
-add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(pkgconfig)
+if(WITH_CYNARA_COMPAT)
+ add_subdirectory(compat)
+endif()
+
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/cynara.initial
DESTINATION
diff --git a/compat/CMakeLists.txt b/compat/CMakeLists.txt
new file mode 100644
index 0000000..02af4a1
--- /dev/null
+++ b/compat/CMakeLists.txt
@@ -0,0 +1,21 @@
+###########################################################################
+# Copyright (C) 2018 "IoT.bzh"
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+add_subdirectory(src)
+add_subdirectory(include)
+add_subdirectory(pkgconfig)
diff --git a/include/CMakeLists.txt b/compat/include/CMakeLists.txt
index 6553f89..6553f89 100644
--- a/include/CMakeLists.txt
+++ b/compat/include/CMakeLists.txt
diff --git a/include/cynara/cynara-admin-types.h b/compat/include/cynara/cynara-admin-types.h
index 95d27b9..95d27b9 100644
--- a/include/cynara/cynara-admin-types.h
+++ b/compat/include/cynara/cynara-admin-types.h
diff --git a/include/cynara/cynara-admin.h b/compat/include/cynara/cynara-admin.h
index a0ab0c9..a0ab0c9 100644
--- a/include/cynara/cynara-admin.h
+++ b/compat/include/cynara/cynara-admin.h
diff --git a/include/cynara/cynara-agent.h b/compat/include/cynara/cynara-agent.h
index 3e6d4f0..3e6d4f0 100644
--- a/include/cynara/cynara-agent.h
+++ b/compat/include/cynara/cynara-agent.h
diff --git a/include/cynara/cynara-client-async.h b/compat/include/cynara/cynara-client-async.h
index 78a1313..78a1313 100644
--- a/include/cynara/cynara-client-async.h
+++ b/compat/include/cynara/cynara-client-async.h
diff --git a/include/cynara/cynara-client-plugin.h b/compat/include/cynara/cynara-client-plugin.h
index 70000e6..70000e6 100644
--- a/include/cynara/cynara-client-plugin.h
+++ b/compat/include/cynara/cynara-client-plugin.h
diff --git a/include/cynara/cynara-client.h b/compat/include/cynara/cynara-client.h
index d1388ec..d1388ec 100644
--- a/include/cynara/cynara-client.h
+++ b/compat/include/cynara/cynara-client.h
diff --git a/include/cynara/cynara-creds-commons.h b/compat/include/cynara/cynara-creds-commons.h
index 81b9784..81b9784 100644
--- a/include/cynara/cynara-creds-commons.h
+++ b/compat/include/cynara/cynara-creds-commons.h
diff --git a/include/cynara/cynara-creds-dbus.h b/compat/include/cynara/cynara-creds-dbus.h
index 04af96f..04af96f 100644
--- a/include/cynara/cynara-creds-dbus.h
+++ b/compat/include/cynara/cynara-creds-dbus.h
diff --git a/include/cynara/cynara-creds-gdbus.h b/compat/include/cynara/cynara-creds-gdbus.h
index 2334e45..2334e45 100644
--- a/include/cynara/cynara-creds-gdbus.h
+++ b/compat/include/cynara/cynara-creds-gdbus.h
diff --git a/include/cynara/cynara-creds-self.h b/compat/include/cynara/cynara-creds-self.h
index 580a19d..580a19d 100644
--- a/include/cynara/cynara-creds-self.h
+++ b/compat/include/cynara/cynara-creds-self.h
diff --git a/include/cynara/cynara-creds-socket.h b/compat/include/cynara/cynara-creds-socket.h
index fe5cbdb..fe5cbdb 100644
--- a/include/cynara/cynara-creds-socket.h
+++ b/compat/include/cynara/cynara-creds-socket.h
diff --git a/include/cynara/cynara-error.h b/compat/include/cynara/cynara-error.h
index 8316f1d..8316f1d 100644
--- a/include/cynara/cynara-error.h
+++ b/compat/include/cynara/cynara-error.h
diff --git a/include/cynara/cynara-limits.h b/compat/include/cynara/cynara-limits.h
index f4e98c1..f4e98c1 100644
--- a/include/cynara/cynara-limits.h
+++ b/compat/include/cynara/cynara-limits.h
diff --git a/include/cynara/cynara-monitor.h b/compat/include/cynara/cynara-monitor.h
index ce7b8d0..ce7b8d0 100644
--- a/include/cynara/cynara-monitor.h
+++ b/compat/include/cynara/cynara-monitor.h
diff --git a/include/cynara/cynara-plugin.h b/compat/include/cynara/cynara-plugin.h
index 747966f..747966f 100644
--- a/include/cynara/cynara-plugin.h
+++ b/compat/include/cynara/cynara-plugin.h
diff --git a/include/cynara/cynara-policy-types.h b/compat/include/cynara/cynara-policy-types.h
index bd74b5a..bd74b5a 100644
--- a/include/cynara/cynara-policy-types.h
+++ b/compat/include/cynara/cynara-policy-types.h
diff --git a/include/cynara/cynara-session.h b/compat/include/cynara/cynara-session.h
index 1c76bce..1c76bce 100644
--- a/include/cynara/cynara-session.h
+++ b/compat/include/cynara/cynara-session.h
diff --git a/compat/pkgconfig/CMakeLists.txt b/compat/pkgconfig/CMakeLists.txt
new file mode 100644
index 0000000..6707a22
--- /dev/null
+++ b/compat/pkgconfig/CMakeLists.txt
@@ -0,0 +1,41 @@
+###########################################################################
+# Copyright (C) 2018 "IoT.bzh"
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+configure_file(cynara-compat.pc.in cynara-compat.pc @ONLY)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara-compat.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
+foreach(item cynara-admin.pc
+ cynara-agent.pc
+ cynara-client-async.pc
+ cynara-client.pc
+ cynara-commons.pc
+ cynara-creds-commons.pc
+ cynara-creds-dbus.pc
+ cynara-creds-gdbus.pc
+ cynara-creds-self.pc
+ cynara-creds-socket.pc
+ cynara-monitor.pc
+ cynara-plugin.pc
+ cynara-session.pc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/link-to-cynara-compat.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+ RENAME ${item})
+endforeach(item)
+
diff --git a/pkgconfig/cynara-compat.pc.in b/compat/pkgconfig/cynara-compat.pc.in
index c698b3a..c698b3a 100644
--- a/pkgconfig/cynara-compat.pc.in
+++ b/compat/pkgconfig/cynara-compat.pc.in
diff --git a/pkgconfig/link-to-cynara-compat.pc b/compat/pkgconfig/link-to-cynara-compat.pc
index e8bb0ec..e8bb0ec 120000
--- a/pkgconfig/link-to-cynara-compat.pc
+++ b/compat/pkgconfig/link-to-cynara-compat.pc
diff --git a/compat/src/CMakeLists.txt b/compat/src/CMakeLists.txt
new file mode 100644
index 0000000..3bda2da
--- /dev/null
+++ b/compat/src/CMakeLists.txt
@@ -0,0 +1,47 @@
+###########################################################################
+# Copyright (C) 2018 "IoT.bzh"
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+add_compile_definitions(_GNU_SOURCE)
+
+###########################################
+# build and install libcynara-compat
+###########################################
+add_library(cynara-compat SHARED lib-compat.c)
+target_include_directories(cynara-compat PUBLIC ../include)
+set_target_properties(cynara-compat
+ PROPERTIES
+ VERSION ${CYNARA_VERSION}
+ SOVERSION ${CYNARA_SOVERSION}
+)
+target_link_libraries(cynara-compat
+ PRIVATE cynara-client
+)
+target_link_options(cynara-compat
+ PRIVATE
+ -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-compat.map
+)
+install(TARGETS cynara-compat LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
+
+###########################################
+# build and install test-old-cynara
+###########################################
+add_executable(test-old-cynara main-test-old-cynara.c)
+target_link_libraries(test-old-cynara cynara-compat)
+install(TARGETS test-old-cynara
+ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+
diff --git a/src/export-cynara-compat.map b/compat/src/export-cynara-compat.map
index 7b482f3..7b482f3 100644
--- a/src/export-cynara-compat.map
+++ b/compat/src/export-cynara-compat.map
diff --git a/src/lib-compat.c b/compat/src/lib-compat.c
index 63696fe..63696fe 100644
--- a/src/lib-compat.c
+++ b/compat/src/lib-compat.c
diff --git a/src/main-test-old-cynara.c b/compat/src/main-test-old-cynara.c
index ccc3baa..ccc3baa 100644
--- a/src/main-test-old-cynara.c
+++ b/compat/src/main-test-old-cynara.c
diff --git a/pkgconfig/CMakeLists.txt b/pkgconfig/CMakeLists.txt
index 6875ab6..14c05d5 100644
--- a/pkgconfig/CMakeLists.txt
+++ b/pkgconfig/CMakeLists.txt
@@ -20,27 +20,3 @@ configure_file(cynara.pc.in cynara.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
-configure_file(cynara-compat.pc.in cynara-compat.pc @ONLY)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cynara-compat.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
-foreach(item cynara-admin.pc
- cynara-agent.pc
- cynara-client-async.pc
- cynara-client.pc
- cynara-commons.pc
- cynara-creds-commons.pc
- cynara-creds-dbus.pc
- cynara-creds-gdbus.pc
- cynara-creds-self.pc
- cynara-creds-socket.pc
- cynara-monitor.pc
- cynara-plugin.pc
- cynara-session.pc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/link-to-cynara-compat.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
- RENAME ${item})
-endforeach(item)
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8ef4b8a..e2a17e8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -55,23 +55,19 @@ set(LIBCLI_SOURCES
socket.c
)
-set(LIBCOMPAT_SOURCES
- lib-compat.c
-)
-
add_compile_definitions(_GNU_SOURCE)
###########################################
# build and install libcynara-core
###########################################
add_library(cynara-core SHARED ${LIBCORE_SOURCES})
+target_include_directories(cynara-core PUBLIC .)
set_target_properties(cynara-core PROPERTIES
VERSION ${CYNARA_VERSION}
SOVERSION ${CYNARA_SOVERSION})
target_link_libraries(cynara-core
+ PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-core.map
- -Wl,--as-needed
- -Wl,--gc-sections
)
install(TARGETS cynara-core LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
@@ -79,6 +75,7 @@ install(TARGETS cynara-core LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
# build and install libcynara-client
###########################################
add_library(cynara-client SHARED ${LIBCLI_SOURCES})
+target_include_directories(cynara-client PUBLIC .)
target_compile_definitions(cynara-client PRIVATE
RCYN_DEFAULT_SOCKET_DIR="${DEFAULT_SOCKET_DIR}"
)
@@ -88,31 +85,11 @@ set_target_properties(cynara-client PROPERTIES
target_link_options(cynara-client
PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-client.map
- -Wl,--as-needed
- -Wl,--gc-sections
)
install(TARGETS cynara-client LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
install(FILES rcyn-client.h DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/cynara)
###########################################
-# build and install libcynara-compat
-###########################################
-add_library(cynara-compat SHARED ${LIBCOMPAT_SOURCES})
-set_target_properties(cynara-compat PROPERTIES
- VERSION ${CYNARA_VERSION}
- SOVERSION ${CYNARA_SOVERSION})
-target_link_libraries(cynara-compat
- PRIVATE cynara-client
-)
-target_link_options(cynara-compat
- PRIVATE
- -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-cynara-compat.map
- -Wl,--as-needed
- -Wl,--gc-sections
-)
-install(TARGETS cynara-compat LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
-
-###########################################
# build and install cynarad
###########################################
add_executable(cynarad ${SERVER_SOURCES})
@@ -122,7 +99,7 @@ target_compile_definitions(cynarad PRIVATE
DEFAULT_INIT_FILE="${DEFAULT_INIT_FILE}"
RCYN_DEFAULT_SOCKET_DIR="${DEFAULT_SOCKET_DIR}"
)
-if(SYSTEMD)
+if(WITH_SYSTEMD)
target_compile_definitions(cynarad PRIVATE WITH_SYSTEMD_ACTIVATION)
target_link_libraries(cynarad ${libsystemd_LDFLAGS} ${libsystemd_LINK_LIBRARIES})
target_include_directories(cynarad PRIVATE ${libsystemd_INCLUDE_DIRS})
@@ -140,11 +117,3 @@ target_link_libraries(cynadm cynara-client)
install(TARGETS cynadm
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
-###########################################
-# build and install test-old-cynara
-###########################################
-add_executable(test-old-cynara main-test-old-cynara.c)
-target_link_libraries(test-old-cynara cynara-compat)
-install(TARGETS test-old-cynara
- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
-