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-native \
13    glib-2.0 \
14    e2fsprogs \
15    libcap \
16    zlib \
17    xz \
18    bison-native \
19"
20
21GITHUB_BASE_URI = "https://github.com/ostreedev/ostree/releases"
22SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libostree-${PV}.tar.xz \
23           file://run-ptest \
24           "
25SRC_URI[sha256sum] = "4356170ec5f7a09428b6add77e2c6f31d4049ab765ee67cf929bfa3b750d3e1b"
26
27S = "${WORKDIR}/libostree-${PV}"
28
29inherit autotools bash-completion gobject-introspection github-releases gtk-doc manpages pkgconfig ptest-gnome systemd
30
31UNKNOWN_CONFIGURE_OPT_IGNORE += "--disable-introspection --enable-introspection"
32
33# Workaround compile failure:
34# |../git/src/libotutil/zbase32.c:37:1: error: function returns an aggregate [-Werror=aggregate-return]
35# so remove -Og and use -O2 as workaround
36DEBUG_OPTIMIZATION:remove = "-Og"
37DEBUG_OPTIMIZATION:append = " -O2"
38BUILD_OPTIMIZATION:remove = "-Og"
39BUILD_OPTIMIZATION:append = " -O2"
40
41# Package configuration - match ostree defaults, but without rofiles-fuse
42# otherwise we introduce a dependendency on meta-filesystems and swap
43# soup for curl to avoid bringing in deprecated libsoup2 (though
44# to run ptest requires that you have soup2 or soup3).
45PACKAGECONFIG ??= " \
46    ${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
47    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd libmount', '', d)} \
48    ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'soup3 static', '', d)} \
49    glib \
50    gpgme \
51    curl \
52"
53
54# We include curl because ostree can't (currently) be built without
55# soup or curl - https://github.com/ostreedev/ostree/issues/1897
56PACKAGECONFIG:class-native ??= " \
57    ${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
58    builtin-grub2-mkconfig \
59    gpgme \
60    curl \
61"
62
63PACKAGECONFIG:class-nativesdk ??= " \
64    ${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
65    builtin-grub2-mkconfig \
66    gpgme \
67    curl \
68"
69
70PACKAGECONFIG[avahi] = "--with-avahi, --without-avahi, avahi"
71PACKAGECONFIG[builtin-grub2-mkconfig] = "--with-builtin-grub2-mkconfig, --without-builtin-grub2-mkconfig"
72PACKAGECONFIG[composefs] = "--with-composefs, --without-composefs, composefs"
73PACKAGECONFIG[curl] = "--with-curl, --without-curl, curl"
74PACKAGECONFIG[dracut] = "--with-dracut, --without-dracut"
75PACKAGECONFIG[ed25519-libsodium] = "--with-ed25519-libsodium, --without-ed25519-libsodium, libsodium"
76PACKAGECONFIG[ed25519-openssl] = "--with-openssl, --without-openssl, openssl"
77PACKAGECONFIG[gjs] = "ac_cv_path_GJS=${bindir}/gjs"
78PACKAGECONFIG[glib] = "--with-crypto=glib, , , , , gnutls openssl"
79PACKAGECONFIG[gnutls] = "--with-crypto=gnutls, , gnutls, , , glib openssl"
80PACKAGECONFIG[gpgme] = "--with-gpgme, --without-gpgme, gpgme"
81PACKAGECONFIG[libarchive] = "--with-libarchive, --without-libarchive, libarchive"
82PACKAGECONFIG[libmount] = "--with-libmount, --without-libmount, util-linux"
83PACKAGECONFIG[manpages] = "--enable-man, --disable-man, libxslt-native docbook-xsl-stylesheets-native"
84PACKAGECONFIG[mkinitcpio] = "--with-mkinitcpio, --without-mkinitcpio"
85PACKAGECONFIG[no-http2] = "--disable-http2, --enable-http2"
86PACKAGECONFIG[openssl] = "--with-crypto=openssl, , openssl, , , glib gnutls"
87PACKAGECONFIG[rofiles-fuse] = "--enable-rofiles-fuse, --disable-rofiles-fuse, fuse3"
88PACKAGECONFIG[selinux] = "--with-selinux, --without-selinux, libselinux, bubblewrap"
89PACKAGECONFIG[smack] = "--with-smack, --without-smack, smack"
90PACKAGECONFIG[soup2] = "--with-soup, --without-soup, libsoup-2.4, , , soup3"
91PACKAGECONFIG[soup3] = "--with-soup3, --without-soup3, libsoup, , , soup2"
92PACKAGECONFIG[static] = ""
93PACKAGECONFIG[systemd] = "--with-libsystemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-libsystemd, systemd"
94
95EXTRA_OECONF = " \
96    ${@bb.utils.contains('PACKAGECONFIG', 'static', '--with-static-compiler=\'${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}\'', '', d)} \
97"
98
99# Makefile-libostree.am overrides this to avoid a build problem with clang,
100# but that fix breaks cross compilation and we don't need it
101EXTRA_OEMAKE = " \
102    INTROSPECTION_SCANNER_ENV= \
103"
104
105EXTRA_OECONF:class-native = " \
106    --enable-wrpseudo-compat \
107    --disable-otmpfile \
108"
109
110EXTRA_OECONF:class-nativesdk = " \
111    --enable-wrpseudo-compat \
112    --disable-otmpfile \
113"
114
115# Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the
116# do_configure stage so we do depend on it
117SYSROOT_DIR = "${STAGING_DIR_TARGET}"
118SYSROOT_DIR:class-native = "${STAGING_DIR_NATIVE}"
119do_configure[vardeps] += "SYSROOT_DIR"
120
121do_configure:prepend() {
122    # this reflects what autogen.sh does, but the OE wrappers for autoreconf
123    # allow it to work without the other gyrations which exist there
124    cp ${S}/libglnx/Makefile-libglnx.am ${S}/libglnx/Makefile-libglnx.am.inc
125    cp ${S}/bsdiff/Makefile-bsdiff.am ${S}/bsdiff/Makefile-bsdiff.am.inc
126}
127
128do_install:append:class-native() {
129    create_wrapper ${D}${bindir}/ostree OSTREE_GRUB2_EXEC="${STAGING_LIBDIR_NATIVE}/ostree/ostree-grub-generator"
130}
131
132do_install:append:class-nativesdk() {
133    create_wrapper ${D}${bindir}/ostree OSTREE_GRUB2_EXEC="\$OECORE_NATIVE_SYSROOT/usr/lib/ostree/ostree-grub-generator"
134}
135
136PACKAGE_BEFORE_PN = " \
137    ${PN}-dracut \
138    ${PN}-grub \
139    ${PN}-mkinitcpio \
140    ${PN}-switchroot \
141"
142
143FILES:${PN} += " \
144    ${nonarch_libdir}/${BPN} \
145    ${nonarch_libdir}/tmpfiles.d \
146    ${systemd_system_unitdir} \
147    ${systemd_unitdir}/system-generators \
148"
149FILES:${PN}-dracut = " \
150    ${sysconfdir}/dracut.conf.d \
151    ${libdir}/dracut \
152"
153FILES:${PN}-grub = " \
154    ${sysconfdir}/grub.d \
155    ${libexecdir}/libostree/grub2-15_ostree \
156"
157FILES:${PN}-mkinitcpio = " \
158    ${sysconfdir}/ostree-mkinitcpio.conf \
159    ${libdir}/initcpio \
160"
161FILES:${PN}-switchroot = " \
162    ${nonarch_libdir}/${BPN}/ostree-prepare-root \
163    ${systemd_system_unitdir}/ostree-prepare-root.service \
164"
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 (default)
177#   static ostree-prepare-root
178#   overlayfs in your kernel
179#   busybox built statically
180#   C.UTF-8 locale available (default)
181#   Sufficient disk space/RAM (e.g. core-image-sato-sdk)
182#
183# Something like this in your local.conf:
184#
185# PACKAGECONFIG:append:pn-ostree = " static soup3"
186# KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc"
187# TARGET_CFLAGS:append:pn-busybox = " -static"
188#
189RDEPENDS:${PN}-ptest += " \
190    attr \
191    bash \
192    coreutils \
193    cpio \
194    diffutils \
195    findutils \
196    grep \
197    locale-base-en-us \
198    python3-core \
199    python3-multiprocessing \
200    strace \
201    tar \
202    util-linux \
203    xz \
204    python3-pyyaml \
205    ${@bb.utils.contains('PACKAGECONFIG', 'gjs', 'gjs', '', d)} \
206"
207RDEPENDS:${PN}-ptest:remove:riscv32 = "strace"
208RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-localedata-en-us"
209
210RRECOMMENDS:${PN}:append:class-target = " kernel-module-overlay"
211
212SYSTEMD_SERVICE:${PN} = "ostree-remount.service ostree-finalize-staged.path"
213SYSTEMD_SERVICE:${PN}-switchroot = "ostree-prepare-root.service"
214
215BBCLASSEXTEND = "native nativesdk"
216