8c6b0766195e82fb01a910d6f505b652134e286a
[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 SYSTEMD_AUTO_ENABLE = "disable"
86
87 OECMAKE_GENERATOR = "Unix Makefiles"
88
89 EXTRA_OECMAKE = "\
90     -DWITH_MANPAGE=OFF \
91     -DWITH_FUSE=OFF \
92     -DWITH_SPDK=OFF \
93     -DWITH_LEVELDB=OFF \
94     -DWITH_LTTNG=OFF \
95     -DWITH_BABELTRACE=OFF \
96     -DWITH_TESTS=OFF \
97     -DDEBUG_GATHER=OFF \
98     -DWITH_PYTHON2=ON \
99     -DWITH_MGR=ON \
100     -DMGR_PYTHON_VERSION=2.7 \
101     -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
102     -DWITH_SYSTEM_BOOST=ON \
103     -DWITH_SYSTEM_ROCKSDB=ON \
104 "
105
106 do_configure_prepend () {
107     echo "set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )" >> ${WORKDIR}/toolchain.cmake
108     echo "set( CMAKE_DESTDIR \"${D}\" )" >> ${WORKDIR}/toolchain.cmake
109     echo "set( PYTHON_SITEPACKAGES_DIR \"${PYTHON_SITEPACKAGES_DIR}\" )" >> ${WORKDIR}/toolchain.cmake
110     ln -sf ${STAGING_LIBDIR}/libboost_python27.so ${STAGING_LIBDIR}/libboost_python.so
111 }
112
113 do_install_append () {
114     mv ${D}${bindir}/ceph-disk ${D}${sbindir}/ceph-disk
115     sed -i -e 's:${WORKDIR}.*python2.7:${bindir}/python:' ${D}${sbindir}/ceph-disk
116     sed -i -e 's:${WORKDIR}.*python2.7:${bindir}/python:' ${D}${bindir}/ceph
117     sed -i -e 's:${WORKDIR}.*python2.7:${bindir}/python:' ${D}${bindir}/ceph-detect-init
118     find ${D} -name SOURCES.txt | xargs sed -i -e 's:${WORKDIR}::'
119
120     install -d ${D}${systemd_unitdir}
121     mv ${D}${libexecdir}/systemd/system ${D}${systemd_unitdir}
122     mv ${D}${libexecdir}/ceph/ceph-osd-prestart.sh ${D}${libdir}/ceph
123     install -m 0755 ${D}${libexecdir}/ceph/ceph_common.sh ${D}${libdir}/ceph
124
125     install -d ${D}${sysconfdir}/ceph
126     install -m 0644 ${WORKDIR}/ceph.conf ${D}${sysconfdir}/ceph/
127     install -m 0644 ${WORKDIR}/ceph-radosgw.service ${D}${systemd_system_unitdir}/ceph-radosgw@.service
128     install -m 0644 ${WORKDIR}/ceph.service ${D}${systemd_system_unitdir}
129     install -m 0644 ${WORKDIR}/mgr-restful-plugin.service ${D}${systemd_system_unitdir}
130
131     install -m 0700 ${WORKDIR}/ceph-manage-journal.py ${D}${sbindir}/ceph-manage-journal
132     install -Dm 0750 ${WORKDIR}/mgr-restful-plugin.py  ${D}${sysconfdir}/rc.d/init.d/mgr-restful-plugin
133     install -Dm 0750 ${WORKDIR}/mgr-restful-plugin.py  ${D}${sysconfdir}/init.d/mgr-restful-plugin
134     install -m 0750 ${WORKDIR}/ceph.conf.pmon ${D}${sysconfdir}/ceph/
135
136     install -d -m 0750 ${D}${sysconfdir}/services.d/controller
137     install -d -m 0750 ${D}${sysconfdir}/services.d/storage
138     install -d -m 0750 ${D}${sysconfdir}/services.d/worker
139
140     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/controller
141     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/storage
142     install -m 0750 ${WORKDIR}/ceph.sh ${D}${sysconfdir}/services.d/worker
143
144     install -Dm 0750 ${WORKDIR}/ceph-init-wrapper.sh ${D}${sysconfdir}/rc.d/init.d/ceph-init-wrapper
145     install -Dm 0750 ${WORKDIR}/ceph-init-wrapper.sh ${D}${sysconfdir}/init.d/ceph-init-wrapper
146     sed -i -e 's|/usr/lib64|${libdir}|' ${D}${sysconfdir}/rc.d/init.d/ceph-init-wrapper ${D}${sysconfdir}/init.d/ceph-init-wrapper
147
148     install -m 0700 ${WORKDIR}/ceph-preshutdown.sh ${D}${sbindir}/ceph-preshutdown.sh
149     
150     install -Dm 0644 ${WORKDIR}/starlingx-docker-override.conf ${D}${systemd_system_unitdir}/docker.service.d/starlingx-docker-override.conf
151
152     install -m 0644 -D ${S}/src/etc-rbdmap ${D}${sysconfdir}/ceph/rbdmap 
153     install -m 0644 -D ${S}/etc/sysconfig/ceph ${D}${sysconfdir}/sysconfig/ceph
154     install -m 0644 -D ${S}/src/logrotate.conf ${D}${sysconfdir}/logrotate.d/ceph
155
156     install -m 0644 -D ${S}/COPYING ${D}${docdir}/ceph/COPYING    
157     install -m 0644 -D ${S}/etc/sysctl/90-ceph-osd.conf ${D}${libdir}/sysctl.d/90-ceph-osd.conf
158     install -m 0644 -D ${S}/udev/50-rbd.rules ${D}${libdir}/udev/rules.d/50-rbd.rules
159     install -m 0644 -D ${S}/udev/60-ceph-by-parttypeuuid.rules ${D}${libdir}/udev/rules.d/60-ceph-by-parttypeuuid.rules
160
161     mkdir -p ${D}${localstatedir}/ceph
162     mkdir -p ${D}${localstatedir}/log/ceph
163     mkdir -p ${D}${localstatedir}/lib/ceph/tmp
164     mkdir -p ${D}${localstatedir}/lib/ceph/mon
165     mkdir -p ${D}${localstatedir}/lib/ceph/osd
166     mkdir -p ${D}${localstatedir}/lib/ceph/mds
167     mkdir -p ${D}${localstatedir}/lib/ceph/mgr
168     mkdir -p ${D}${localstatedir}/lib/ceph/radosgw
169     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-osd
170     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-mds
171     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-rgw
172     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-mgr
173     mkdir -p ${D}${localstatedir}/lib/ceph/bootstrap-rbd
174
175     install -m 0755 -d ${D}/${sysconfdir}/tmpfiles.d
176     echo "d ${localstatedir}/run/ceph 0755 ceph ceph -" >> ${D}/${sysconfdir}/tmpfiles.d/ceph.conf
177
178     install -m 0750 -D ${S}/src/init-radosgw ${D}${sysconfdir}/rc.d/init.d/ceph-radosgw
179     install -m 0750 -D ${S}/src/init-radosgw ${D}${sysconfdir}/init.d/ceph-radosgw
180     sed -i '/### END INIT INFO/a SYSTEMCTL_SKIP_REDIRECT=1' ${D}${sysconfdir}/rc.d/init.d/ceph-radosgw
181     sed -i '/### END INIT INFO/a SYSTEMCTL_SKIP_REDIRECT=1' ${D}${sysconfdir}/init.d/ceph-radosgw
182     install -m 0750 -D ${S}/src/init-rbdmap ${D}${sysconfdir}/rc.d/init.d/rbdmap
183     install -m 0750 -D ${S}/src/init-rbdmap ${D}${sysconfdir}/init.d/rbdmap
184     install -m 0750 -D ${B}/bin/init-ceph ${D}${sysconfdir}/rc.d/init.d/ceph
185     install -m 0750 -D ${B}/bin/init-ceph ${D}${sysconfdir}/init.d/ceph
186     install -d -m 0750 ${D}${localstatedir}/log/radosgw 
187 }
188
189 PACKAGES += " \
190     ${PN}-python \
191 "
192
193 FILES_${PN} += "\
194     ${libdir}/rados-classes/*.so.* \
195     ${libdir}/ceph/compressor/*.so \
196     ${libdir}/rados-classes/*.so \
197     ${libdir}/ceph/*.so \
198     ${localstatedir} \
199     ${docdir}/ceph/COPYING \
200     ${libdir}/sysctl.d/90-ceph-osd.conf \
201     ${libdir}/udev/rules.d/50-rbd.rules \
202     ${libdir}/udev/rules.d/60-ceph-by-parttypeuuid.rules \
203     ${systemd_system_unitdir}/mgr-restful-plugin.service \
204     ${systemd_system_unitdir}/ceph-radosgw@.service \
205     ${systemd_system_unitdir}/ceph.service \
206     ${systemd_system_unitdir}/docker.service.d/starlingx-docker-override.conf \
207 "
208 FILES_${PN}-python = "\
209     ${PYTHON_SITEPACKAGES_DIR}/* \
210 "
211
212 RDEPENDS_${PN} += "\
213     bash \
214     python \
215     python-misc \
216     python-modules \
217     python-prettytable \
218     rdma-core \
219     xfsprogs-mkfs \
220     ${PN}-python \
221 "
222
223 COMPATIBLE_HOST = "(x86_64).*"
224
225 INSANE_SKIP_${PN}-python += "ldflags"
226 INSANE_SKIP_${PN} += "dev-so"