Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-extended / ceph / ceph_13.2.2.bb
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 SUMMARY = "User space components of the Ceph file system"
17 DESCRIPTION = "\
18 Ceph is a massively scalable, open-source, distributed storage system that runs \
19 on commodity hardware and delivers object, block and file system storage. \
20 "
21 HOMEPAGE = "https://ceph.io"
22
23 LICENSE = "LGPLv2.1 & GPLv2 & Apache-2.0 & MIT"
24 LIC_FILES_CHKSUM = "\
25     file://COPYING-LGPL2.1;md5=fbc093901857fcd118f065f900982c24 \
26     file://COPYING-GPL2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
27     file://COPYING;md5=92d301c8fccd296f2221a68a8dd53828 \
28 "
29
30 DEPENDS = "\
31     boost rdma-core bzip2 curl expat \
32     gperf-native keyutils libaio lz4 \
33     nspr nss oath openldap openssl \
34     python python-cython-native rocksdb \
35     snappy udev valgrind xfsprogs zlib \
36 "
37
38 SRC_URI = "\
39     http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \
40     file://0001-Correct-the-path-to-find-version.h-in-rocksdb.patch \
41     file://0002-zstd-fix-error-for-cross-compile.patch \
42     file://0003-ceph-add-pybind-support-in-OE.patch \
43     file://0004-ceph-detect-init-correct-the-installation-for-OE.patch \
44     file://0005-Add-hooks-for-orderly-shutdown-on-controller.patch \
45     \
46     file://ceph-init-wrapper.sh \
47     file://ceph-manage-journal.py \
48     file://ceph-preshutdown.sh \
49     file://ceph-radosgw.service \
50     file://ceph.conf \
51     file://ceph.conf.pmon \
52     file://ceph.service \
53     file://ceph.sh \
54     file://mgr-restful-plugin.py \
55     file://mgr-restful-plugin.service \
56     file://starlingx-docker-override.conf \
57 "
58 SRC_URI[md5sum] = "ce118be451dcb6b89e9e0a45057827dd"
59 SRC_URI[sha256sum] = "f3a61db4c90e00c38a2dac7239b956ec367ef56f601e07335ed3011f931d8840"
60
61 inherit cmake pythonnative python-dir systemd
62
63 DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
64
65 SYSTEMD_SERVICE_${PN} = " \
66     ceph-radosgw@.service \
67     ceph-radosgw.target \
68     ceph-mon@.service \
69     ceph-mon.target \
70     ceph-mds@.service \
71     ceph-mds.target \
72     ceph-disk@.service \
73     ceph-osd@.service \
74     ceph-osd.target \
75     ceph.target \
76     ceph-fuse@.service \
77     ceph-fuse.target \
78     ceph-rbd-mirror@.service \
79     ceph-rbd-mirror.target \
80     ceph-volume@.service \
81     ceph-mgr@.service \
82     ceph-mgr.target \
83     rbdmap.service \
84 "
85
86 OECMAKE_GENERATOR = "Unix Makefiles"
87
88 EXTRA_OECMAKE = "\
89     -DWITH_MANPAGE=OFF \
90     -DWITH_FUSE=OFF \
91     -DWITH_SPDK=OFF \
92     -DWITH_LEVELDB=OFF \
93     -DWITH_LTTNG=OFF \
94     -DWITH_BABELTRACE=OFF \
95     -DWITH_TESTS=OFF \
96     -DDEBUG_GATHER=OFF \
97     -DWITH_PYTHON2=ON \
98     -DWITH_MGR=ON \
99     -DMGR_PYTHON_VERSION=2.7 \
100     -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
101     -DWITH_SYSTEM_BOOST=ON \
102     -DWITH_SYSTEM_ROCKSDB=ON \
103 "
104
105 do_configure_prepend () {
106     echo "set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )" >> ${WORKDIR}/toolchain.cmake
107     echo "set( CMAKE_DESTDIR \"${D}\" )" >> ${WORKDIR}/toolchain.cmake
108     echo "set( PYTHON_SITEPACKAGES_DIR \"${PYTHON_SITEPACKAGES_DIR}\" )" >> ${WORKDIR}/toolchain.cmake
109     ln -sf ${STAGING_LIBDIR}/libboost_python27.so ${STAGING_LIBDIR}/libboost_python.so
110 }
111
112 do_install_append () {
113     mv ${D}${bindir}/ceph-disk ${D}${sbindir}/ceph-disk
114     sed -i -e 's:${WORKDIR}.*python2.7:${bindir}/python:' ${D}${sbindir}/ceph-disk
115     sed -i -e 's:${WORKDIR}.*python2.7:${bindir}/python:' ${D}${bindir}/ceph
116     sed -i -e 's:${WORKDIR}.*python2.7:${bindir}/python:' ${D}${bindir}/ceph-detect-init
117     find ${D} -name SOURCES.txt | xargs sed -i -e 's:${WORKDIR}::'
118
119     install -d ${D}${systemd_unitdir}
120     mv ${D}${libexecdir}/systemd/system ${D}${systemd_unitdir}
121     mv ${D}${libexecdir}/ceph/ceph-osd-prestart.sh ${D}${libdir}/ceph
122     install -m 0755 ${D}${libexecdir}/ceph/ceph_common.sh ${D}${libdir}/ceph
123
124     install -d ${D}${sysconfdir}/ceph
125     install -m 0644 ${WORKDIR}/ceph.conf ${D}${sysconfdir}/ceph/
126     install -m 0644 ${WORKDIR}/ceph-radosgw.service ${D}${systemd_system_unitdir}/ceph-radosgw@.service
127     install -m 0644 ${WORKDIR}/ceph.service ${D}${systemd_system_unitdir}
128     install -m 0644 ${WORKDIR}/mgr-restful-plugin.service ${D}${systemd_system_unitdir}
129
130     install -m 0700 ${WORKDIR}/ceph-manage-journal.py ${D}${sbindir}/ceph-manage-journal
131     install -Dm 0750 ${WORKDIR}/mgr-restful-plugin.py  ${D}${sysconfdir}/rc.d/init.d/mgr-restful-plugin
132     install -Dm 0750 ${WORKDIR}/mgr-restful-plugin.py  ${D}${sysconfdir}/init.d/mgr-restful-plugin
133     install -m 0750 ${WORKDIR}/ceph.conf.pmon ${D}${sysconfdir}/ceph/
134
135     install -d -m 0750 ${D}${sysconfdir}/services.d/controller
136     install -d -m 0750 ${D}${sysconfdir}/services.d/storage
137     install -d -m 0750 ${D}${sysconfdir}/services.d/worker
138
139     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/controller
140     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/storage
141     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/worker
142
143     install -Dm 0750 ${WORKDIR}/ceph-init-wrapper.sh ${D}${sysconfdir}/rc.d/init.d/ceph-init-wrapper
144     install -Dm 0750 ${WORKDIR}/ceph-init-wrapper.sh ${D}${sysconfdir}/init.d/ceph-init-wrapper
145     sed -i -e 's|/usr/lib64|${libdir}|' ${D}${sysconfdir}/rc.d/init.d/ceph-init-wrapper ${D}${sysconfdir}/init.d/ceph-init-wrapper
146
147     install -m 0700 ${WORKDIR}/ceph-preshutdown.sh ${D}${sbindir}/ceph-preshutdown.sh
148     
149     install -Dm 0644 ${WORKDIR}/starlingx-docker-override.conf ${D}${systemd_system_unitdir}/docker.service.d/starlingx-docker-override.conf
150
151     install -m 0644 -D ${S}/src/etc-rbdmap ${D}${sysconfdir}/ceph/rbdmap 
152     install -m 0644 -D ${S}/etc/sysconfig/ceph ${D}${sysconfdir}/sysconfig/ceph
153     install -m 0644 -D ${S}/src/logrotate.conf ${D}${sysconfdir}/logrotate.d/ceph
154
155     install -m 0644 -D ${S}/COPYING ${D}${docdir}/ceph/COPYING    
156     install -m 0644 -D ${S}/etc/sysctl/90-ceph-osd.conf ${D}${libdir}/sysctl.d/90-ceph-osd.conf
157     install -m 0644 -D ${S}/udev/50-rbd.rules ${D}${libdir}/udev/rules.d/50-rbd.rules
158     install -m 0644 -D ${S}/udev/60-ceph-by-parttypeuuid.rules ${D}${libdir}/udev/rules.d/60-ceph-by-parttypeuuid.rules
159
160     mkdir -p ${D}${localstatedir}/ceph
161     mkdir -p ${D}${localstatedir}/log/ceph
162     mkdir -p ${D}${localstatedir}/lib/ceph/tmp
163     mkdir -p ${D}${localstatedir}/lib/ceph/mon
164     mkdir -p ${D}${localstatedir}/lib/ceph/osd
165     mkdir -p ${D}${localstatedir}/lib/ceph/mds
166     mkdir -p ${D}${localstatedir}/lib/ceph/mgr
167     mkdir -p ${D}${localstatedir}/lib/ceph/radosgw
168     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-osd
169     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-mds
170     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-rgw
171     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-mgr
172     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-rbd
173
174     install -m 0755 -d ${D}/${sysconfdir}/tmpfiles.d
175     echo "d ${localstatedir}/run/ceph 0755 ceph ceph -" >> ${D}/${sysconfdir}/tmpfiles.d/ceph.conf
176
177     install -m 0750 -D ${S}/src/init-radosgw ${D}${sysconfdir}/rc.d/init.d/ceph-radosgw
178     install -m 0750 -D ${S}/src/init-radosgw ${D}${sysconfdir}/init.d/ceph-radosgw
179     sed -i '/### END INIT INFO/a SYSTEMCTL_SKIP_REDIRECT=1' ${D}${sysconfdir}/rc.d/init.d/ceph-radosgw
180     sed -i '/### END INIT INFO/a SYSTEMCTL_SKIP_REDIRECT=1' ${D}${sysconfdir}/init.d/ceph-radosgw
181     install -m 0750 -D ${S}/src/init-rbdmap ${D}${sysconfdir}/rc.d/init.d/rbdmap
182     install -m 0750 -D ${S}/src/init-rbdmap ${D}${sysconfdir}/init.d/rbdmap
183     install -m 0750 -D ${B}/bin/init-ceph ${D}${sysconfdir}/rc.d/init.d/ceph
184     install -m 0750 -D ${B}/bin/init-ceph ${D}${sysconfdir}/init.d/ceph
185     install -d -m 0750 ${D}${localstatedir}/log/radosgw 
186 }
187
188 PACKAGES += " \
189     ${PN}-python \
190 "
191
192 FILES_${PN} += "\
193     ${libdir}/rados-classes/*.so.* \
194     ${libdir}/ceph/compressor/*.so \
195     ${libdir}/rados-classes/*.so \
196     ${libdir}/ceph/*.so \
197     ${localstatedir} \
198     ${docdir}/ceph/COPYING \
199     ${libdir}/sysctl.d/90-ceph-osd.conf \
200     ${libdir}/udev/rules.d/50-rbd.rules \
201     ${libdir}/udev/rules.d/60-ceph-by-parttypeuuid.rules \
202     ${systemd_system_unitdir}/mgr-restful-plugin.service \
203     ${systemd_system_unitdir}/ceph-radosgw@.service \
204     ${systemd_system_unitdir}/ceph.service \
205     ${systemd_system_unitdir}/docker.service.d/starlingx-docker-override.conf \
206 "
207 FILES_${PN}-python = "\
208     ${PYTHON_SITEPACKAGES_DIR}/* \
209 "
210
211 RDEPENDS_${PN} += "\
212     bash \
213     python \
214     python-misc \
215     python-modules \
216     python-prettytable \
217     rdma-core \
218     xfsprogs-mkfs \
219     ${PN}-python \
220 "
221
222 COMPATIBLE_HOST = "(x86_64).*"
223
224 INSANE_SKIP_${PN}-python += "ldflags"
225 INSANE_SKIP_${PN} += "dev-so"