xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2021.6.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "Versioned Operating System Repository."
2DESCRIPTION = "libostree is both a shared library and suite of command line \
3tools that combines a \"git-like\" model for committing and downloading \
4bootable filesystem trees, along with a layer for deploying them and managing \
5the bootloader configuration."
6HOMEPAGE = "https://ostree.readthedocs.io"
7LICENSE = "LGPL-2.1-only"
8
9LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
10
11DEPENDS = " \
12    glib-2.0 \
13    e2fsprogs \
14    libcap \
15    zlib \
16    xz \
17    bison-native \
18"
19
20SRC_URI = " \
21    gitsm://github.com/ostreedev/ostree;branch=main;protocol=https \
22    file://run-ptest \
23"
24SRCREV = "f1155c8d283c3c85d74d5e1050b0dcf8198f750a"
25
26UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+)"
27
28S = "${WORKDIR}/git"
29
30inherit autotools bash-completion gobject-introspection gtk-doc manpages pkgconfig ptest-gnome systemd
31
32# Workaround compile failure:
33# |../git/src/libotutil/zbase32.c:37:1: error: function returns an aggregate [-Werror=aggregate-return]
34# so remove -Og and use -O2 as workaround
35DEBUG_OPTIMIZATION:remove = "-Og"
36DEBUG_OPTIMIZATION:append = " -O2"
37BUILD_OPTIMIZATION:remove = "-Og"
38BUILD_OPTIMIZATION:append = " -O2"
39
40# Package configuration - match ostree defaults, but without rofiles-fuse
41# otherwise we introduce a dependendency on meta-filesystems
42PACKAGECONFIG ??= " \
43    ${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
44    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd libmount', '', d)} \
45    glib \
46    gpgme \
47    soup \
48"
49
50# We include soup because ostree can't (currently) be built without
51# soup or curl - https://github.com/ostreedev/ostree/issues/1897
52PACKAGECONFIG:class-native ??= " \
53    ${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
54    builtin-grub2-mkconfig \
55    gpgme \
56    soup \
57"
58
59PACKAGECONFIG:class-nativesdk ??= " \
60    ${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
61    builtin-grub2-mkconfig \
62    gpgme \
63    soup \
64"
65
66PACKAGECONFIG[avahi] = "--with-avahi, --without-avahi, avahi"
67PACKAGECONFIG[builtin-grub2-mkconfig] = "--with-builtin-grub2-mkconfig, --without-builtin-grub2-mkconfig"
68PACKAGECONFIG[curl] = "--with-curl, --without-curl, curl"
69PACKAGECONFIG[dracut] = "--with-dracut, --without-dracut"
70PACKAGECONFIG[glib] = "--with-crypto=glib"
71PACKAGECONFIG[gjs] = "ac_cv_path_GJS=${bindir}/gjs"
72PACKAGECONFIG[gnutls] = "--with-crypto=gnutls, , gnutls"
73PACKAGECONFIG[gpgme] = "--with-gpgme, --without-gpgme, gpgme"
74PACKAGECONFIG[libarchive] = "--with-libarchive, --without-libarchive, libarchive"
75PACKAGECONFIG[libmount] = "--with-libmount, --without-libmount, util-linux"
76PACKAGECONFIG[manpages] = "--enable-man, --disable-man, libxslt-native docbook-xsl-stylesheets-native"
77PACKAGECONFIG[mkinitcpio] = "--with-mkinitcpio, --without-mkinitcpio"
78PACKAGECONFIG[no-http2] = "--disable-http2, --enable-http2"
79PACKAGECONFIG[openssl] = "--with-crypto=openssl, , openssl"
80PACKAGECONFIG[rofiles-fuse] = "--enable-rofiles-fuse, --disable-rofiles-fuse, fuse"
81PACKAGECONFIG[selinux] = "--with-selinux, --without-selinux, libselinux"
82PACKAGECONFIG[smack] = "--with-smack, --without-smack, smack"
83PACKAGECONFIG[soup] = "--with-soup, --without-soup --disable-glibtest, libsoup-2.4"
84PACKAGECONFIG[static] = ""
85PACKAGECONFIG[systemd] = "--with-libsystemd --with-systemdsystemunitdir=${systemd_unitdir}/system, --without-libsystemd, systemd"
86PACKAGECONFIG[trivial-httpd-cmdline] = "--enable-trivial-httpd-cmdline, --disable-trivial-httpd-cmdline"
87
88EXTRA_OECONF = " \
89    ${@bb.utils.contains('PACKAGECONFIG', 'static', '--with-static-compiler=\'${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}\'', '', d)} \
90"
91
92# Makefile-libostree.am overrides this to avoid a build problem with clang,
93# but that fix breaks cross compilation and we don't need it
94EXTRA_OEMAKE = " \
95    INTROSPECTION_SCANNER_ENV= \
96"
97
98EXTRA_OECONF:class-native = " \
99    --enable-wrpseudo-compat \
100    --disable-otmpfile \
101"
102
103EXTRA_OECONF:class-nativesdk = " \
104    --enable-wrpseudo-compat \
105    --disable-otmpfile \
106"
107
108# Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the
109# do_configure stage so we do depend on it
110SYSROOT_DIR = "${STAGING_DIR_TARGET}"
111SYSROOT_DIR:class-native = "${STAGING_DIR_NATIVE}"
112do_configure[vardeps] += "SYSROOT_DIR"
113
114do_configure:prepend() {
115    # this reflects what autogen.sh does, but the OE wrappers for autoreconf
116    # allow it to work without the other gyrations which exist there
117    cp ${S}/libglnx/Makefile-libglnx.am ${S}/libglnx/Makefile-libglnx.am.inc
118    cp ${S}/bsdiff/Makefile-bsdiff.am ${S}/bsdiff/Makefile-bsdiff.am.inc
119}
120
121do_install:append:class-native() {
122    create_wrapper ${D}${bindir}/ostree OSTREE_GRUB2_EXEC="${STAGING_LIBDIR_NATIVE}/ostree/ostree-grub-generator"
123}
124
125do_install:append:class-nativesdk() {
126    create_wrapper ${D}${bindir}/ostree OSTREE_GRUB2_EXEC="\$OECORE_NATIVE_SYSROOT/usr/lib/ostree/ostree-grub-generator"
127}
128
129PACKAGE_BEFORE_PN = " \
130    ${PN}-dracut \
131    ${PN}-grub \
132    ${PN}-mkinitcpio \
133    ${PN}-switchroot \
134    ${PN}-trivial-httpd \
135"
136
137FILES:${PN} += " \
138    ${nonarch_libdir}/${BPN} \
139    ${nonarch_libdir}/tmpfiles.d \
140    ${systemd_unitdir}/system \
141    ${systemd_unitdir}/system-generators \
142"
143FILES:${PN}-dracut = " \
144    ${sysconfdir}/dracut.conf.d \
145    ${libdir}/dracut \
146"
147FILES:${PN}-grub = " \
148    ${sysconfdir}/grub.d \
149    ${libexecdir}/libostree/grub2-15_ostree \
150"
151FILES:${PN}-mkinitcpio = " \
152    ${sysconfdir}/ostree-mkinitcpio.conf \
153    ${libdir}/initcpio \
154"
155FILES:${PN}-switchroot = " \
156    ${nonarch_libdir}/${BPN}/ostree-prepare-root \
157    ${systemd_unitdir}/system/ostree-prepare-root.service \
158"
159FILES:${PN}-trivial-httpd = " \
160    ${libexecdir}/libostree/ostree-trivial-httpd \
161"
162
163RDEPENDS:${PN} = " \
164    ${@bb.utils.contains('PACKAGECONFIG', 'trivial-httpd-cmdline', '${PN}-trivial-httpd', '', d)} \
165"
166RDEPENDS:${PN}-dracut = "bash"
167RDEPENDS:${PN}-mkinitcpio = "bash"
168RDEPENDS:${PN}:class-target = " \
169    ${@bb.utils.contains('PACKAGECONFIG', 'gpgme', 'gnupg', '', d)} \
170    ${PN}-switchroot \
171"
172
173#
174# Note that to get ptest to pass you also need:
175#
176#   xattr in DISTRO_FEATURES
177#   static ostree-prepare-root (PACKAGECONFIG:append:pn-ostree = " static")
178#   meta-python in your layers
179#   overlayfs in your kernel (KERNEL_EXTRA_FEATURES += "features/overlayfs/overlayfs.scc")
180#   busybox built statically
181#   /var/tmp as a real filesystem (not a tmpfs)
182#   Sufficient disk space (IMAGE_ROOTFS_SIZE = "524288") and RAM (QB_MEM = "-m 1024")
183#
184RDEPENDS:${PN}-ptest += " \
185    attr \
186    bash \
187    coreutils \
188    cpio \
189    diffutils \
190    findutils \
191    grep \
192    python3-core \
193    python3-multiprocessing \
194    strace \
195    tar \
196    util-linux \
197    xz \
198    ${PN}-trivial-httpd \
199    python3-pyyaml \
200    ${@bb.utils.contains('PACKAGECONFIG', 'gjs', 'gjs', '', d)} \
201"
202RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-localedata-en-us"
203
204RRECOMMENDS:${PN}:append:class-target = " kernel-module-overlay"
205
206SYSTEMD_SERVICE:${PN} = "ostree-remount.service ostree-finalize-staged.path"
207SYSTEMD_SERVICE:${PN}-switchroot = "ostree-prepare-root.service"
208
209BBCLASSEXTEND = "native nativesdk"
210