Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-core / stx-ha / sm-common.inc
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 PACKAGES += " libsm-common"
17 PACKAGES += " sm-common-libs"
18 PACKAGES += " sm-eru"
19
20 RDEPENDS_sm-common-libs += " \
21         bash \
22         sqlite \
23         util-linux \
24         systemd \
25         "
26 RDEPENDS_sm-eru = " sm-common-libs"
27 RDEPENDS_libsm-common = " sm-common-libs"
28
29
30 do_configure_prepend () {
31         :
32
33
34 do_compile_prepend () {
35         cd ${S}/service-mgmt/sm-common/src
36         oe_runmake -e VER=0 VER_MJR=1 \
37                 INCLUDES="-I. $(pkg-config --cflags glib-2.0)" \
38                 CCFLAGS="${CXXFLAGS} -fPIC" LDFLAGS="${LDFLAGS} -shared -rdynamic" \
39                 EXTRACCFLAGS="${LDFLAGS}" 
40         
41 }
42
43 do_install_prepend () {
44         cd ${S}/service-mgmt/sm-common/src
45         oe_runmake -e DEST_DIR=${D} BIN_DIR=${bindir} UNIT_DIR=${systemd_system_unitdir} \
46                         LIB_DIR=${libdir} INC_DIR=${includedir} VER=0 VER_MJR=1 install
47  
48         cd ${S}/service-mgmt/sm-common/
49         install -d -m 755 ${D}/${systemd_system_unitdir}
50         # install -m 755 -d ${D}/${sysconfdir}/pmon.d
51         # install -m 755 -d ${D}/${sysconfdir}/init.d
52
53         install -m 644 -p -D scripts/sm-eru.service ${D}/${systemd_system_unitdir}/sm-eru.service
54         install -m 644 -p -D scripts/sm-watchdog.service ${D}/${systemd_system_unitdir}/sm-watchdog.service
55
56         install -m 640 -p -D scripts/sm-eru.conf ${D}/${sysconfdir}/pmon.d/sm-eru.conf
57         install -m 640 -p -D scripts/sm-watchdog.conf ${D}/${sysconfdir}/pmon.d/sm-watchdog.conf
58         install -m 750 -p -D scripts/sm-eru ${D}/${sysconfdir}/init.d/sm-eru
59         install -m 750 -p -D scripts/sm-watchdog ${D}/${sysconfdir}/init.d/sm-watchdog
60 }
61
62 FILES_libsm-common = " \
63         ${libdir}/libsm_common.so.0 \
64         ${libdir}/libsm_common.so.1 \
65         ${libdir}/libsm_common.so \
66         "
67
68 FILES_sm-common-libs = " \
69         var/lib/sm/watchdog/modules/libsm_watchdog_nfs.so.0 \
70         var/lib/sm/watchdog/modules/libsm_watchdog_nfs.so.1 \
71         "
72
73 FILES_sm-eru = " \
74         ${bindir}/sm-eru \
75         ${bindir}/sm-eru-dump \
76         ${bindir}/sm-watchdog \
77         ${systemd_system_unitdir}/sm-eru.service \
78         ${systemd_system_unitdir}/sm-watchdog.service \
79         ${sysconfdir}/init.d/sm-eru \
80         ${sysconfdir}/pmon.d/sm-eru.conf \
81         ${sysconfdir}/init.d/sm-watchdog \
82         ${sysconfdir}/pmon.d/sm-watchdog.conf \
83         "
84
85 SYSTEMD_PACKAGES += "sm-eru"
86 SYSTEMD_SERVICE_sm-eru = "sm-eru.service sm-watchdog.service"
87 SYSTEMD_AUTO_ENABLE_sm-eru = "enable"