aboutsummaryrefslogtreecommitdiffstats
path: root/meta-security/recipes-security/cynara/cynara/cmake-Improves-directories-and-libsystemd.patch
blob: 7ad94ed40c0b4f764a5fa4fc94bf79efcf8815a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From 9d1ba2f7c5d72436b17d0f3982a00380c72a58f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
Date: Mon, 4 Jul 2016 13:54:59 +0200
Subject: [PATCH] cmake: Improves directories and libsystemd
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The previous implementation was not fully compliant with
standards. It was missing some of the predefined variable
DATAROOTDIR, it was missing specificity of
CMAKE_INSTALL_FULL_SYSCONFDIR. It also was not compatible
with yocto build system bitbake.

The library systemd is changing. The previous previous
pkg-config files 'libsystemd-daemon' and 'libsystemd-journal'
are now deprecated in favour of 'libsystemd'.

Upstream-status: Submitted [https://github.com/Samsung/cynara/pull/16]

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
---
 CMakeLists.txt | 46 ++++++++++++++++++++--------------------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0ee75f..6a439e2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,66 +43,60 @@ ENDIF (NOT BUILD_COMMONS AND NOT BUILD_SERVICE AND NOT BUILD_DBUS)
 
 ########################## search for packages ################################
 
-#1st case. User choose to build with systemd.
-IF (DEFINED BUILD_WITH_SYSTEMD AND BUILD_WITH_SYSTEMD)
-    PKG_CHECK_MODULES(SYSTEMD_DEP
-        REQUIRED
-        libsystemd-daemon
-        libsystemd-journal
-        )
-ENDIF (DEFINED BUILD_WITH_SYSTEMD AND BUILD_WITH_SYSTEMD)
+#Search the new libsystemd package
+PKG_CHECK_MODULES(SYSTEMD_DEP QUIET libsystemd)
 
-#2nd case. User choose not to build with systemd. Noting to do in this case.
-#IF (DEFINED BUILD_WITH_SYSTEMD AND NOT BUILD_WITH_SYSTEMD)
-#ENDIF (DEFINED BUILD_WITH_SYSTEMD AND NOT BUILD_WITH_SYSTEMD)
-
-#3rd case. User did not choose. If we can we will use systemd.
-IF (NOT DEFINED BUILD_WITH_SYSTEMD)
+#Fallback ot the oldest libsystemd packages
+IF(NOT SYSTEMD_DEP_FOUND)
     PKG_CHECK_MODULES(SYSTEMD_DEP
         QUIET
         libsystemd-daemon
         libsystemd-journal
         )
-
-    IF (SYSTEMD_DEP_FOUND)
-        SET(BUILD_WITH_SYSTEMD ON)
-    ENDIF (SYSTEMD_DEP_FOUND)
-ENDIF (NOT DEFINED BUILD_WITH_SYSTEMD)
+ENDIF(NOT SYSTEMD_DEP_FOUND)
+
+#Enforce and check
+IF(SYSTEMD_DEP_FOUND)
+    #Enforce use of systemd if present
+    SET(BUILD_WITH_SYSTEMD ON)
+ELSEIF(BUILD_WITH_SYSTEMD)
+    MESSAGE(FATAL_ERROR "Can't find libsystemd")
+ENDIF()
 
 ########################  directory configuration  ############################
 
 SET(LIB_DIR
-    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
+    "${CMAKE_INSTALL_FULL_LIBDIR}"
     CACHE PATH
     "Object code libraries directory")
 
 SET(BIN_DIR
-    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}"
+    "${CMAKE_INSTALL_FULL_BINDIR}"
     CACHE PATH
     "User executables directory")
 
 SET(SBIN_DIR
-    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SBINDIR}"
+    "${CMAKE_INSTALL_FULL_SBINDIR}"
     CACHE PATH
     "System admin executables directory")
 
 SET(SYS_CONFIG_DIR
-    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}"
+    "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
     CACHE PATH
     "Read-only single-machine data directory")
 
 SET(INCLUDE_DIR
-    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}"
+    "${CMAKE_INSTALL_FULL_INCLUDEDIR}"
     CACHE PATH
     "Header files directory")
 
 SET(LOCAL_STATE_DIR
-    "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALSTATEDIR}"
+    "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}"
     CACHE PATH
     "Modifiable single-machine data directory")
 
 SET(DATA_ROOT_DIR
-    "${CMAKE_INSTALL_PREFIX}/share"
+    "${CMAKE_INSTALL_FULL_DATAROOTDIR}"
     CACHE PATH
     "Read-only architecture-independent data root directory")
 
-- 
2.5.5